This question is directed at folks who are already familiar with the tools Ron Gilbert created (SCUMM[1], yack[2], Dinky[3]) in building his Monkey Island games (among others).
At a high level, I would prefer to encode game logic in a small scripting language (in the style of yack/dinky) and then use that to generate C# code that is compiled and run by Adventure Creator. (I started working on a tool like this in the past when I was targeting Escoria.)
For this to work well, I need to be able to do a lot of things dynamically, and I'm not sure how well AC supports this today.
Putting the script-to-C# generation aside for the moment, let's say I just authored the .cs file directly for each hotspot. I would probably want my own adapter class that subclasses MonoBehaviour where Start() would use GetComponent<Hotspot>() to get the associated Hotspot and then wire up methods like OnExamine() or OnUse() (declared in the adapter class) to the appropriate callsites in Hotspot. OnExamine() could be designed to run code directly or possibly it would be required to return an ActionList.
I have been struggling to make this work because I don't have a good mental model for how things fit together in AC. For example, Hotspot has bool provideLookInteraction and Button lookButton (as opposed to provideLookInteraction being true whenever lookButton is non-null). And then Button itself does not seem to have an in-memory ActionList, but needs an ActionListAsset, though maybe CopyFromActionList() can solve my problem?
I'm curious if anyone has already successfully gone this route and has any wisdom to impart.
[1] https://en.wikipedia.org/wiki/SCUMM
[2] https://grumpygamer.com/loom
[3] https://github.com/grumpygamer/DeloresDev/tree/master/Scripts/Rooms
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
For example, I tried:
But that fails with the following runtime error:
Ah, I see
Interactionis a subclass ofActionListand this works:Hmm, though when I define the actions for the Use verb like this:
I get the speech action to work, but the player character does not walk to the hotspot.
Ah, apparently I didn't need
ActionCharPathFind, butplayerAction = PlayerAction.WalkToMarker:Incidentally, my
OnHotspotReachevent is finally firing, as well!OK, in hopes that this helps someone, here is a simple working of my
MonoBehaviourthat individualHotspot2Dinstances will extend and override:Here is a sample use of the behavior that I add as a component to a
Hotspot2D:This sort of C# code could easily be generated from a simpler (and less verbose) scripting language.
Whoops, there was a bit of a mistake in the previous version where
OnHotspotReachwas not scoped correctly: