Cave Story engine-rewrite/clone

Jul 4, 2010 at 8:41 AM
Neophyte Member
"Fresh from the Bakery"
Join Date: Jul 4, 2010
Location:
Posts: 9
Hello everybody; I really admire this game and have been working on a clone/from-scratch engine-rewrite project, aiming for 100% compatibility. Currently you can make it from start to all 3 endings and all the objects I know about are implemented. Anything that's not right, I would like to know about it. In other words, debugging help.

If you'd like to try it you can download it from http://nxengine.sourceforge.net/. You'll also need a copy of Aeon Genesis's English-patched Cave Story--unfortunately I don't think it works with the original Japanese yet.
 
Jul 4, 2010 at 9:17 AM
Cold Agony of Resolute Vacuum
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Jan 1, 2008
Location: Elsewhere
Posts: 1973
I'm not sure how much I can contribute to your debugging efforts, but I would like to say it performs admirably on my ancient 368 (seriously).

Couple small bugs (just from First Cave):
- Are bats supposed to drop those large heart clusters? O.O
- The spike hit me because I was in the tile above it...
- Seems that changing maps ends the effect of the TSC command <KEY. This is really minor, but what it causes (if you hold down left or right during a map change) is that you will be moving before the fade-in completes.

Edit: Few more things...

- Some sounds (heart collect sound, level up sound) seem to cut off too early.
- Music causes jittery performance... Runs fine for a few seconds then hangs for a half second (ancient hardware might be to blame here).

Edit edit:
- Bubbler Lvl. 1 can't pass tile type 44 in original CS
- Bubbler Lvl. 2 doesn't burst when it hits the ground unless it's flat. On slopes it should hug the curve so to speak.
- Defeating the big jelly cause the chest to spawn, but it falls with inertia of the jelly it used to be (eg. drifts a few tiles left or right as it falls).
 
Jul 4, 2010 at 10:29 AM
Neophyte Member
"Fresh from the Bakery"
Join Date: Jul 4, 2010
Location:
Posts: 9
Wow, did you say a 386? That is old :p Thanks for giving it a try, these are things I probably wouldn't have noticed myself.

Bats - now that you point it out, I should think not. I changed the algorithm to be based on the size of the enemy instead of just random.

The bbox for OBJ_SPIKE_SMALL was a bit large (it covered the entire tile). I reduced it.

I had no idea that KEY persisted across stage transitions, but I ran a test and sure enough, you're right. Currently in NXEngine, the way TRA works is that it stops the current script and then the entry script is started once the new stage loads, and so TRA is implicitly an END. For now, I made it so a fade-in/out also works like KEY while running, which should look exactly the same and I think should be a pretty safe assumption and not liable to break the existing system. But I'll come back and try for the more correct fix later.

I can't reproduce the sound problem. Open the console and type "music 0" to get the BGM out of the way then try "sound 20" and "sound 27". Are they definitely cut off on your computer?

Your CPU spikes on music is probably because the music is buffered ahead for approximately 8-16 beats (the exact number depends on the tempo of the current track), then when one of it's buffers runs out it has to generate another 8 beats of music to refill the non-playing one while the last-remaining buffer is playing. Just how fast is your computer? So I know what sort of hardware I'm targeting. Perhaps changing the buffer size either up or down might make it better for you (currently you have to recompile to do that). Of course you could just turn the music off from options menu (not really a solution).

edit: Wow, you _are_ good, I didn't know there were any objects that could be blocked both by NPC and shot tiles. Good call on the Bubbler L2 also. In nxengine-jargon that "hugging the curve" is called NXFLAG_FOLLOW_SLOPE. I actually noticed the thing about Kulala before but at the time I decided to leave it because I thought it looked better that way. I suppose it is wrong though so I'll correct it.
 
Jul 4, 2010 at 10:34 AM
Administrator
Forum Administrator
"Life begins and ends with Nu."
Join Date: Jul 15, 2007
Location: Australia
Posts: 6210
Age: 38
WTF?! Why are you making it open source? Pixel made his game closed source for a reason.

Don't get me wrong, it's a great idea and could one day be used for multiplatform modding, but I don't like the idea of Cave Story being open source.
 
