Example Platform Engine

Started by OldRover, 10/10/2011, 02:40 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

OldRover

mrhaboobi was asking about this, so I figured I would just release it to the general public. This is a relatively simplistic platform engine that presently supports idle state, moving around, jumping, standing attack, and jump-down-from-platform capabilities. Other states are included but unfinished. It doesn't have any entity handling (no pickups or enemies), as that's a whole different subject and differs from game to game depending on need.

I put up two packages: a complete ready-to-run package, and a source-only package. The complete package is 33.2MB because it contains three audio tracks, the other is about 48KB... add your own WAV files. :)

https://web.archive.org/web/2000/http://www.frozenutopia.com/platformengine-ready.7z   Ready-to-run version
https://web.archive.org/web/2000/http://www.frozenutopia.com/platformengine.7z   Add-your-own-WAVs version

I commented it as best I could, and some parts are not optimal, but it works, and quite well too. Feel free to use and abuse as you see fit. :) All flames will be redirected to /dev/null.
Turbo Badass Rank: Janne (6 of 12 clears)
Conquered so far: Sinistron, Violent Soldier, Tatsujin, Super Raiden, Shape Shifter, Rayxanber II

Arkhan Asylum

Hehe, NeutopiaChirpy.

Sounds familiar.
This "max-level forum psycho" (:lol:) destroyed TWO PC Engine groups in rage: one by Aaron Lambert on Facebook "Because Chris 'Shadowland' Runyon!," then the other by Aaron Nanto "Because Le NightWolve!" Him and PCE Aarons don't have a good track record together... Both times he blamed the Aarons in a "Look-what-you-made-us-do?!" manner, never himself nor his deranged, destructive, toxic turbo troll gang!

OldRover

I swiped it from Squirrel. :P hehe
Turbo Badass Rank: Janne (6 of 12 clears)
Conquered so far: Sinistron, Violent Soldier, Tatsujin, Super Raiden, Shape Shifter, Rayxanber II

Arkhan Asylum

Yeah, I figured lol.  Noone around these parts uses "chirpy" very often, ;)


This "max-level forum psycho" (:lol:) destroyed TWO PC Engine groups in rage: one by Aaron Lambert on Facebook "Because Chris 'Shadowland' Runyon!," then the other by Aaron Nanto "Because Le NightWolve!" Him and PCE Aarons don't have a good track record together... Both times he blamed the Aarons in a "Look-what-you-made-us-do?!" manner, never himself nor his deranged, destructive, toxic turbo troll gang!

jlued686

Very cool of you to do this, Rover.

Excuse my ignorance, but would it be useful - to encourage people into the PC Engine homebrew scene - to write up some sort of "Here's what you need to know and do to program a PC Engine game" guide? I'm not sure what would be involved in that, nor how long it would take as I have no coding/programming knowledge whatsoever. I'm just curious.

Arkhan Asylum

It might help.  There was a guide similar to that at some point on the internet, but like most things in the PCE homebrew scene, it never got finished

I myself thought about doing a series of video tutorials about how to make chiptunes with Squirrel quickly and effectively.  It's something else that the scene could use as far as how-tos.

The only thing holding me back is I can't stand doing video editing/doodling, so I immediately get discouraged.  I may try it again using my girlfriend as a film slave.  She does cameras/video stuff and enjoys it, lol.
This "max-level forum psycho" (:lol:) destroyed TWO PC Engine groups in rage: one by Aaron Lambert on Facebook "Because Chris 'Shadowland' Runyon!," then the other by Aaron Nanto "Because Le NightWolve!" Him and PCE Aarons don't have a good track record together... Both times he blamed the Aarons in a "Look-what-you-made-us-do?!" manner, never himself nor his deranged, destructive, toxic turbo troll gang!

mrhaboobi

