Page 1 of 5

Mini Motors

Posted: Wed Aug 16, 2023 9:43 am
by Dacobi
"Mini Motors" is the game I was working on that caused me to start writing TilemapEd because I couldn't find a way to create tilemaps that I liked.

The original idea was to make a sort of clone of "Micro Machines", but the only real connection is in name and in spirit.

The state of the game is "alpha test release", with 2 test tracks and incomplete game play/game logic and game SFX.

The reason I'm uploading was if anyone was interested in looking at the source.

The game is basically stable, but I still encounter bugs now and then.

The code is written mostly in C with an asm file for interrupt handling, using cc65.
At some places in the code there may still be remnants of other peoples code that I found in different places on the net.
Originally I used Kevin Murphys custom keyboard handling routine, which has now been replaced with a version that works with r43.
I also originally started with some C code for rendering sprites on the X16, which I can't remember where I found.

There is also a "tools" folder which contains various small C++ programs that I use to write different tables for include files, etc.

The code is set up so that tracks can be modified or new tracks can be added (up to a total of 9) without having to recompile the code. In the "DAT" folder there's a file, "GAME" which contains the number of tracks and the various VRAM addresses for the different tracks.

There are both Win64/PowerShell and Linux/bash versions of the necessary tools and scripts.
For more information check out the script "makegame" or "makegame.ps1"

Source code and asset files can be found in the "Mini Motors" GitHub repo:
https://github.com/dacobi/minim

If anyone wants to try and run the game in the emulator you can download the latest SD image/Game folder here:
https://github.com/dacobi/minim/blob/main/minim.zip

Just extract the zip file and run:

Code: Select all

x16emu.exe [ -joy1 -joy2 -joy3 -joy4 ] -sdcard minim.img
Or copy the "MINIM" folder to your x16emu folder or SD card.

Then in BASIC:

Code: Select all

DOS "CD:MINIM"
LOAD "MINIM.PRG"
...
RUN
The menu is controlled using Arrow keys and ENTER. Players can either use joysticks 1-4 or Arrow keys and WASD (K1 and K2) or they can be set to AI.

The game is made using Gimp and TilemapEd, with some of the graphical assets starting out as modified versions of Midjourney images.

For a short video tutorial on how to create TileSets and Palettes using TilemapEd and Gimp and use them in tracks for "Mini Motors" goto my YouTube channel here:
Creating Tiles in TilemapEd from a Gimp Image

The soundtracks was something I made many years ago using various HW synths + Ableton Live. They may not be the best fit for the game, but they were the most appropriate of my own tracks, which is all I have the rights to use.

Here's a few screenshots of the game
menutrack.png
menutrack.png (38.19 KiB) Viewed 8643 times
newmeadow.png
newmeadow.png (1.1 MiB) Viewed 8242 times
newdesert.png
newdesert.png (2.25 MiB) Viewed 8242 times

Re: Mini Motors

Posted: Wed Aug 16, 2023 11:48 am
by Edmond D
Looks fabulous! I'm behind on many things so I've not gotten a system up with the latest emulator version to try it out. Now I want to.

I look forward to the day I have a real X16 and your game has been released.

Re: Mini Motors

Posted: Wed Aug 16, 2023 1:30 pm
by Dacobi
Thanks for the feedback : )

I should be ready with an update to the game logic, so that the game actually makes sense to play, within a day or two.

Re: Mini Motors

Posted: Wed Aug 16, 2023 11:13 pm
by ahenry3068
It looks awesome.

Re: Mini Motors

Posted: Thu Aug 17, 2023 5:25 am
by voidstar
Good start!

I remember MicroMachines and racing around Cheerios on the table :D Then on the IBM PC I remember some Super Off Road, something like that - race "RC trucks" around a track.

Rad glow effect when you go off road!


"K2" - keyboard #2 is a thing??

Should it be "J1" or "G1"? GamePad system, not a joystick :P

Nice start, it's a game and showing cc65 can do some stuff!