Jul 4, 2010 at 11:15 AM
Cold Agony of Resolute Vacuum
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Jan 1, 2008
Location: Elsewhere
Posts: 1973
nxdream said:
Wow, did you say a 386? That is old :p Thanks for giving it a try, these are things I probably wouldn't have noticed myself.

386 with 192 Mb of RAM and an AMD K-6 2 processor.
And I'm running Windows XP.
Do I get a prize, or do I have to mention the ATI RAGE II Plus+ 128 Mb video card?

nxdream said:
Bats - now that you point it out, I should think not. I changed the algorithm to be based on the size of the enemy instead of just random.

Same thing also applies to the 3-pack of missiles.

nxdream said:
The bbox for OBJ_SMALL_SPIKE was a bit large (it covered the entire tile). I reduced it.

AFAIK in original CS it's an 8x8 collision box centered on the tile/sprite.

nxdream said:
I had no idea that KEY persisted across stage transitions, but I ran a test and sure enough, you're right. Currently in NXEngine, the way TRA works is that it stops the current script and then the entry script is started once the new stage loads, and so TRA is implicitly an END. For now, I made it so a fade-in/out also works like KEY while running, which should look exactly the same and I think should be a pretty safe assumption and not liable to break the existing system. But I'll come back and try for the more correct fix later.

The correct function would be to consider it a jump.
Basically...
Go to the map, then jump to event X (which will be on the current map).

nxdream said:
I can't reproduce the sound problem. Open the console and type "music 0" to get the BGM out of the way then try "sound 20" and "sound 27". Are they definitely cut off on your computer?

Yeah, they cut off. :<
Might be related to my dated SoundBlaster card. ^^;

nxdream said:
Your CPU spikes on music is probably because the music is buffered ahead for approximately 8-16 beats (the exact number depends on the tempo of the current track), then when one of it's buffers runs out it has to generate another 8 beats of music to refill the non-playing one while the last-remaining buffer is playing. Just how fast is your computer? So I know what sort of hardware I'm targeting. Perhaps changing the buffer size either up or down might make it better for you (currently you have to recompile to do that). Of course you could just turn the music off from options menu (not really a solution).

No music is a solution.
But is there any way to buffer it continuously, or buffer each track completely?
In my ideal image the track would be buffered in two parts at a <CMU - The part that doesn't loop and the part that does. Once the part that doesn't loop finishes it can be discarded.

nxdream said:
edit: Wow, you _are_ good, I didn't know there were any objects that could be blocked both by NPC and shot tiles. Good call on the Bubbler L2 also. In nxengine-jargon that "hugging the curve" is called NXFLAG_FOLLOW_SLOPE.

Speaking of the bubbler the 'stars' that the level 3 bubbles burst into do 3, not 2.
And on the subject of damage, is it a bug or a feature that enemies only take their max health as damage? (Ie. A Spur shot will do 1 damage to a Bat from first cave rather than 21+).

nxdream said:
I actually noticed the thing about Kulala before but at the time I decided to leave it because I thought it looked better that way. I suppose it is wrong though so I'll correct it.
We'll call it a feature. :>
And I agree - it does kinda look better.

Another note - Blade Lvl. 3 'hashes' are scattered across the current field of view randomly when the King bullet hits a target, not centered on the main bullet.

EDIT: Far more obscure point: Those large -127 spikes from the Egg corridor can also hurt NPC's.
 
Jul 4, 2010 at 11:54 AM
Neophyte Member
"Fresh from the Bakery"
Join Date: Jul 4, 2010
Location:
Posts: 9
Bravo-- I used to like to develop on computers like that because it helps you make the program more optimized. I don't have any right now though.

Speaking of the bubbler the 'stars' that the level 3 bubbles burst into do 3, not 2. And on the subject of damage, is it a bug or a feature that enemies only take their max health as damage? (Ie. A Spur shot will do 1 damage to a Bat from first cave rather than 21+).
Thanks, I'll fix that. Ok, I'm aware that the damage numbers aren't quite right but I don't exactly understand how it's supposed to work. It seems like usually it shows the amount of damage contained in the shot, but sometimes it shows some other number which is smaller than that. In nx what it should show you atm is the amount of damage contained in the shot, i.e. the total amount it could have dealt. Now some shots like the fireball only deal half their damage but can deal it twice, and the Spur works a bit differently than all the other weapons; if you kill a bat with L3 Spur it should show you 12. I can double-check and see if those numbers are correct.

