Looks like I’ve crashed the party. Sorry about that. Might as well continue then.
- What’s completely missing (e.g. we know there needs to be a mod loading / load order framework. What else?)
File API: Some API that could write, read and modify files - be it for settings, output or other stuff. I would refer to GMod’s file library which does a solid job. The basic points are:
- isolated write access: Writing is only possible to *.txt files inside of “data/”. Reading is possible within the whole game folder, every file.
- Relative: Multiple relative levels on where to operate (i.e. relative to the game root, mods folder, data folder, …)
- Not necessarily required, but probably useful would be to have a class-based approach (instead of simple
file.write
/file.read
) (GMod’s File). I’m not sure if reading/writing binary should be possible that easily - while it offers some neat functionality (reading qbs for example, perhaps even modify those files?) storing data in JSON would probably be more Stonehearth-ish.
AI documentation: I guess this chapter isn’t closed completely yet so I don’t expect it, but it would be nice to have.
Loading custom textures inside mods: I think that’s not possible. I could be mistaken. Definitely something that would be useful for own buffs/effects.
Javascript debugger: localhost:1338. Please. I’d like to do that simple press-F5-and-reload-the-GUI magic too. It’s annoying to be forced to restart the game all the time. Also, since we’re about it, console.log
stuff.
Querying events: Some sort of querying stuff. GMod’s hook example is a terrible one (foreach (hook_func in hooks) { if (hook_func()) return result; }
) as it’s lacking priority and one malformed mod can mess things up. I’ve done it with a proposal event system in RP and I guess it works okay. It’s the best I can come up with right now. Especially for factions, this could be neat.
Timers: Feel free to glance at RP for my take on it (I guess it could be optimized by splitting it up into day/hour/minute events instead of checking all of them every stonehearth:gameloop
). That components are using their own interpretation (stonehearth:renewable_resource_node
, stonehearth:buffs
) is really off-putting and not very general. It’s also not as tunable as I’d like it to.
Bonus points: I think it will get really weird if you plan on keeping the hourly events for coordination. I imagine something like 18:00, all settlers suddenly become tired, all apples fall from trees and a giant monster spawns - all within the same frame. But I’m aware that’s probably just a WIP.
I just really, really like my timers.
A more JSON compliant parser: Honestly, I’ve had another error in my manifest because it thought it was a better idea to merge "foo" "bar"
to foo""bar
than to throw an error. This is creating so many unnecessary logic errors that could be avoided. I’m looking at you, rp_alternate_naming.
Binary modules: A very, very long shot and I don’t have any project that could use them right now either. GMod (I’ve been scared from those two years) offers lua module support, which means that (specially installed binaries - different folder, not accessible by lua, therefore they need to be installed by the user; kind of “safe”) the Source Engine’s realm’s open too. We won’t need that because the game is open but support for it could come handy for special stuff that cannot be achieved with lua.
One project that I had in GMod was to write a binary module that wrapped the Midi interface. I was able to play Half-Life 2 using my electronic keyboard. It was pretty rad. It was also pretty weird to have the game play stuff on my keyboard (i.e. the other way around) - which resulted in some of the odd music videos I made. Popular examples would be databases (server administration?), music dlls (bass3 or something I think) or networking APIs (for Twitter/what not).
I know that this is a breach of the classic sandbox idea so it’s a sensitive topic. But think of the possibilities. We could have carpenters write to Twitter (“Just made a new #DinnerTableForOne! #Wood #Furniture #DeepmunFurnitureWeek”)…
skip_title and the mini island: Still want.
Magic mixintos: As mentioned in the other thread, a way to modify jsons (for example by simply using "remove(key)"
) would be nice. Alternatively, some hook that enables us to modify/patch the json on the fly in lua - which is probably a better idea. Some event for load_json
would be nifty. For bonus points, that should happen when C loads a json too.
Resizing: I’ve reported that already to you, just mentioning again that set_scale
does nothing until the model variant has been switched to a different (physical) qb file. A different variant is not enough.
qb matrix modification: Long shot, don’t expect it anytime soon. A way to modify matrices, color them completely or something else would be nice. For starters, a simple set_voxel(x, y, z, color)
would be nice enough - even if that means having to create a new model (i.e. instead of modifying an existing one).
model_variants modification: I don’t think we can really add or modify model variants - but I’ll need to check with the new classinfo that @Ponder provided…
lua/js mixintos: I’m not sure about this one. I don’t know how mixins work, but would assume they’re just JSON. Patching is bad and all, but if there was a way to modify lua classes (i.e. right before the module return
) that could probably help too. Might be a lot more complicated, however. The same goes for JS.
Thought bubble: .oO(
The last bit is important because I think no matter how well you design the API, there will always be one case that’s not possible to achieve with it. While some things can easily be “restored” with require and friends, it’s usually much more difficult than being able to write in-place code.
Of course, the question of how willing you are to add an interface for that one’s mod desire (which can be very specific and therefore uncommon) is another thing. Even if you were (able) to do that, the delay until the next patch could easily put that mod on ice or kill it completely.
)
- What can’t you do that you want to do using this framework?
With or without doing all the stuff you guys don’t want me to?
The question doesn’t have a real answer for me. Between a lack of C/engine/game documentation and a lack of events, there isn’t much. It’s mostly just annoying to patch the stuff properly (looking at you once again, world_generation) to create something nice.
I have been playing with the idea of doing full overrides of those pesky files to provide an experimental API - for example, one that would would give complete access to tree/vegetation placement, perhaps even the world generation itself. Something dead simple that can’t really be done without re-writing/re-copying a large portion of the code - or just the file itself (recent rp_developers_dreams became annoying enough…). For the world generator, this means that I would completely replace the original generator and move the current data to a json (I’ve got a first draft of that format already) - mods could then just mixin RP’s json file to add their stuff. And of course, events to modify it in lua.
Now that I think about it, there are a few things.
Event ordering: Speaking of patching json on the fly, I think it’s important that this would happen in some sort of ordered fashion. I’ve been experiencing issues in GMod where another addon was doing nonsense but got loaded before mine - rendering mine completely unusable. The only way to fix that was to remove their hook and re-insert it, or even re-insert it wrapped to make sure they didn’t interfere.
So, to be able to sort those would be neat. I don’t think that numbers would be enough though, something that would be more fine-tuned (as in, “execute my commands after mod X if present” and then some number system?) would be nice. Some meta-points (“first”, “last”) could probably help too, but then again there’s always math.huge
I guess…
Component operations: Components can be added. It should be possible to remove them, too. Same goes for buffs.
lua/JS interoperation: I don’t know how well that’s implemented and it’s been a while since I’ve tried to do stuff with it. The basic idea would be to call JS stuff from lua, similar to call handlers.
Proper input on/off: Although I’ve coded something like that into RP, something more official that disables input capturers would be nice. I’m thinking of situations where all input must be dead - cutscenes, focus on <input> fields and similar. In both JS and lua. Maybe cutting off input isn’t as good of an idea as promoting some sort of “should I ignore keyboard input?” - that way we can still have rp_guitar_steve. Not sure.
Start menu: Completely aware that you know it. Just teasing that I’ve had it since three weeks! Haha! Mine!
Recipe modification: Name’s program. Enabling and disabling, removing and adding recipes. Offers possibilities for research, discovery, level/skill based systems and more.
- How can we modify the framework to make it so you can do it (e.g. do we need to trigger more stuff? are certain things (like world_generation) missing parts (like a .json input file) which you’d like to mod?) Without monkey patching, re-implementing, or wrapping parts of the system?
Well shoot, that’s a pretty complete list of crimes I’ve committed…
On top of my head the list would be:
- World generation stuff (WorldGenerationService, Landscaper, Terrain* - but I assume since the glacier thing is pretty high on your list, this will come soonish in a completely different version?). As mentioned above, a json that defines vegetation would be sweet. Bonus points for a more complete documentation on how maps are generated and how we can generate our own tiles. But again, the whole biome stuff is likely to change a lot soon-ish (?) so I think that’s not that important.
- Factions. Factions. They don’t make any sense right now to me - you give them a name ( “civ”) and at the same time every time you want to access the faction, you also have to pass the json file that describes it. Wouldn’t the alias be identifier enough?
- Some initialiser would be nice - i.e. defining a file that is loaded to replace/patch that function. It’s a dilemma: For total conversions, patching makes probably more sense (Egypt or Asia likely behaves completely different than our little Northies) but for single mods (rp_lucky_worker as stupid example) make more sense.
- On top of that, the current system is kinda racist. It should be possible that faction A can use faction B’s stuff. I’m thinking of OpenTTD right now, where the game is fun but cooperative playing is only possible within the same company. So some relations between factions could be neat. Seeing as some are already completely re-defining the game, new factions are already kind of a thing.
- Proposal: Initialisation file that is called after the faction was created (defined in the faction’s json) that can patch functions or listen to events if necessary. Refactor code so it’s possible to do more fine tuning (taking from RP’s design, I would think of something like gender/entity ref/name/stats for starters, which would be separate functions that can individually be overloaded. The main
create_citizen
publishes pre/query/post events (overwritten functions have a higher priority - i.e. the default function would be nil events), calls the (overwritten) functions and therefore allows to customize it without dealing with any patched functions. No hassle with updates). That sounds really awkward, I could probably better sketch it as pseudo-lua class if you want me to.
- In that sense, the start camp could use some customisation too.
- For many of the AI actions (or general for AI stuff). An event for “I’ve started chopping down this tree” and “I’ve chopped down this tree” would be nice, as example.
- JS can use some more events too.
- I think to get a real “feel” of what is required it’s just necessary to lurk around a bit, see what people do and how they do it. See also below for more details on that.
- Is there anything that’s absolutely impossible to do in this framework? What is it and how would you like to do it in a way that works for all modders who might not be cooperating with each other (or even know that each other’s mods exist)?
That question is just a wrap-up of the others for me. What is completely impossible is in 1), what’s possible but not so quite fancy is 2) and the other stuff is 3).
Regarding “getting a feel for the community”: I think an issue could be that some aren’t going to directly ask “How can I do X?”, either because they have found a way that it works (I remember the recent “How can I place my trees?” - “I’ll just overwrite landscaper.luac” discussion. Override is a very powerful tool and I guarantee it will be abused like mad) or because they don’t know what they actually want to do or how they can achieve it.
If you are familiar with programming, you likely have a clue what “override” could be simply by hearing the name. If you aren’t, that’s one possible hurdle already. Although in this case “overrides are simply overwriting files” is quite easy explained, I’m not sure how one would go on about “You need to subscribe to events published at the world generation service. Just add a function in the table there that spawns your tree at the location given in the first parameter” (horrible example design, but I wanted to get as many fancy words in it as possible) is a bit steeper.
The way I’ve approached it so far was by simply checking what other people do and improve their ideas or simply (re-)implement what they want to do. Of course there are dangers associated with building an API solely on current demands, but to be fair I really think whatever API is built now isn’t final and it absolutely does not have to be. Not every event needs to be peer reviewed (stonehearth:is_harvested
would have failed that one, I guarantee it hide) and they might as well disappear or change over time.
The important thing is to keep people in the loop. I would cite GMod again with the update go GM13 which broke every single addon, but the official document was called “Why your shit broke, and how to fix it”, so I’m not going to l link that one… Anyway: If there is a proper documentation of changes (“stonehearth:foobar
is now a two-event part, stonehearth:foo
and stonehearth:bar
, the first parameter bla bla bla here’s some example code before/after”) nobody (or very few) have valid reasons to complain. Sometimes these logs are also the only real information about certain things and that might not even be intentional.
Not having worked in the industry at all, but I think that the sooner you start, the sooner you get a hang of it - how to do this stuff in a way the community responds to. Starting now at a nice pace, there’s just that one big meanie (Hi) and a few other dedicated people. In a few months, there’s probably dozens of people that are going to ask why your changelog is so horribly formatted.
I also think I’ve written enough for one post - hell, if you read all of this in one session I’d be impressed. I think I’ve spent… two hours on this now? It’s gotta be interesting to see discourse estimate the time it takes to read this topic…