Awesome Rover.  Thanks alot for that :)
Looking for (MINT ONLY)
US Manual : Magical Chase, Shockman 
US Box : Turrican,  Soldier Blade, New Adventure Island, Neutopia II
Other : Sapphire OBI, Turbo Play Aug/Sept 90, April/May 92, Turbo Edge Spring 90

PC Engine Special Cards : Bomberman User Battle

Alydnes Super Grafx

touko

#7
Quote from: guest on 10/10/2011, 09:34 PMIt might help.  There was a guide similar to that at some point on the internet, but like most things in the PCE homebrew scene, it never got finished

I myself thought about doing a series of video tutorials about how to make chiptunes with Squirrel quickly and effectively.  It's something else that the scene could use as far as how-tos.
Yes, it's trilinear's "echo's quest" i think..

Arkhan Asylum

Quote from: touko on 10/11/2011, 06:07 AM
Quote from: Psycho Arkhan on 10/10/2011, 09:34 PMIt might help.  There was a guide similar to that at some point on the internet, but like most things in the PCE homebrew scene, it never got finished

I myself thought about doing a series of video tutorials about how to make chiptunes with Squirrel quickly and effectively.  It's something else that the scene could use as far as how-tos.
Yes, it's trilinear's "echo's quest" i think..
It might have been.  I don't seem to recall it being Trilinear though.

Too bad that person isn't around anymore.  They were doing some neat things
This "max-level forum psycho" (:lol:) destroyed TWO PC Engine groups in rage: one by Aaron Lambert on Facebook "Because Chris 'Shadowland' Runyon!," then the other by Aaron Nanto "Because Le NightWolve!" Him and PCE Aarons don't have a good track record together... Both times he blamed the Aarons in a "Look-what-you-made-us-do?!" manner, never himself nor his deranged, destructive, toxic turbo troll gang!

touko

Yes, trilinear, eagan, jycet, and many others have stopped everything.

Arkhan Asylum

Jycet's stuff was the first PCE code I ever looked at. 

Any idea why they bailed?  They're before my time.
This "max-level forum psycho" (:lol:) destroyed TWO PC Engine groups in rage: one by Aaron Lambert on Facebook "Because Chris 'Shadowland' Runyon!," then the other by Aaron Nanto "Because Le NightWolve!" Him and PCE Aarons don't have a good track record together... Both times he blamed the Aarons in a "Look-what-you-made-us-do?!" manner, never himself nor his deranged, destructive, toxic turbo troll gang!

OldRover

Trilinear's "Echos Quest" was a basic platformer with parallax scrolling. The only problem is that he used sprites to do the background layer, which worked fine in Magic Engine but obviously on real hardware or a proper emulator, it looked like crap. And I think they all bailed for two reasons:

-None of them were serious
-Zeograd abandoned HuC

Of course, not everyone has to be a serious developer. It's fine to just tinker with stuff and learn.
Turbo Badass Rank: Janne (6 of 12 clears)
Conquered so far: Sinistron, Violent Soldier, Tatsujin, Super Raiden, Shape Shifter, Rayxanber II

Arkhan Asylum

Quote from: The Old Rover on 10/11/2011, 01:08 PMwhich worked fine in Magic Engine but obviously on real hardware or a proper emulator, it looked like crap.
???

What do you mean thurrrrr
This "max-level forum psycho" (:lol:) destroyed TWO PC Engine groups in rage: one by Aaron Lambert on Facebook "Because Chris 'Shadowland' Runyon!," then the other by Aaron Nanto "Because Le NightWolve!" Him and PCE Aarons don't have a good track record together... Both times he blamed the Aarons in a "Look-what-you-made-us-do?!" manner, never himself nor his deranged, destructive, toxic turbo troll gang!

dudule


OldRover

Quote from: guest on 10/11/2011, 02:46 PM???

What do you mean thurrrrr
Magic Engine normally doesn't respect the 16-sprite-blocks-per-line limit, so the sprite-based parallax layer works fine. However, on the real machine, or in a proper emulator like Mednafen, the last sprites are clipped due to sprite buffer overflow.

Quote from: dudule on 10/11/2011, 04:59 PMthe link don't work  :cry:
Works fine for me...
Turbo Badass Rank: Janne (6 of 12 clears)
Conquered so far: Sinistron, Violent Soldier, Tatsujin, Super Raiden, Shape Shifter, Rayxanber II

mrhaboobi

Rover, do you feel like putting together a small "how to get set up " for newbs, so that we can get HUC up and runnings, an emulator etc..
Looking for (MINT ONLY)
US Manual : Magical Chase, Shockman 
US Box : Turrican,  Soldier Blade, New Adventure Island, Neutopia II
Other : Sapphire OBI, Turbo Play Aug/Sept 90, April/May 92, Turbo Edge Spring 90

PC Engine Special Cards : Bomberman User Battle

Alydnes Super Grafx

OldRover

#16
There's a couple of ways to get HuC set up. Fortunately, it's an independent compiler so it doesn't rely on anything else, unlike virtually all other toolchains. I'm going to describe the way I do things, and I'll also explain why I deviate from the "normal" way it's done.

First of all, download it from zeograd.com. Unzip all the files to somewhere you will remember for later. Now, the best thing to do is to make a copy of the files you're going to need for your project.

Create a project folder. I personally have it set up like this:

C:\pceprojects\projectname

so if you have a project called MyLeetThing, you would have

C:\pceprojects\MyLeetThing

Now, copy the required files into this directory. You will need, at the very least, the contents of include/pce inside the HuC files. I always copy the files themselves, not the folder. If you plan on making CDs, you will also need overlay.h that is just in include/. That's all the library files. Now you'll need the compiler files. At least, you will need huc and pceas. These are in the bin/ directory. If you plan on making CDs, you will also need isolink. You won't need pcxtool or nesasm.

The reason I copy the files like this is because I quite often modify the library, and different games have different library requirements. You could always put the executables in your path somewhere if you want. Anyway, once you have the files copied into your project directory, you can start making your project. :)

If you're making a hucard project, it's pitifully easy to get something running quickly. Making a CD project is a hell of a lot more involved so I won't get into that here. Just make a C file (no C++ here, folks), call it whatever you want. So, you could make like MyAwesomeGame.c.

There's only one major detail for your source: you need to #include "huc.h". Also, main() doesn't take any arguments... sorry, no argv/argc here. :) Everything else... is up to you. :)

HuC uses a limited form of SmallC. One of the most immediately noticeable details of this is how functions are used. To make a function in "normal", modern C, you would do this:

void function MyFunkyFunc(int argument1, char argument2)
However, here in HuC land, you would do it more like this:

function MyFunkyFunc(argument1, argument2)
int argument1;
char argument2;

If you're used to modern C, that takes some getting used to.

Compiling... to make a Hucard, the only thing you really need to do is this from the command line:

huc MyAwesomeGame.c

and that will give you MyAwesomeGame.pce as long as nothing's broken. You can then run it in any PCE emulator. I prefer Mednafen for accuracy. :)

I hope this all helps. :D

EDIT: Jumping the gun a lil bit... if you want to make CDs, there are a lot more steps. First of all, you create what are called "overlays". There are two main types: executable and data. Executable overlays contain program code, data overlays contain... well, data. Your first overlay is going to be overlay 1. This needs to be an executable overlay, as it will be the one that is run when the system card loads the CD.

If you want to share data between executable overlays, you need to create a new file called globals.h. This will contain any variables that you want to be available to all of your programs. You can also put useful #defines here too... I do that a lot, it's useful for making a list of overlays, for example.

Compiling for CD is also different. What you do now are compile overlays rather than ROMs. So:

huc -scd -over MyAwesomeGame.c