No music is a solution.
But is there any way to buffer it continuously, or buffer each track completely?
In my ideal image the track would be buffered in two parts at a <CMU - The part that doesn't loop and the part that does. Once the part that doesn't loop finishes it can be discarded.
It was a long time ago that I worked on the music renderer part; I'm not exactly sure...but producing the music continuously was how it originally worked, but it didn't work well, the music tended to skip when something else on the system took a tiny bit extra time away from the game. Buffering ahead too far originally caused problems with FMU (TSC music fade), but I since changed how that works so that shouldn't be a problem anymore, although the buffers would eat up a bit of memory and I'd have to find a way to prevent long load times when switching music.

EDIT: What? You mean the big tall ones from egg2? Ok that's cool, I did NOT know that.
 
Jul 4, 2010 at 12:34 PM
Cold Agony of Resolute Vacuum
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Jan 1, 2008
Location: Elsewhere
Posts: 1973
nxdream said:
EDIT: What? You mean the big tall ones from egg2? Ok that's cool, I did NOT know that.

Yep. There's oone place where it's really useful - It can snipe a skydragon zombie! o:

And after a little bit more goofing around, I guess it doesn't matter what the numbers say - as long as the enemy is dead, eh? :(

Also also, the Spur has something in common with the Fireball.
They both operate using a 'max hits' value*.

Basically, it works like so...

Label Damage
Do damage
RemainingHits-1
If RemainingHits<1 Goto Fin
Else Goto Damage
Label Fin
Delete Bullet

Yeah... That kinda looks like BASIC... So sue me. :p
But it conveys the point - Both the Spur and the Fireball can deal their max damage up to max hits times.
The difference is of course that the Spur in practice is a LOOONG series of semi-independant bullets - Each one gets its own max hits counter.
So for the fireball it (at level 3) works out to be doing 3 damage up to 2 times.
And for the Spur it works out to (max charge) 12 damage up to 12 times over (I think) 12 (or 18) seperate bullets (though I *think* there's also a global maxhits counter - something that prevents 1,728 damage from actually being dealt; highest damage I've gotten it to do is about ~206).

In any case it's been a while since I looked at the Spur. ^^;

