Freeplaytech Forum

Full Version: New Game Block Dude (Port)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi ya'll
New to the forum and NGPC in general. Picked one up recently along with Sonic Pocket, though I've wanted one ever since little 10-year old me read an issue of Game Informer that ran a profile on the system. My programming skills are...not the best. What little work I do is in MatLAB, and haven't done any games since a C++ course freshman year of college (waaay too long ago).
To get the basics down, I am working on a simple port of the calculator classic "Block Dude". Since Assembly is complete nonsense to me, I re-wrote everything in C and got the game up and running. The mechanics are complete, it plays through all 11 levels, and runs on a NGP emulator (Bizhawk with Windows10), but it is ugly. And not just because a dyslexic fifth grader could have written cleaner code.
As of now, the game is completely in ASCII, because I cannot import sprites or tiles. I got started by following Chris Ahchay's blog and using the compiler/tile editor/Library/etc. he uploaded, but I can't get either InstallTileSet function to work. And I am not smart enough to write my own function that imports tiles and sprites directly to RAM for an obscure platform like the NGP. So, two questions:
First, does someone have an absolute basic sample code (in C) of getting sprites on the screen using this library? Like "here's a 8x8 pixel face on the screen"? I learn best by studying and reverse engineering example code. In other words, copying and pasting till it works. Below is a sample code I put together from Ahchay's blog.
Second-where's a good spot to upload finished NGPC games? I don't have a flashcard yet (Stoneage Gamer is sold out) and cannot test on real hardware, but might as well send this program out into the wild.
Thanks in advance!
[attachment=1312]
Hey scomico! It's great to see new projects like this popping up. I have 2 quick comments for you.

1) Check the code at http://sebastianmihai.com/neogeo-pocket-...ector.html to see if it's at all helpful. It's a simple game, and he has the full source code and all the tools he used, if I recall correctly.

2) FlashMasta.com does have carts available. They're different than the ones Stoneagegamer sells.
(02-06-2022, 01:53 PM)scomico Wrote: [ -> ]Hi ya'll
New to the forum and NGPC in general. Picked one up recently along with Sonic Pocket, though I've wanted one ever since little 10-year old me read an issue of Game Informer that ran a profile on the system. My programming skills are...not the best. What little work I do is in MatLAB, and haven't done any games since a C++ course freshman year of college (waaay too long ago).
To get the basics down, I am working on a simple port of the calculator classic "Block Dude". Since Assembly is complete nonsense to me, I re-wrote everything in C and got the game up and running. The mechanics are complete, it plays through all 11 levels, and runs on a NGP emulator (Bizhawk with Windows10), but it is ugly. And not just because a dyslexic fifth grader could have written cleaner code.
As of now, the game is completely in ASCII, because I cannot import sprites or tiles. I got started by following Chris Ahchay's blog and using the compiler/tile editor/Library/etc. he uploaded, but I can't get either InstallTileSet function to work. And I am not smart enough to write my own function that imports tiles and sprites directly to RAM for an obscure platform like the NGP. So, two questions:
First, does someone have an absolute basic sample code (in C) of getting sprites on the screen using this library? Like "here's a 8x8 pixel face on the screen"? I learn best by studying and reverse engineering example code. In other words, copying and pasting till it works. Below is a sample code I put together from Ahchay's blog.
Second-where's a good spot to upload finished NGPC games? I don't have a flashcard yet (Stoneage Gamer is sold out) and cannot test on real hardware, but might as well send this program out into the wild.
Thanks in advance!


Hello and wellcome. The error it's because you have the call to InstallTileSet method out of Main function. You can't call functions out of main function (or sub-functions).

As Flavor says, look up Ahchay's tutorials and follow it step by step.
As KeiDash mentioned above - you need to move that call into the void main() immediately after the call to SysSetSystemFont()

It looks like you might have jumped in on my tutorial pages halfway through, I'll have a look at clearing up the page that talks about custom graphics - I don't claim them to be perfect, so always willing to make them better!

My github repo has source for most of my projects - Your Repositories (github.com)

Try looking at DDMR.NGP - that's a pretty basic implementation of a basic sprite system and movement.
(02-09-2022, 01:17 AM)Ahchay Wrote: [ -> ]As KeiDash mentioned above - you need to move that call into the void main() immediately after the call to SysSetSystemFont()

It looks like you might have jumped in on my tutorial pages halfway through, I'll have a look at clearing up the page that talks about custom graphics - I don't claim them to be perfect, so always willing to make them better!

My github repo has source for most of my projects - Your Repositories (github.com)