will create MyAwesomeGame.ovl as a System 3 overlay (you can use -cd to make a System 2 overlay, but the HuC overhead is too big to do anything serious in System 2 except for making a cderror program, so it's best to stick with System 3). After that, you need to link it using isolink:

isolink MyAwesomeGame.iso MyAwesomeGame.ovl

which will make an ISO that you can run in an emulator, or burn to CD.

You can also make a cuesheet with a warning track, game music files, etc...
Turbo Badass Rank: Janne (6 of 12 clears)
Conquered so far: Sinistron, Violent Soldier, Tatsujin, Super Raiden, Shape Shifter, Rayxanber II

Arkhan Asylum

Quote from: The Old Rover on 10/11/2011, 05:29 PMMagic Engine normally doesn't respect the 16-sprite-blocks-per-line limit, so the sprite-based parallax layer works fine. However, on the real machine, or in a proper emulator like Mednafen, the last sprites are clipped due to sprite buffer overflow.
Oh, well duh.  lol.

Atlantean does not have this dilemma!
This "max-level forum psycho" (:lol:) destroyed TWO PC Engine groups in rage: one by Aaron Lambert on Facebook "Because Chris 'Shadowland' Runyon!," then the other by Aaron Nanto "Because Le NightWolve!" Him and PCE Aarons don't have a good track record together... Both times he blamed the Aarons in a "Look-what-you-made-us-do?!" manner, never himself nor his deranged, destructive, toxic turbo troll gang!

OldMan

QuoteNow, copy the required files into this directory.....
The reason I copy the files like this is because I quite often modify the library...
We just copy the files we need to change into the root of the project. Huc is 'dumb' enough to use them if it finds them there, rather than the 'standard' library files.
Less to keep track of, and it doesn't impact other projects that need the standard files.

OldRover

OK, whatever works for ya. :) I was just describing how I do it.
Turbo Badass Rank: Janne (6 of 12 clears)
Conquered so far: Sinistron, Violent Soldier, Tatsujin, Super Raiden, Shape Shifter, Rayxanber II

thrush

Quote from: OldRover on 10/11/2011, 06:04 PMI'm going to describe the way I do things, and I'll also explain why I deviate from the "normal" way it's done.  [...]
Thanks very much!

I decided last month to start doing some PCE development.  I am a fairly competent programmer as hobbyists go, but this is my first foray into anything retro, console, or undocumented.  As a result, I am a bit confused about the work flow.

I have deliberately not mentioned my interest in joining the ranks of the scene so far because I know that a lot of people show up, say they're going to contribute, then vanish.  Since I am stupidly busy IRL I may not have much to show for my efforts for some time, so I figured it would be best to wait till I had done more reading/messing about.  However, since this is post is so close to what I've been looking for, I decided to fess up.

Now that my cover is blown, here's my question: would it be a bother to explain these steps again from an Assembly standpoint?  I am particularly interested in the ASM side of things, but as I am perversely coding on my Mac so far I've done little more than compile PCEAS, Mednafen, and so forth.

Also, if you don't mind shepherding a noob, are there any tutorials on getting a finished .pce image onto a flash cart and into my system, or advice about what card to purchase?

Sorry for the wall of text, and thanks again!

Arkhan Asylum

The steps are about the same.  just replace huc with pceas and .c with .s:

pceas game.s
pceas -scd game.s

etc.

if you run PCEAS and HuC at the commandline with no arguments, it will display all the options!

Get a NeoFlash PCE flash card. Its the safer bet.  I believe there is a Mac version of the tools to flash the card, but I can't be certain.  Worse case scenario, you have to use a VM.  No biggy.

there are no tutorials, but there are some utilities floating around to set a .PCE up to put on a flashcart and have it work.  A .PCE fresh from PCEAS won't work on Neoflash.


also, lol, that isn't a wall of text!  You should see my posts! :)
This "max-level forum psycho" (:lol:) destroyed TWO PC Engine groups in rage: one by Aaron Lambert on Facebook "Because Chris 'Shadowland' Runyon!," then the other by Aaron Nanto "Because Le NightWolve!" Him and PCE Aarons don't have a good track record together... Both times he blamed the Aarons in a "Look-what-you-made-us-do?!" manner, never himself nor his deranged, destructive, toxic turbo troll gang!

