How to make a tile/grid based game?

Posts relating to ZX Spectrum (and clones)... also Spectrum NEXT
Post Reply
KTKNM
Posts: 11
Joined: Mon Jan 30, 2023 5:30 pm

How to make a tile/grid based game?

Post by KTKNM » Mon Jul 03, 2023 9:45 pm

For weeks I have been trying to make a grid-based game.
(16x16 pixel sized tiles on a 16x12 grid with a character movement that checks for the type of tile in front of the player character for collision)
I made some crudely written engine but ditched it because it was trash + I felt like I was doing something wrong when writing it.

Has anyone here ever made a tile-based game and could help me?
Thank you.

User avatar
akuyou
Posts: 564
Joined: Mon Apr 22, 2019 3:19 am
Contact:

Re: How to make a tile/grid based game?

Post by akuyou » Tue Jul 04, 2023 11:45 am

Checkout Grime Z80.
https://www.chibiakumas.com/z80/grimez80.php

it used a 'tilemap' (bitmap 8x8 graphics), and is the simplest example of such that I have done.
The player could shoot and collide with the background, in a similar way to what you describe.
Chibi Akuma(s) Comedy-Horror 8-bit Bullet Hell shooter! // 「チビ悪魔」可笑しいゴシックSTG ! // Work in Progress: ChibiAliens

Interested in CPU's :Z80,6502,68000,6809,ARM,8086,RISC-V
Learning: 65816,ARM,8086,6809

KTKNM
Posts: 11
Joined: Mon Jan 30, 2023 5:30 pm

Re: How to make a tile/grid based game?

Post by KTKNM » Tue Jul 11, 2023 8:30 pm

akuyou wrote: Tue Jul 04, 2023 11:45 am Checkout Grime Z80.
https://www.chibiakumas.com/z80/grimez80.php

it used a 'tilemap' (bitmap 8x8 graphics), and is the simplest example of such that I have done.
The player could shoot and collide with the background, in a similar way to what you describe.
So I was browsing through the GrimeZ80.asm, and one question I have is where is the ShowTile subroutine?
I checked the attached .asm files which might has some graphics code in them, and ShowTile was never mentioned in any.

When adapting the code to my game, I just used a different (taken from a different ZX Spectrum gamedev tutorial series) subroutine for drawing graphics to the screen, which doesn't work correctly with this tilemap code.

I made my own tile bitmap pieces directly in the code by writing rows of 0s and 1s, which works fine with this bitmap subroutine. (I also find this method faster than using a special software and attaching the exported file, if the target platform has 1-bit graphics)

User avatar
akuyou
Posts: 564
Joined: Mon Apr 22, 2019 3:19 am
Contact:

Re: How to make a tile/grid based game?

Post by akuyou » Wed Jul 12, 2023 9:47 am

The "Showtile" routine is in the included asm file "Z:\SrcALL\V1_SimpleTile.asm"

If you can't find things in a set of asm files it's worth using the "Find in Files" function of Notepad++ (Most other programmers editors have a similar function). With it you can search all ASM files in folders for a certain keyword/subroutine.
Chibi Akuma(s) Comedy-Horror 8-bit Bullet Hell shooter! // 「チビ悪魔」可笑しいゴシックSTG ! // Work in Progress: ChibiAliens

Interested in CPU's :Z80,6502,68000,6809,ARM,8086,RISC-V
Learning: 65816,ARM,8086,6809

Post Reply

Return to “ZX Spectrum Assembly Programming”