NPCs In C Entity (NICE)

Feb 22, 2015 at 7:29 AM
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
if you can compile a windows library (DLL) file with your language of choice, you can use it
 
Feb 22, 2015 at 8:09 AM
Senior Member
"This is the greatest handgun ever made! You have to ask yourself, do I feel lucky?"
Join Date: Aug 2, 2014
Location: inactivity.
Posts: 115
BLink said:
So wait, we can write our code in C/C++ and place a branch to it anywhere inside the exe?
Theoretically. Remember,though: You *MUST* ensure all the arguments to the function you're replacing are passed on, or else you might not be able to actually rewrite the function(since the parameters it uses are missing)

The code in universalnpc1.txt is around 70 or so bytes. Don't remember the exact number, but it's enough that you'd really have to override stuff on a function level, not a branch level.
Course, Noxid may have found some method to use this more efficiently that I haven't thought about-again, I'm just focusing on NPCs for now.

The template mod does this for every NPC(EDIT:by overriding the code that selects which function to call, so the pointer table is still usable if you want the old behavior), but calls back into cave story if you haven't overridden that NPC.

if you can compile a windows library (DLL) file with your language of choice, you can use it
Basically yes, but you *DO* need to have a way of accessing Cave Story's variables (and in the case of NPCs, the NPC's variables) to do anything useful.
Python doesn't have that capability(EDIT2:AFAIK, anyway. Could be wrong.), but it's possible to make a DLL which calls upon Python and translates what Python does back into actions in the Cave Story EXE.

Same goes for Lua,Squirrel,etc.
It's just a matter of who wants to put in the work to write the "wrapper" interfacing it with that language.

Using a language with getter/setter property support(Lua metatables,C# properties) would be best, since that allows doing what I did with C:Emulating direct access to Cave Story's variables.

(EDIT3:Sorry if it kills the excitement that it's not plug&play for any language except C, and only for NPCs at that, but I'm keeping your feet on the floor(as opposed to in space).
I'll start a poll now to decide upon which interpreted language to use(Lua or Python? Or indeed, none at all?).(EDIT4: And how is a poll created, exactly...?))
 
Top