OldRover

Quote from: guest on 10/12/2011, 12:31 AMA .PCE fresh from PCEAS won't work on Neoflash.
I haven't used the Neoflash yet so I wouldn't know about this, but... why is this exactly?
Turbo Badass Rank: Janne (6 of 12 clears)
Conquered so far: Sinistron, Violent Soldier, Tatsujin, Super Raiden, Shape Shifter, Rayxanber II

OldMan

Quote from: OldRover on 10/12/2011, 01:04 AM
Quote from: guest on 10/12/2011, 12:31 AMA .PCE fresh from PCEAS won't work on Neoflash.
I haven't used the Neoflash yet so I wouldn't know about this, but... why is this exactly?
Dumped roms and Huc add a 512 byte header to the rom. (A leftover from the earlier days, for identifying roms).
That throws the page alignments off. You either have to build without the header (-h, I *think*) or use a tool to
strip the header.

What's really fun is matching the regions. If your flash cart is set for the wrong system, you have to flip the data lines to get it to work. Not much of a problem if you use an automated build system, just one more step you have to be aware of.

touko

#24
Hum strange, i have a neoflash card, and .pce done on pceas (mkit) works fine .

Arkhan Asylum

Quote from: touko on 10/12/2011, 07:47 AMHum strange, i have a neoflash card, and .pce done on pceas (mkit) works fine .
You're not using HuC though. I don't think plain ol' pceas adds this stuff.  It's something in the HuC steps.
This "max-level forum psycho" (:lol:) destroyed TWO PC Engine groups in rage: one by Aaron Lambert on Facebook "Because Chris 'Shadowland' Runyon!," then the other by Aaron Nanto "Because Le NightWolve!" Him and PCE Aarons don't have a good track record together... Both times he blamed the Aarons in a "Look-what-you-made-us-do?!" manner, never himself nor his deranged, destructive, toxic turbo troll gang!

OldRover

So what if you do...

huc -s source.c

and then

pceas -raw source.s
Turbo Badass Rank: Janne (6 of 12 clears)
Conquered so far: Sinistron, Violent Soldier, Tatsujin, Super Raiden, Shape Shifter, Rayxanber II

Arkhan Asylum

the sauce that HuC makes has all the crap in it.   

well, maybe not if you use -raw.  What the hell does -raw do again? lol 
This "max-level forum psycho" (:lol:) destroyed TWO PC Engine groups in rage: one by Aaron Lambert on Facebook "Because Chris 'Shadowland' Runyon!," then the other by Aaron Nanto "Because Le NightWolve!" Him and PCE Aarons don't have a good track record together... Both times he blamed the Aarons in a "Look-what-you-made-us-do?!" manner, never himself nor his deranged, destructive, toxic turbo troll gang!

touko

Quote from: guest on 10/12/2011, 08:20 AMYou're not using HuC though. I don't think plain ol' pceas adds this stuff.  It's something in the HuC steps.
No,with HuC or mkit, i don't have any problem with .pce on my flashcard.

Arkhan Asylum

Hmm, that's odd.  What flashcard do you use?

If I make a .PCE of Atlantean and just plop it on the card, it doesn't work. lol
This "max-level forum psycho" (:lol:) destroyed TWO PC Engine groups in rage: one by Aaron Lambert on Facebook "Because Chris 'Shadowland' Runyon!," then the other by Aaron Nanto "Because Le NightWolve!" Him and PCE Aarons don't have a good track record together... Both times he blamed the Aarons in a "Look-what-you-made-us-do?!" manner, never himself nor his deranged, destructive, toxic turbo troll gang!

OldMan

On a neo 128M w/backup, using neo2 pro manager v1.11
pce version set to US.

