• Hey everyone happy Christmas Eve we're aware of what's happened with the source code so to keep this simple absolutely don't post it on the site or use it to make mods with (it's not particularly preferable toward this end anyway) and tread lightly in general until we see how this settles, thanks to all and have a great holiday season -DT

Quick Modding/Hacking Answers Thread

May 17, 2016 at 7:16 AM
Catz R cool
Modding Community Discord Moderator
"..."
Join Date: Nov 23, 2015
Location: Somewhere within a world far away from reality...
Posts: 381
Age: 24
Pronouns: he/him
May 17, 2016 at 9:05 AM
me when bro says be holly and jolly for $20
"Life begins and ends with Nu."
Join Date: Jun 27, 2013
Location:
Posts: 2854
Age: 30
Pronouns: She/Her
Any entity???

Do they not all share the same teleporting funtion? I'm looking for like the Quote teleporting in and out ones because I want to make a custom teleporting animation.
NPC111 is for Quote teleporting out, NPC112 is for Quote teleporting in.
 
May 17, 2016 at 9:16 AM
Senior Member
"Huzzah!"
Join Date: Dec 2, 2015
Location:
Posts: 211
Age: 25
Pronouns: he/him
NPC111 is for Quote teleporting out, NPC112 is for Quote teleporting in.

I mean they're assembly code TO TELEPORT.
Wait, why am I so dumb? I could just be looking at the code in olly and figuring it myself.

So new question, why does every NPC use local variables when you could just mov the numbers directly?
 
Last edited:
May 17, 2016 at 10:15 AM
Catz R cool
Modding Community Discord Moderator
"..."
Join Date: Nov 23, 2015
Location: Somewhere within a world far away from reality...
Posts: 381
Age: 24
Pronouns: he/him
I mean they're assembly code TO TELEPORT.
All NPC animations are within the code themselves. If you want to edit all teleporting codes, you'd have to edit them separately.
Here's a few teleporting entities:
NPC067: Misery, Teleporting, In: 0x04345E0
NPC112: Quote, Teleporting, Out, 0x043D0A0
NPC113: Quote, Teleporting, In, 0x043D320
NPC144: Toroko, Teleporting, In, 0x0444230
NPC280: Sue, Teleporting, In: 0x045E110
That's about it. All animations are within the NPC AIs, so have fun looking through that :p

I mean they're assembly code TO TELEPORT.
Wait, why am I so dumb? I could just be looking at the code in olly and figuring it myself.

So new question, why does every NPC use local variables when you could just mov the numbers directly?
Okay, new question, new answer. I'm pretty sure Cave Story was written in C or C++ or C# or something shifty like that, so that code is incredibly slow and inefficient. If you want to, you can optimise the codes with Local Variables, usually used for framerects.
In fact, here's another example of inefficient code that is in the game:
MOV EAX, DWORD [EBP+8]
MOV ECX, DWORD [EAX+78]
ADD ECX, 1
MOV EDX, DWORD [EBP+8]
MOV DWORD [EDX+78], ECX
MOV ECX, DWORD [EBP+8]
MOV DWORD [ECX+74], 0
MOV EDX, DWORD [EBP+8]
MOV DWORD [EDX+70], 0
MOV EAX, DWORD [EBP+8]
MOV DWORD [EAX+68], 0
MOV ECX, DWORD [EBP+8]
MOV DWORD [ECX+6C], 0
JMP {END OF CODE} (Not even JMP SHORT!)
^This is EXTREMELY inefficient. The below code does exactly the same:
SUB ECX, ECX
MOV EAX, DWORD [EBP+8]
INC DWORD [EAX+78]
MOV DWORD [EAX+74], ECX
MOV DWORD [EAX+70], ECX
MOV DWORD [EAX+6C], ECX
MOV DWORD [EAX+68], ECX
LEAVE
RETN
 