* Actually, all weapons in CS do this, but only the Spur and Fireball (and maybe Snake, I kinda forget) have a value >1. The most differentest weapon is the (Super) Missiles - They ONLY uses a max hits counter and implicitly does 1/hit up to 10 hits (to everything within it's blast range each enemy can be dealt up to 10 hits).
 
Jul 4, 2010 at 1:04 PM
Hoxtilicious
"Life begins and ends with Nu."
Join Date: Dec 30, 2005
Location: Germany
Posts: 3218
Age: 32
Wow o:
You have done some good work.
Anyway, I would like to help you. Say, do you have any instant messengers? o: (Like ICQ, MSN, Skype, AIM, something...) Because helping someone with that over the forums slows the whole process down a lot.
 
Jul 4, 2010 at 3:02 PM
Vanished.
Bobomb says: "I need a hug!"
Join Date: Apr 5, 2008
Location:
Posts: 776
andwhyisit said:
WTF?! Why are you making it open source? Pixel made his game closed source for a reason.

Don't get me wrong, it's a great idea and could one day be used for multiplatform modding, but I don't like the idea of Cave Story being open source.

CS isn't open source.
The engine is.

And you, sir (OP)
are my new God!

I'm missing the option to spawn multiple objects at ones (like 3 Torokos)
Also a command history like in bash or irc would be nice, so you don't need to type it again :(
 
Jul 4, 2010 at 5:09 PM
Cold Agony of Resolute Vacuum
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Jan 1, 2008
Location: Elsewhere
Posts: 1973
Also, on a subsidary thought, what is your intention behind this?
Is this for modders?
Or is it just to make CS more multi-platform?
 
Jul 4, 2010 at 6:39 PM
Not anymore
"Run, rabbit run. Dig that hole, forget the sun."
Join Date: Jan 28, 2010
Location: Internet
Posts: 1369
Age: 34
Well, I'm only in the Mimiga village at this point, but this is an incredible piece of work.

You put in multiple savefiles? Perfect!

Some things I noticed:
--The Courier New font the NXEngine uses appears ever so slightly different from the one I see in Cavestory.
--Sounds cutoff, as mentioned before. For example, upon loading/making a new game, you can't hear the entire duration of the beep sound.
--Chests and life capsules open slightly faster than they do in the actual game.

Of course, this is all coming from a CS nerd, and it's really just nitpicky stuff. I have not seen any major bugs or anything that makes the game unplayable.

Other than that, the whole thing flows very smoothly, and it's clear that you put a lot of effort into this.
 
Jul 4, 2010 at 8:22 PM
Neophyte Member
"Fresh from the Bakery"
Join Date: Jul 4, 2010
Location:
Posts: 9
You're exactly what I was hoping for, a CS nerd who would notice the little nitpicky things. I got the Courier New name out of what was displayed in doconfig as the font CS was using. Here's what it looks like for me:

http://nxengine.sourceforge.net/img/mine.png
http://nxengine.sourceforge.net/img/real.png

Flip back-and-forth between them really quickly; the backgrounds are in slightly different positions but for me at least the textbox is pixel-per-pixel the same. Now, I'm running NX in Linux so it's possible it comes out slightly different in Windows, I suppose - I'm not sure how SDL_ttf works well enough to know if that's a possibility. Also, if you are using the scale x3 (960x720) or x1 (320x240) modes the font will be slightly different.

I'm totally not hearing this sounds-cutoff thing either in my regular Linux build or my (VirtualBox-powered) Windows environment, but that's two people saying it now so I'd really like to get it fixed. Maybe...if somebody could run Sound Recorder on loopback and record a couple of the buggy sounds so I can hear the issue; maybe that would give me an idea of what's going on.

Ok I'm compiling and uploading 1.0.0.2 now:

* Fixed Bubbler nuances from DragonBoots.
* Big spike from Egg2 nails that poor dragon in the head...kind of an Azarashi thing going on there...

* KEY now persists across stage transitions. With some more testing I determined that KEY persists until the entry script ends just like DragonBoots said, but if the game is in PRI, it is downgraded to a KEY when the TRA occurs. Since this presumably really is how the game is supposed to work it shouldn't break anything, but I'm still a bit timid over this as it hasn't been fully tested so my apologies and please let me know if you see anything go wrong like KEY getting stuck, etc.

* Thanks to Schoko's comment I ran across an embarrassing line of leftover debug code that was basically removing all Armored Gaudi's from the game. And Schoko, I did my best to implement your console request-- you can press up/down to recall up to the last 8 commands and if you want to spawn more than one object at once, specify how many before the name, for example if you wanted to be really dumb you could type:

Code:
hp 100
spawn 6 curly ai
animate 21
spawn 18 critter shooting purple

* Kulala chest now falls straight down, if you turn on emulate-bugs from the console. I know it's probably not exactly a bug but it was the closest category I had for it.

Oh BTW carrotlord, if you're bored with the start of the game you can copy over your profile.dat's from your real game; rename them profile2.dat, profile3.dat etc. and they should show up in your load menu.
 
Jul 4, 2010 at 8:24 PM
Lvl 1
Forum Moderator
"Life begins and ends with Nu."
Join Date: May 28, 2008
Location: PMMM MMO
Posts: 3713
Age: 31
I've played just a bit, but I've noticed maybe 3 things that should be fixed:
-Sound cutoff, as said before
-The floating green devil things that appear when ballos' 2nd form comes don't do any damage to quote. In the game, they do 3. This should be remedied.
-Entities are able to damage you while TSC events are running. In the original CS, while an event is running (like say, the 3rd form of ballos being animated when he gets the 8 red eyes) entities shouldn't damage you, like said red eyes. Also one other note about that is although entities don't deal damage during an event, map spike tiles do (the small spikes that do 10 damage) because they are run as a tile-collision event and not as a entity collision event. Solid entities should still be solid when events are running, they just don't do any damage.
-One other minor thing I could do in the original CS is hold down the X key and press the Z key to advance text, so that the text would roll faster with little effort from me. In this build of your remake, I need to take my finger off of both keys before I can press the key to advance the text, so maybe you could fix this as well.

[Edit]: One other small thing, in the original CS, when the window wasn't active, the game would just STOP. It would stop processing everything if it was minimized or if another window was brought to the front. I recommend that you find a way to emulate/do this as well.
 
Jul 4, 2010 at 9:22 PM
Hoxtilicious
"Life begins and ends with Nu."
Join Date: Dec 30, 2005
Location: Germany
Posts: 3218
Age: 32
Wow, I feel ignored now o:
 
Jul 4, 2010 at 9:45 PM
Um... Chosen One? Yeah that'll work. : P
"Keep on rollin'!"
Join Date: Jun 25, 2009
Location:
Posts: 451
Ooh! SDL_ttf has Mac OS 9 version!
Hokay, advice: I don't think the replay feature works, I think it stops without me terminating it.
 
Jul 4, 2010 at 9:53 PM
Neophyte Member
"Fresh from the Bakery"
Join Date: Jul 4, 2010
Location:
Posts: 9
Sorry SP, I've just been busy all day chasing bug reports. I don't have any IM clients but I accepted your friend request and would love to chat with you.

Thank you CHEEZER, I have corrected all those -- except for the sound cutoff which unfortunately I still can't reproduce -- and will include them in the next release.

NX had invincible-player during scripts but I thought this was caused by KEY or PRI, however I checked and you are right the mere existance of a running script will make you non-hurtable, so anyway I changed it and added an override so he can still hurt you if he falls on you when he comes down during form 2, and the spiky things now work like they should.

I did not know about the trick to keep the text sped up, that makes it really easy and is nice. I've incorporated a similar feature into NX which will be in 1.0.0.3.

-EDIT thecrown: Yes, it should be fairly easy to compile if you would like to give it a try.

Replays are recorded automatically every time you load a game and run until you die, win the game or reset. Once you die, win, or reload the replay will appear in the replays menu. If you save a game then the save operation will be shown in the replay but the game won't actually be overwritten. You can fast-forward with F5 and break-into the replay by pressing any of the direction keys. If you continue playing after a played-back replay ends then that part won't be recorded. Is that what you're seeing? It's quite possible the replays may still be buggy as it was a tricky feature to implement and was originally a debugging aid that I decided to turn into a real feature.
 
Jul 4, 2010 at 9:55 PM
Cold Agony of Resolute Vacuum
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Jan 1, 2008
Location: Elsewhere
Posts: 1973
One other thing that would be nice is if you could allow gamepad support.
Being that this is a 386 with an old keyboard, I can't hit certain CS-require button combinations (such as up+right+shoot or shoot+left+jump).

Lucky for me I can sorta fudge it because my gamepad allows for the emulation of keystrokes, but other folks aren't so lucky.

And gimme a little bit. I can get a recording of the sounds for ya.

Edit: 'Nother buggy~
- Water should slow you down. Currently physics are unchanged.
- Also, Chinfish and the mushrooms from the Graveyard (and any other 0-experience enemies) should not drop hearts and missiles. ^^;
 
Jul 4, 2010 at 9:58 PM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
Also the specific reason as to why you can't be damaged during events is it sets a variable that bypasses the entire PC-Entity collision alrogithms (Possibly to make the game not lag during events?)

Or something to that effect. Basically collision detection turns off during events but only for entities, which is why tile spikes can still hurt you because they are tiles.
 
Jul 4, 2010 at 10:00 PM
Lvl 1
Forum Moderator
"Life begins and ends with Nu."
Join Date: May 28, 2008
Location: PMMM MMO
Posts: 3713
Age: 31
Noxid said:
Also the specific reason as to why you can't be damaged during events is it sets a variable that bypasses the entire PC-Entity collision alrogithms (Possibly to make the game not lag during events?)

Or something to that effect. Basically collision detection turns off during events but only for entities, which is why tile spikes can still hurt you because they are tiles.

It does not bypass entity-collision completely, solid entities will still act solid during a TSC event, just that they cannot damage you.
 
Jul 4, 2010 at 10:03 PM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
GIRakaCHEEZER said:
It does not bypass entity-collision completely, solid entities will still act solid during a TSC event, just that they cannot damage you.

That's a seperate part of the function though, with its own call to detect the collision.
 
Top