QuoteSo what if you do...
huc -s source.c
and then
pceas -raw source.s
Yeah, that works. I just never use the -raw flag.  (I forget about it).

TurboXray

thrush: I'm all ASM for PC-Engine coding, so if you need someone to bug via such related questions then you can add me to your list. I'm also known as Tomaitheous (and usually hang out on mednafen channel IRC, when I have time). There are some others that are active ASM only coders for PCE; MooZ, Charles MacDonald, Chris Covell to name a few. http://pcedev.blockos.org/ also might be a place you want to ask questions or such too. It's a bit slow, but MooZ always checks the forum (he runs it).

 MooZ, Charles, and I don't use the MagicKit included libraries. We have our own (and many times just written over again on the fly). I found the documentation for Mkits libs seriously lacking. Building your own lib is fairly easy and gives you more freedom and control for your layout, etc. Among some other small advantages. If you're compiling PCEAS, use the last public source for it that's include in HuC source kit. I have my own private build with a few upgrades added in (8k bank boundary crossing error for Code is gone, new directives for easier table making, better name support for Macros, - and + local labeling, etc). MooZ does too, IIRC. I was talking with MooZ and we're supposed to make the new fork/build public. Just waiting on him. Won't be official, but it'll be our own version.



 I don't own the NeoFlash, but after chatting with Chilly Willy I found out my demos wouldn't run for him because PCEAS builds them with the header by default. Yeah, -raw assembles without a header. Which I use for one of my flash cards (just a dip rom board).

 HUC stuff: Someone mentioned something about replacing/reworking the scroll() routine in HuC, in one of these huc related threads. The routine is indeed part of the Mkit lib and is basically just a pass through function. I made an optimized replacement for Xavier. It eats some more memory, but it's fast and very flexible. It behaves like the HDMA setup on the SNES, Or you could think of it similar to 'copper' on the Amiga. It works by using a main table, 8bits per entry. The each of the 8bits is a command telling the hsync routine what to do; change BG color #0, change X, change Y, turn on BG, turn off BG, turn on SPR, turn off SPR, etc. There's a scanline list in a separate table telling which scanline to generate the next function list on. You can do any and all the functions at the same time for a given scanline. And you can do all visible scanlines. It uses the existing irqmask setup that HuC uses (which is a clone of the system card setup and is actually used in place of when building CD projects). I think it worked out fairly nice and gave some powerful hsync functionality to HuC setup.

touko

#32
Quote from: guest on 10/12/2011, 09:27 AMHmm, that's odd.  What flashcard do you use?

If I make a .PCE of Atlantean and just plop it on the card, it doesn't work. lol
I use the 64 Mb version: neo pc-e flash card, with rtype .
I'am flashing with PCE option, and using NEO Power PC-E V1.0 .

Arkhan Asylum

Oh, yay for -raw.  I don't even remember that option being in the usage menu.  maybe it was overlooked. :) Cool.
This "max-level forum psycho" (:lol:) destroyed TWO PC Engine groups in rage: one by Aaron Lambert on Facebook "Because Chris 'Shadowland' Runyon!," then the other by Aaron Nanto "Because Le NightWolve!" Him and PCE Aarons don't have a good track record together... Both times he blamed the Aarons in a "Look-what-you-made-us-do?!" manner, never himself nor his deranged, destructive, toxic turbo troll gang!

thrush

Cool, thanks a lot for the info & recommendations guys.  Sorry it took me like a week to read this.

Bonknuts -- thanks much for the offer!  I have seen your posts as Tomaitheous all over the place on various forums, cool!  I believe I did use the most recent release of PCEAS when I compiled; I'll check later.

I should have more time once November rolls around, so maybe I'll be able to get started on something then & have some real questions for people.  ^_^

Gredler


OldRover

Turbo Badass Rank: Janne (6 of 12 clears)
Conquered so far: Sinistron, Violent Soldier, Tatsujin, Super Raiden, Shape Shifter, Rayxanber II