New game uploaded: GRIDGAME

All aspects of programming on the Commander X16.
Post Reply
Michael Parson
Posts: 51
Joined: Sun Jan 03, 2021 8:18 pm

New game uploaded: GRIDGAME

Post by Michael Parson »




GRIDGAME




View File






(full source available https://github.com/mparson/gridgame)

GridGame

A game for the Commander X-16!

A 'C' implementation of a Flash game I used to play a lot of back in the days of Flash games.

Read about the original game here: https://jayisgames.com/review/gridgame.php

I'd say this game is ~95% faithful to that original game.  Some of the limitations are due to my use of the so-called PETSCII character set for the graphics instead of custom graphics, which means there is no smooth animation of the pieces as they are activated.  I've also not included any sounds, but that might come in a future version.

This is original code that implements the gameplay, I did not port the embedded ActionScript of the original SWF game.

New feature in v0.9.5:

Replayable boards, the "REPLAY" button will reset the board to where it was after the last "RESET", "EDIT" or "LOAD".  Try it again, see if you can get a better score from the same starting board.

New feature in v0.9.

Click on the 'EDIT' button and you can edit the board.

Congratulations, you are now in the most frustrating and feature limited PETSCII drawing program ever.

The boarder changes to '*' from the line-drawing characters. You can now click on a piece to rotate it without triggering a chain reaction. If you click on one of the '*' on the boarder, it will change the entire row or column to match the adjacent piece.

When you 'SAVE' a board, it will not check for a previous file, it will silently overwrite it. Similarly, attempting to 'LOAD' a non-existent board will silently not load a board and return you to the editor.

Click on 'DONE' to play the board.

Why?

Why write this game?  

Well, two basic reasons.  

First, I decided to take another run at picking up the C programming language, and like learning any new language, it helps if you have a project in mind that you want to implement.

Why write for this platform?  Being a fan of the Commodore 8-bit computers and following the development of the Commander-X16, I thought it would be a fun platform to target.

Compiling the code

This was developed with the  cc65 compiler, so, you'll need it installed.  I tend to work with the latest version out of git rather than one of the binary packages, so, YMMV with getting it compile if you use a potentially older version of the compiler suite.

Edit the `Makefile` and fix the paths to the various binaries at the top.

A simple `make` should give you a `GRIDGAME` that you can now load up on an X-16.

It should be a minimal effort to make a C-64 and C-128 version as well, probably coming soon.

Notes on the kwalitee of my code

Yeah, very intentional bad spelling there.  I make no claims to my skills as a C programmer.  This is probably not "good" C code and most definitely not optimized in the suggested ways you should when writing for `cc65` compiler and the 6502 CPU.

Potential features for future versions:

* Versions for the C-64 & C-128

* Sound - I'll need to read up on how to make cc65 generate sounds.  It's documented, but I've not tried that yet.  Step 1 was to get the basic game working.

* See if it will compile with KickC, then all dev work could even be done on the system it is played on!






 
Michael Parson
Posts: 51
Joined: Sun Jan 03, 2021 8:18 pm

New game uploaded: GRIDGAME

Post by Michael Parson »


Not sure why the "try it now" isn't working...  Same file loads fine in the native emulator.

[edit]

Re-uploaded as 'GRIDGAME.PRG' and edited the name of the file to be run, now it works in the web emu.

Michael Parson
Posts: 51
Joined: Sun Jan 03, 2021 8:18 pm

New game uploaded: GRIDGAME

Post by Michael Parson »


New version uploaded, v0.6.  Only feature change is saving high scores to disk.  The save is triggered at the end of a run if there is a new high score.  Happens very quickly, all you'll really see is a blink of the drive activity indicator in the top-right corner, if you're watching for it.

For giggles, I tried compiling it with '-tc64'

Under vice, once I figured out how to make the mouse work, it was surprisingly fast.  The mouse movement was all wobbly and jumpy, but, for the most part, it worked.  Saving the highscore file takes a few seconds, but not terribly long.

Tried it on my MiSTer's C-64 core and the mouse was nice and smooth.

Both environments (vice & MiSTer) did weird things though.  There were strange character artifacts that popped up in a few places during game play, and I'm pretty sure something was going goofy with the processing of the queue of which pieces to rotate, as I was getting WAY higher scores on the C64 version, probably due to the queue filling up and wrapping.  I've not spent any time trying to debug it, just thought it was interesting.

I'm guessing the character artifacts are due to screen memory getting overwritten, might be able to solve that by digging into the cc65 best practices on variable handling and seeing if I can tune that up a bit.

Next feature to work on: Board editing (with saving & loading).  I worked on the high score stuff first since I figured it would be a good way to learn how to open,read/write or remove, and close files.  That turned into an adventure of its own.

Michael Parson
Posts: 51
Joined: Sun Jan 03, 2021 8:18 pm

New game uploaded: GRIDGAME

Post by Michael Parson »


New version upload, v0.9.1 - Board Edit Edition

Click on the 'EDIT' button and you can edit the board.

Congratulations, you are now in the most frustrating and feature limited PETSCII drawing program ever.

The boarder changes to '*' from the line-drawing characters. You can now click on a piece to rotate it without triggering a chain reaction. If you click on one of the '*' on the boarder, it will change the entire row or column to match the adjacent piece.

When you 'SAVE' a board, it will not check for a previous file, it will silently overwrite it. Similarly, attempting to 'LOAD' a non-existent board will silently not load a board and return you to the editor.

Click on 'RESET' under the HIGH SCORE and your HIGH SCORE will be reset to '0' and saved.

Click on 'DONE' to play the board.

None of the stuff around saving/loading works unless it is run from an sdcard.

Michael Parson
Posts: 51
Joined: Sun Jan 03, 2021 8:18 pm

New game uploaded: GRIDGAME

Post by Michael Parson »


New version upload, v0.9.5 - replayable boards.

New "REPLAY" button resets the game to the last generated/edited/loaded board so you can try for a higher score on the same board.

Unrelated to gameplay, I also broke the source code into modules from a single monolithic file.

Post Reply