Creating a vehicle mod

Hello everybody from the stonehearth discourse,

i want to ask you a question: is it possible to create a script in lua for vehicle’s that can ride and also shoot.

the reason why i ask you this is because there is multiplayer now and i want to give the game the possibilty to let you create great modern/fantasy city’s with many innovation’s like car’s or magical teleporter’s etc, if this can be done than i would like it very much if people would help, because i can’t script but i can create voxel models for this mod idea.

i would like to thank you all,

Hey! As far as i know, vehicles are near impossible, because of the way stonehearth works. The fisher mod has boats, wich is amazing, but they are quite limited. Im not a modder, but i think makeing vehicles are not possible sadly.

Because of the way Stonehearth is made, almost anything is theoretically possible as a mod – the tricky part is that some things will require knowing the entire skill-set you’d need to make a game almost from scratch. At that point, many people would just make their own game rather than make a mod… after all, the amount of work involved + the amount of time and energy investment to learn how to do that is far more than most people have spare to work on a mod like that.

Adding vehicles would be complicated and difficult, sure. It partly depends on how they’re added – the simplest version I can think of is “wearable vehicles” (they’re basically just fancy armour), which has lots of down-sides but is pretty much within reach of a novice modder provided they know/are prepared to learn how to animate and can do some basic scripting beyond what’s required for the animation. The next step in complexity would be “golem vehicles”, which is another fairly simple option but has a lot more work involved. The most extreme option would be adding a whole “service” to the game to handle vehicles – how hearthlings drive them, how their AI adapts when they’re driving a vehicle, options for what the vehicle can do (e.g. can it carry an inventory? Does it require fuel? Does it have/allow attacks, and does it require ammo for them?), tracking the vehicle’s health and so on… the trickiest part of that would be getting the hearthlings to “understand” vehicles and use them in their other tasks.

Teleporters are tricky simply because of the fact that hearthlings would need to understand how to use them, and that requires some custom AI or possibly some very interesting pathfinding shenanigans. It’s probably a good idea to talk to @BrunoSupremo about his boats for that – I’m not sure, but I suspect that whatever he does to get hearthlings to ride those boats might be useful for teleporters that simply go from point A to point B. If there was a network of teleporters instead, then hearthlings would need to be able to “see” the possibility to get in at one teleporter and get out closer to their destination, and that’s where it gets very tricky because that definitely requires customer pathfinder AI.

The boats are what you called (and it is an excellent analogy) wearable vehicle. When hearthlings step on the docks they get the boats attached to them. The part where they go over the water was done with adding an actual bridge, invisible. That is why and how they can cross from one side to the other.
I do want to improve it somehow, but will not be soon. :frowning:

1 Like

Ohh , and suddenly my dream about having some kind of transportation went down the sink :sob:

Guys, i saw these days on Trello Board an idea about Beast Tamer class. Is it difficult to implement some kind of big, very fast and strong inteligent beast that serves the purpose of only hauling stuff (in a very fast way and in one trip only), rescuing (multiple) hearthlings (very fast) and carrying a military party to a distant place?

For example, right now as NA, if i kill a bunch of deer with archers, then i have to place storage nearby in order to hurry that, wait, watch hearthlings go forth and back to eat/drink/sleep, and only then i take that storage and place inside my town . It gets worse if i try to mine far away or build anything far from town - even building roads can be time consuming, specially if you decide to gather the dropped thatch (i usually destroy).

Perhaps having an optional button somewhere (just like gather), but that is used to order that inteligent beast ONLY - so no hearthling does that job in its place.

And we could have “mobile defenses” on that, made by the engineer.

The problem with any kind of logistics that I had faced back when I made the conveyor belts in Zulser (half a decade ago, jesus) was that the pathfinding was not accessible from lua in a way that I would need it to be. There was a real danger there in transporting any kind of good with minecarts or similar, namely that you get a deadlock.

If you assume there’s a “source” of items (i.e. a station where items depart on your vehicle) and a “destination” (i.e. a station where the items arrive), you’re ending up with the weird situations that the AI will move items to the source, it gets transported to the destination, and then picked up again and - if no closer storage is available - it’s put into the source again. Rinse and repeat.

There’s quite a few ways you could avoid that - Zulser for example did multi-stage pathfinding to work around this, but you could probably also tag items for some time - but none of them are really satisfying, neither for the performance nor for the functionality.

