A part based building game

I’m interested in creating a game involving an editor where players create custom vehicles. Think KSP, but for cars.

kerbal-space-program.jpg

At first I was thinking that the whole vehicle would be one single Actor, subclassed from Pawn. The players “parts” would be loaded from a JSON file format and populated accordingly by some kind of construction method built into my Vehicle base class that knows how to load / save it’s state. Yes I know Unreal has stuff to do this, but I want something I can save off to a remote server and alter later so JSON as a file format seems reasonable and writing JSON parsers isn’t too hard.

So…

Pawn -> Vehicle (C++)

  • USceneComponent -> Root Part Component (C++) -> Specific Part (BP)
    • USceneComponent -> Part Component (C++) -> Specific Part (BP)
    • USceneComponent -> Part Component (C++) -> Specific Part (BP)
    • USceneComponent -> Part Component (C++) -> Specific Part (BP)

But now I’m thinking that for the editors sake, since parts may be detached in the editor in some cases, that it may be better to handle Parts as Actors. In this case, each part gets an Actor, and are attached to each other or the Vehicle via sockets. The vehicle would still load / save the structure out, but in this case the Vehicle Pawn acts more like a hub. It will still control the other parts, but those parts won’t be components of it, more so probably referenced in a set.

Pawn -> Vehicle (C++)

  • Root Part Component

AActor -> Part Actor (C++) -> Specific Part (BP)
AActor -> Part Actor (C++) -> Specific Part (BP)
AActor -> Part Actor (C++) -> Specific Part (BP)

I’m very new to UE4, but I’ve spent the better part of this summer trying to learn all I can about the engine.

I’m looking for a little feedback, what would you guys suggest I do in this situation?

Thanks, -

I’d tackle this problem with sockets personally.

Edit: i’d make a simple system where you have spheres, or blocks or something to control the attachment/detachment of the objects and just set objects attached to a socket for example.

We are working on the same idea but from a different direction. We are working on a traditional run and gun and a need is to allow players to customize their player model with different items of clothing as well as hair and the component character model is well designed for this need as the needed items can be added as an instance object under the main pawn that can either share the same animation blueprints as the pawn or assigned a different BP that fills a unique requirement of a given object.

Since all of our characters will be using the same rigging the hard part was anticipating the final design that will allow the dress up items to be imported 1 at a time and instanced them all off the same rig in UE4 which all share the same animation sets as well does not added to the memory foot print…

The benefit is no messing around with sockets and a direct connection could be made from the menu load out to move the item directly into an available slot as an instanced component.

I tend to agree, that seems like the easier / KISS approach. How do objects attached by sockets work with physics? Do they collide as one rigid body?

A quick test shows me that they do. Coolz.

Is there a way to query what parts are attached to your sockets? IE can Vehicle know what Actors are stuck to it?

Also thanks very much for the replies. I appreciate the help.