Last edited:
May 17, 2016 at 8:37 PM
Neophyte Member
"Fresh from the Bakery"
Join Date: Sep 2, 2012
Location:
Posts: 2
Age: 23
Pronouns: he/him
I'm new to modding and I am trying to find out how to change the start-up scene where it shows the Doctor with the captured Balrog and Misery. If anyone can tell me how to do this it would be greatly appreciated :)
 
May 17, 2016 at 8:47 PM
Lvl 1
Forum Moderator
"Life begins and ends with Nu."
Join Date: May 28, 2008
Location: PMMM MMO
Posts: 3713
Age: 32
I'm pretty sure Cave Story was written in C or C++ or C# or something shifty like that, so that code is incredibly slow and inefficient.

"Written in C or C++ or C#"
"incredibly slow and inefficient"

Yeah I think you might be a little confused there/have no idea what you're talking about (and probably don't know about pipelining when it comes to compiling code).

Of course, code written in ASM will generally be faster than code that has to be compiled (like C), but it's a stretch to call C code (or the code you've pointed out here) "inefficient".
 
Last edited:
May 17, 2016 at 10:55 PM
Senior Member
"Huzzah!"
Join Date: Dec 2, 2015
Location:
Posts: 211
Age: 25
Pronouns: he/him
"Written in C or C++ or C#"
"incredibly slow and inefficient"

Yeah I think you might be a little confused there/have no idea what you're talking about (and probably don't know about pipelining when it comes to compiling code).

Of course, code written in ASM will generally be faster than code that has to be compiled (like C), but it's a stretch to call C code (or the code you've pointed out here) "inefficient".

I think your quoting the wrong person???

Anyways, Big9ize, If you want to change the starting scene you need to edit the map named "Kings" that's the map used in the beginning cutscene.
 
May 17, 2016 at 11:27 PM
Its dark in here
"Deaths: 4000"
Join Date: Nov 21, 2013
Location: farther
Posts: 922
Age: 27
Pronouns: he/him
I'm new to modding and I am trying to find out how to change the start-up scene where it shows the Doctor with the captured Balrog and Misery. If anyone can tell me how to do this it would be greatly appreciated :)
map #72
 
May 18, 2016 at 1:57 AM
Lvl 1
Forum Moderator
"Life begins and ends with Nu."
Join Date: May 28, 2008
Location: PMMM MMO
Posts: 3713
Age: 32
I think your quoting the wrong person???

Anyways, Big9ize, If you want to change the starting scene you need to edit the map named "Kings" that's the map used in the beginning cutscene.
Huh yeah, that quote got messed up somehow. Changed it to ThomasXin, the guy I was actually quoting.
 
May 18, 2016 at 6:13 AM
Catz R cool
Modding Community Discord Moderator
"..."
Join Date: Nov 23, 2015
Location: Somewhere within a world far away from reality...
Posts: 381
Age: 24
Pronouns: he/him
Huh yeah, that quote got messed up somehow. Changed it to ThomasXin, the guy I was actually quoting.
"Written in C or C++ or C#"
"incredibly slow and inefficient"

Yeah I think you might be a little confused there/have no idea what you're talking about (and probably don't know about pipelining when it comes to compiling code).

Of course, code written in ASM will generally be faster than code that has to be compiled (like C), but it's a stretch to call C code (or the code you've pointed out here) "inefficient".
It's quite a lot more space-consuming than assembly, and I'm not sure if you have a grudge against me or something, but you're talking to me as if I owe you something.
 
May 18, 2016 at 7:07 AM
Lvl 1
Forum Moderator
"Life begins and ends with Nu."
Join Date: May 28, 2008
Location: PMMM MMO
Posts: 3713
Age: 32
It's quite a lot more space-consuming than assembly, and I'm not sure if you have a grudge against me or something, but you're talking to me as if I owe you something.
Space consuming != inefficient. When writing programs you're generally more concerned with how fast they execute, not how much space the instructions take up (which is normally small/dwarfed by the memory used by the program for variables/data anyways). Space consumption is only really an issue when you don't have the source code, when you are modified the compiled executable by itself, which is a bit of a rare scenario to be in.

The C code compiles to more instructions, due in part to it trying to take advantage of pipelining and due in part to it just translating C instructions to ASM reliably (but perhaps "dumbly), but the resulting ASM from the C code doesn't execute much slower than the ASM alternative you proposed, even though it's more instructions/takes up more space. I'd have to explain a bit about how pipelining works though in order for that to make sense since logically, more steps should make it slower. But thanks to how it orders those instructions they can go faster than you'd think, due to the pipelining of the processor.


I'm really just kind of offended that you'd call C of all languages "inefficient", since it's probably one of the most efficient (fastest) languages out there. It just shows ignorance in your post.
 
May 18, 2016 at 10:54 AM
Catz R cool
Modding Community Discord Moderator
"..."
Join Date: Nov 23, 2015
Location: Somewhere within a world far away from reality...
Posts: 381
Age: 24
Pronouns: he/him
Space consuming != inefficient. When writing programs you're generally more concerned with how fast they execute, not how much space the instructions take up (which is normally small/dwarfed by the memory used by the program for variables/data anyways). Space consumption is only really an issue when you don't have the source code, when you are modified the compiled executable by itself, which is a bit of a rare scenario to be in.

The C code compiles to more instructions, due in part to it trying to take advantage of pipelining and due in part to it just translating C instructions to ASM reliably (but perhaps "dumbly), but the resulting ASM from the C code doesn't execute much slower than the ASM alternative you proposed, even though it's more instructions/takes up more space. I'd have to explain a bit about how pipelining works though in order for that to make sense since logically, more steps should make it slower. But thanks to how it orders those instructions they can go faster than you'd think, due to the pipelining of the processor.


I'm really just kind of offended that you'd call C of all languages "inefficient", since it's probably one of the most efficient (fastest) languages out there. It just shows ignorance in your post.
Sorry...?
I'm not really calling it inefficient as in, bad code. I meant it takes more space, but it still runs slightly slower. Seriously, how can a piece of code exactly the same as another, but with more commands run faster with all that extra useless pipelining? But it's still probably faster than, say, Javascript.
Also, why are you so easily offended? Lol
 
Last edited:
May 18, 2016 at 2:24 PM
The Preacher
"Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-BLEIUP"
Join Date: Feb 20, 2011
Location: lost in translation
Posts: 336
Age: 32
Pronouns: he/him
I'm not really calling it inefficient as in, bad code. I meant it takes more space, but it still runs slightly slower.

So at first it was "incredibly slow and inefficient" and now it only "runs slightly slower" than the literal fastest way to execute instructions? Nice turnaround there, subtle and all.

But I still think it's faster than, say, Javascript.

Gee thank you for your insight. You didn't really strain yourself to make that statement, huh? It's better to stay on the safe side I guess

Also, why are you so easily offended? Lol

It's a figure of speech. But honestly, what you wrote was so perfectly wrong and ignorant it was almost actually offensive.
 
May 18, 2016 at 2:34 PM
Catz R cool
Modding Community Discord Moderator
"..."
Join Date: Nov 23, 2015
Location: Somewhere within a world far away from reality...
Posts: 381
Age: 24
Pronouns: he/him
So at first it was "incredibly slow and inefficient" and now it only "runs slightly slower" than the literal fastest way to execute instructions? Nice turnaround there, subtle and all.



Gee thank you for your insight. You didn't really strain yourself to make that statement, huh? It's better to stay on the safe side I guess



It's a figure of speech. But honestly, what you wrote was so perfectly wrong and ignorant it was almost actually offensive.
Thank you for trying to turn this into an argument. But I'd appreciate if you'd just shut up and stop trying to turn this into a thing, because I never meant to offend anyone, u̶n̶l̶i̶k̶e̶ ̶y̶o̶u̶. I realised my mistake in the other post, but that doesn't mean you should bump in to say something sarcastic like that
 
Last edited:
May 18, 2016 at 7:37 PM
The Preacher
"Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-BLEIUP"
Join Date: Feb 20, 2011
Location: lost in translation
Posts: 336
Age: 32
Pronouns: he/him
Even though you've edited your previous post (a second time) after I posted, you've visibly realized nothing yet, as I only see excuses about how you didn't want to offend anyone and you keep talking about how useless that "extra pipelining" is.

Anyway. C is not that slow compared to manually-written assembly because instruction cycles can be broken down into separate steps that form a pipeline, and several pipelines can be executed concurrently, plus or minus one or more clock cycles, provided they don't affect the same registers or memory addresses at the same time.
This does not take into account higher-level shenanigans (like software pipelining) which basically does the same but with entire sets of instructions (multithreading/processing, parallelism, etc) which makes it so a lot of sequences of instructions will have to wait until another sequence of instructions is completed first before resuming, therefore annihilating any need for performance from that first sequence.
Also for the record, Cave Story is written in C++, which is a shifty language but not for the reasons you mentioned, as it's barely slower than C.

Optimizing the generated assembly code is only really useful for one thing, and that is gaining space if you want to be able to add your own assembly code to the executable.

P.S.: I will bump in, say sarcastic stuff, and/or shut up when I decide to, regardless of what you think I should do or what you'd appreciate.
 
May 18, 2016 at 8:13 PM
Lvl 1
Forum Moderator
"Life begins and ends with Nu."
Join Date: May 28, 2008
Location: PMMM MMO
Posts: 3713
Age: 32
Seriously, how can a piece of code exactly the same as another, but with more commands run faster with all that extra useless pipelining?

See this is just proof you don't really understand what the pipelining is. Those extra "useless" commands can be run basically 2 at a time with the commands they're between, since together those sets of 2 instructions don't touch the same registers. The compiler sets the pointer basically every other command to keep it handy and also just to take advantage of the pipelining.

Also, why are you so easily offended? Lol

I'd have less of an issue with this if you didn't say something so provably and universally false. It's like if someone said the earth was flat.

Also for the record, Cave Story is written in C++, which is a shifty language but not for the reasons you mentioned, as it's barely slower than C.

Cave Story is an odd little program, since it was written/compiled in C++, but it's programmed mostly like a C program (using structs instead of objects, and mostly static memory).
 
May 18, 2016 at 10:24 PM
Catz R cool
Modding Community Discord Moderator
"..."
Join Date: Nov 23, 2015
Location: Somewhere within a world far away from reality...
Posts: 381
Age: 24
Pronouns: he/him
See this is just proof you don't really understand what the pipelining is. Those extra "useless" commands can be run basically 2 at a time with the commands they're between, since together those sets of 2 instructions don't touch the same registers. The compiler sets the pointer basically every other command to keep it handy and also just to take advantage of the pipelining.



I'd have less of an issue with this if you didn't say something so provably and universally false. It's like if someone said the earth was flat.



Cave Story is an odd little program, since it was written/compiled in C++, but it's programmed mostly like a C program (using structs instead of objects, and mostly static memory).
Okay, I admit it. I've never had experience with C or C++, and I'd never noticed which type of code was faster, so I just assumed that the one using more space was slower.
But why would you be offended by me saying C was slow? If I said the Earth was flat, how would that offend anyone?
 
Last edited:
May 18, 2016 at 10:27 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
Pronouns: he/him
it's spreading misinformation which hurts everybody because those who don't know any better may mistake it for truth
 
May 18, 2016 at 10:40 PM
Catz R cool
Modding Community Discord Moderator
"..."
Join Date: Nov 23, 2015
Location: Somewhere within a world far away from reality...
Posts: 381
Age: 24
Pronouns: he/him
it's spreading misinformation which hurts everybody because those who don't know any better may mistake it for truth
Okay, I realised that. But you guys could correct me, which would be more productive than those sarcastic insults.
 
Back
Top