Hi there. I’m working on a simple prototype of a naval warfare but don’t have many ideas on how some of the functionality can be achieved. Let’s say that player has a way to “configure” a ship.
For example, you can specify that ship should have:
- 1 engine
- 1 rudder
- 2 small cannons
Each of these items is an actor with it’s own 3D model and associated blueprint to define their behavior.
As you might already guessed, what I want to do is dynamically spawn a hull of the ship, which would be a “root” for other actors and “attach” them to the hull. By “attach” I don’t only mean connecting the meshes themselves but getting access to their functionality as well.
For example, engine contains a specification of how much power it can generate, fuel consumption, methods to calculate how much force it can produce per delta time and etc. Hull can query each of the engines (if there are more than one) and calculate the final force which have to be applied taking into account mass of the whole body.
So far, I can build a pre-configured ship manually, by adding all meshes and static arrays with specification of items. But this way, all of the functionality of engines, cannons and etc. is described by the blueprint of the hull. Which means that if I want to have more than one type of engine, their functionality have to be coded in the same place. What if I want to use two completely different engines on the same ship? All this options make hull blueprint more and more complicated. So I don’t think this is a right approach at all.
The end goal is to generate ship from a specification of components (output from a ship editor) and spawn it in the world.
Any ideas how this can be done?