For the pathfinding itself, unless they’ve added access to the navigation graph (which I doubt), then most of the things you could do are just flat out not feasible. This includes portals, teleporters, any kind of vehicle to shuttle stuff between A and B, and more. You could implement some of them, but they would have some rather nasty drawbacks.

Ok … so basicaly these animals (from Animal Tamer) will only serve fighting purposes … which is not enough of a reason to justify its implementation since hearthlings are very very strong compared to all enemies except the Titan, and also there is a limit to the ammount of hearthlings you can have.

No no, animals are fine. We have golem already doing a bunch of work, you just need to change the model.
The part we are saying that is not possible is the change of getting an item and dropping into stockpile, or hoping into a vehicle before going somewhere. That is what is locked now, we can’t hijack the pathing to instead first drop the item somewhere else (a minecart, a hauler animal, teleporter, or hop into a vehicle, etc…) and then from there go to the stockpile or final destination.

The animals as helpers are ok to do, it just happens that it kinda defeats the purpose as you need to fill them with so much a.i. that it is better to simple have one more citizens instead lol (golems are simple as in they can only do one thing, but it is easy to add more activities)

1 Like

to add to bruno’s explanation golems are ok BECAUSE they do one thing. they dont have to think about beds, food, rest, safety, running. all they do is DOES SOMETHING HAVE TO GO FROM POINT A>B? IM ON IT!

1 Like

well can’t we just change the model and animation of the golem to a car and and edit the script that says go from point A to B, when you select a item to be transported via a selection menu that you want to go to a far away stockpile or place, so when you select that option the selected hearthling(From the new menu) wil go to a car parkinglot that is available(it doesn’t matter where it is so that it is easier for modding) and then sit in it while the script will use a ghost hearthling with no collision which the car will follow so that we don’t have to recreate a whole pathfinding system to do thar.

i already made a qb model of a engine with different versions.

this is a V4 engine.

this a engineer workshop for the mod, the engineer will craft all the parts for the car’s and other things.

man i love golems

Wait, is it possible, to make awehicle “store a hearthling?” Like you could have a vehicle, and that could have 1 purpose only: to go from A to B. When a hearthling interacts with is, The hearthling gets an “AWAY FROM TOWN” effect, making them disapear, as if they were in the vehicle. And when ever the vehicle arrives at the destination, it summons back the hearthling, to its current location.

For an alternative how about a golem that is a moving chest? It cant pick things up or put them down it does nothing by itself but u can order it to walk from point A. To point B. Wherever u tell it to go and the hearthlings can then load/unload it themselves? Make it so the golem dosent have any self delivery commands may take a bunch of the workload off?

Now, what if you tried to make horses? They would in a way work like Bruno’s boats. Is my thinking logical? I’ve got the cart worked out but not the actual horse it self. I’m not the best at coding so let me know if it’s possible. Thanks!

In theory, if you just wanted “horses that are really just armour/clothing that makes you go much faster”, that’s possible – the issue is that you’re not really getting a lot of benefit for all the extra work. You would have to add a bunch of new animations and overrides (i.e. the hearthling’s animations while riding/“wearing” the horse would all have to change; not just the walk/movement ones but any time you want the hearthling to sit on the horse they’d have to be using a custom animation that replaces their normal animation for that situation… I’m honestly not even sure if you could make boots/armour cause that switch-out of animations.)

You could simply make a regular set of armour with a built-in major speed boost, and get the same effect. The horse would just be “cosmetic” presentation.

Adding a cart (presumably to increase the amount of inventory that the hearthling can carry) runs into a new problem: increasing the backpack size turns out to create performance issues. I’m not entirely sure how/why, I would guess it’s because the game has to do more work keeping track of hearthlings’ larger inventories and what could be in them…

If you want to make a “horse and cart”, your best bet is probably to just make it effectively a re-skin of the autonomous cricket golem. That way it can carry items around so it has a use for the town, but it would have a simple brain (the AI packages are called “brains” in the code) and you can basically use the existing golem as a template for it. Once you have it working nicely you could get fancy e.g. make it need to eat, increase its carry capacity (same potential issue as with increasing hearthling backpack sizes, but it might be worth the small performance hit if you’re only using a couple of horses and they can carry a lot of items), and maybe even give them interactions like the pets have (so hearthlings can “talk” to horses and be booped by them.) Of course all these “make it fancy” ideas are assuming that you can figure out how to stitch different parts of existing AI brains together to get the parts you want for your horses… in the end it might not be worth the hassle, and easier to just stick with the autonomous cricket golem as a base for everything the horse does.