Page 1 of 1

How to make a tile/grid based game?

Posted: Mon Jul 03, 2023 9:45 pm
by KTKNM
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.

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

Posted: Tue Jul 04, 2023 11:45 am
by akuyou
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.

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

Posted: Tue Jul 11, 2023 8:30 pm
by KTKNM
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)

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

Posted: Wed Jul 12, 2023 9:47 am
by akuyou
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.