It’s cool! I like the text effect features too.
The implementation is neat, and i like the way it’s all driven, essentially, from gamestate.json
. What i can see going forward though, is a need to expand on the complexity of action prerequisites and on state change triggers.
For example, sooner or later you’ll need to call user functions as part of perquisite tests. I’m wondering how this can be accommodated in json. Stuffing some javascript in there would be messy. Maybe there could be abstract prerequisites that correspond to user function calls somewhere? not sure. This is one reason why IF systems often develop their own domain specific languages.
The same argument goes for object state changes; what if changing the state of one object requires updating the state of another, or maybe performing some custom user code somewhere.
An example of this in your “escape” game is that you can get the torch, then the stone, drop the torch, get the torch, THEN get another stone! I had a whole list of stones in the end
The problem is that the special get/drop torch prerequisite handlers can’t check sufficient state of the stone. This could be fixed by making the stone only appear once, but then what if i put the stone and the torch back in their original places and repeated my actions. There’ll be other bizarre cases too.
one other observation;
You store what things are where, rather than where things are. In other words, a list of things in a location rather than having things store their location.
I can see why this is; it’s to solve one of the classic IF problem of how to have something in two places at once - like doors. A door connecting room A to room B is in BOTH A and B. This works nicely when you store lists of things at a location. Your system does this for the cell door and it works great. Other things that fit this model are scenery objects, like the cell bed. Since it has no state, it can be in multiple locations without problems.
I claim you’re going to run into trouble when you wish to store coordinated locations; “in”, “on”, “under” etc. eg book on shelf, coin in box, key under clock etc. Unless i missed it, i didn’t see any code for coordinated location in your system. I think the answer to this is to store an object location as a set of coordinated locations, rather than storing a list of things at a location. You can still store things in multiple locations so long as you don’t think of THE location of something, but A location of something.
Best of luck with the system. It looks promising!