Try looking at DDMR.NGP - that's a pretty basic implementation of a basic sprite system and movement.

@Ahchay, I used your tutorials as my starting point.

A couple of points of feedback for anyone starting out there now.

1. The theory explained about tiles/sprites is good.  However, the best image tool for use with NGPC is, without question, sodthor's CodeImage.  You don't have to fuss with any difficult custom image editors.  Just draw up something in a regular editor, save it as png (with transparency supported) and process it through CodeImage with the settings you need, and it will give you usable C arrays of the images, and it supports reducing the tiles needed in a tileset by using flipping and recognizing duplicates in the tileset.

However, I am having a hard time tracking down a public link for those.  @sodthor, are your ngpc tools public at this point?  I can't access your pdroms.de page anymore, and can't remember if that's where I originally found CodeImage.  I personally run a modified version of it that may not work for everyone else, but I can post it if @sodthor is ok with that.

Edit: I thought of another item to note about images. There are 2 approaches for animating sprites:
a: Load all frames of animation for a given sprite/tile into tile RAM, and reassign which tile the sprite uses. This has the drawback of taking up precious tile RAM that could be used for more tile variety in the level. The benefit may be that it's a pretty quick operation.
b: Load only one frame of animation for a given sprite/tile, and update that specific tile directly in tile RAM to the frame needed. The tile gets automatically redrawn when the tile RAM is edited with the new frame of animation. The drawback is it likely takes longer than above, but the benefit is that only the minimum number of tiles are taken up by your animated objects. I have find the performance to be acceptable and use this method. I use so many frames of animation that it would not be feasible to pre-load them. I would fill up the tile RAM used by frames for sprites before I ever loaded in tiles for the level.

2. Sound/music has a much better option now.  I have put some details and link in this thread: https://forum.freeplaytech.com/showthread.php?tid=5300
(02-08-2022, 05:18 AM)Flavor Wrote: [ -> ]FlashMasta.com does have carts available.  They're different than the ones Stoneagegamer sells.

For those seriously dabbling in NGPC development, the FlashMasta cart is the way to go.  I end up testing most of my code iterations on hardware and the workflow for the FlashMasta is the fastest.

FlashMasta workflow:
1. Compile your code into NGPC rom.
2. Plug your cart into PC.
3. Open FlashMasta program, choose slot, and write your latest rom to the cart.
4. When it's done, unplug and put it in your NGPC for testing.

Neo Pocket Game Drive workflow:
1. Compile your code into NGPC rom.
2. Insert the SD card into your PC.
3. Transfer your NGPC rom to the card.
4. Unmount SD card.
5. Put it in NGPC cart and boot up.
6. Transfer the rom to flash and play.

I own both, and the FlashMasta is my preference for development.  If I only had the Game Drive, I would probably not test my code on hardware as often.
(02-09-2022, 07:28 AM)winteriscoming Wrote: [ -> ]For those seriously dabbling in NGPC development, the FlashMasta cart is the way to go.  I end up testing most of my code iterations on hardware and the workflow for the FlashMasta is the fastest.

FlashMasta workflow:
1. Compile your code into NGPC rom.
2. Plug your cart into PC.
3. Open FlashMasta program, choose slot, and write your latest rom to the cart.
4. When it's done, unplug and put it in your NGPC for testing.

FYI, you may also be able to use the CLI (command-line) app under the "Old/CLI" heading here: https://www.flashmasta.com/software-downloads/ to skip some mouse clicks.
@winteriscoming - thanks, that's helpful. I haven't looked at your sound solution in detail yet, but I'll do that and update the pages. I'll have another play with the images too.

WRT the animation idea, I use your second approach. A structured array holding the animation data (indexed on Action & Direction & Frame - so ACT_WALK + DIR_LEFT + iFrame or whatever) - I then use a slightly modified version of LoadTile() to update into tile memory at the right point. Works well, but could probably be optimised better
"@sodthor, are your ngpc tools public at this point? I can't access your pdroms.de page anymore, and can't remember if that's where I originally found CodeImage. I personally run a modified version of it that may not work for everyone else, but I can post it if @sodthor is ok with that."

it's ok
(02-09-2022, 07:59 PM)sodthor Wrote: [ -> ]"@sodthor, are your ngpc tools public at this point?  I can't access your pdroms.de page anymore, and can't remember if that's where I originally found CodeImage.  I personally run a modified version of it that may not work for everyone else, but I can post it if @sodthor is ok with that."

it's ok

Thanks!  I have made a dedicated thread for it: https://forum.freeplaytech.com/showthread.php?tid=5301
Pages: 1 2