(tree aren't to scale, unless those are "microtree's"? just teasing :D )

Here's a challenge: micro racing game like this, while on an active MODEL TRAIN TRACK? watch out when you hear that train horn coming. Can the X16 handle doing articulated background like that?

Re: Mini Motors

Posted: Thu Aug 17, 2023 6:44 am
by Dacobi
Thanks for the feedback and awesome to see the game running on an actual X16 : )
Rad glow effect when you go off road!
This is just a temporary debugging measure so I could test that my collision map worked correctly. It will soon be replaced with a timer so that players are eliminated if they are outside the track for too long, just like the original "Micro Machines".
"K2" - keyboard #2 is a thing??
K2 stands for WASD. I should probably have written something about how the controls work, but it's still very early so my focus was elsewhere.

Regarding J1 or G1, I used "J" since the emulators arguments are -joy1 etc.
Nice start, it's a game and showing cc65 can do some stuff!
That's one of the reasons I uploaded the source. I'm already stretching the limit for what the 6502 can handle pr frame. I know writing a game like this in C doesn't help the performance, but I simply don't have the skills to write something like this in asm.

Re: Mini Motors

Posted: Fri Aug 18, 2023 1:40 pm
by Dacobi
I just uploaded a new SD image which has the very basic regarding game logic, but everything is super janky and buggy.

The primary updates are:
  • Viewport is centred around the leading player
  • Players can be eliminated if they lag too far behind the leading player or leave the track for too long
  • Sprite animation for player elimination
  • Sound effects for player elimination and collision
  • Initial attempt at engine sound

As for the jankiness and bugs, I ended up running out of DATA memory (BSS segment IIRC) so I had to move my PCM buffer to BANK_RAM, which for some reason causes some clicks in the audio. Don't know if this is also the source of my memory corruption.
I end up with corrupted sprite data and other weirdness and sometimes the program just crashes or hangs.

Some of the jankiness might be the way I transition the viewport when a new leader is chosen, but I can't really figure out what is bugs in the code and what is memory corruption.

Aside from all the bugs the game can now be played in a meningful sense, although it's rather rare to complete a race without any problems.

Re: Mini Motors

Posted: Sun Aug 20, 2023 7:32 pm
by Johan Kårlin
This looks really good! I am looking forward to see its progression.
Dacobi wrote: Wed Aug 16, 2023 9:43 am Another problem seems to be the way I quit the game back to BASIC. I often end up with an error "?OUT OF DATA ERROR".
Have you emptied the keyboard buffer before returning to BASIC? Maybe the system prints "READY.", then it reads UP and ENTER from the buffer which results in the command "READ Y.", but there is no data to read. In my assembler games I simply do:

Code: Select all

EmptyBuffer:
jsr $FFE4   ; Kernal GETIN
cmp #0
bne EmptyBuffer
In my case I get garbage left in the buffer because I often use the keyboard joystick, all those key presses fill the buffer as it seems..

Re: Mini Motors

Posted: Mon Aug 21, 2023 11:05 am
by Dacobi
Hello Johan and thanks for your feedback : )

I've added your code to my IRQ handler remove function and it seems to have fixed the problem.

Regarding progression of the game, I'm starting to fear that I'll have to start over in assembly.
I've almost reached the limit for how much memory the C compiler can use, and I have bugs and memory corruption everywhere, which may be because of the C compiler and the memory running out or overwriting different structs etc.

I had to move my PCM buffer to Banked RAM because the C compiler ran out, so that would mean I have less than 4KB left.
For some reason there's a pop in the PCM audio in the beginning of the track, which wasn't there when the buffer was in normal RAM.

Edit: Also, I'd really like to have the graphical skills to create 8-bit pixel art, like what you have in your game : )

Re: Mini Motors

Posted: Mon Aug 21, 2023 11:20 am
by Dacobi
One thing I really don't understand is how I can end up with only one corrupted car sprite, when all cars are the same sprite only with different palette offsets. I would think that in that case all car sprites should be corrupted?