A way to execute scripts on certain game events

Post Reply
darkhog
Posts: 101
Joined: Sun May 13, 2018 10:02 am

A way to execute scripts on certain game events

Post by darkhog » Sun May 13, 2018 10:11 am

One thing that I can see is missing from the editor (at least based on videos - really would love to buy beta and would pay that $38, but it seems that I won't get it right away so won't bother to give you my money right now) is a way to execute certain scripts on certain in-game events, such as when a screen loads, when certain object is created or on each frame. Adding support for that, IMO, would allow for more customization without messing with the base engine too much.

If it's planned or already there in one way or another, I apologize. As said I'd gladly buy what's already there, the recent build, and I really feel like the engine suffers from not having open early access phase, both financially and by missing on important feedback that could come from people who'd use it but wanted to first see a proof this can be done (in my case, videos of alpha/beta releases) before throwing any money.
User avatar
TheNew8bitHeroes
Posts: 251
Joined: Fri Feb 16, 2018 9:24 pm
Location: Sarasota, FL
Contact:

Re: A way to execute scripts on certain game events

Post by TheNew8bitHeroes » Wed May 16, 2018 6:26 pm

This is a tough thing to constrain. Obviously, every single place you throw a script, it takes up precious ROM space. Every time you look for scripts to call, it takes up valuable cycles (slowing down the game a bit). So from an engine standpoint...where do we add hooks to look to see if there is code to call?

Screen load scripts are pretty easy, and that's a thing that's planned to implement. Arbitrary "each frame" will be tougher, but there will probably be a script for "HandleCustomFrameFunction" or some such thing that could be added to without digging into the ASM. We are trying to build in sensible hooks wherever possible, but also trying to keep it regulated fairly well so it's not easy to overflow banks or lead to crippling slow down.

The engine has two waves of early access, in its betas. Right now, there are about 150 people who are toying with it and giving feedback. By the end of this month, it'll be a few hundred more. That's a pretty good sized cross section of people!
darkhog
Posts: 101
Joined: Sun May 13, 2018 10:02 am

Re: A way to execute scripts on certain game events

Post by darkhog » Mon Jul 02, 2018 12:12 am

You could look into dynamic code generation so it only would add hooks for the functions that you know are there so rom won't be full of rts spam because of empty functions. Which should greatly compress the code since it would only put in what's really needed and not empty.

In short, do some sort of preprocessing to figure out what hooks are used by the user, then only include those that are in use. Result rom wouldn't have to look at runtime for them since it would be simply replaced by jsr in the right place. If hook for specified event isn't used (e.g. when Monster A is created), it won't even include code to check if that event is happening, one less beq or bne to worry about for the little 6502. Possibly more than one. I imagine it would work similar to the input manager.
Post Reply