Entity Component model using verse scripts?

I’ve been messing around in UEFN for a month or so. I come from a Unity and UE background, where you can add reusable scripted components on an actor or game object. For example a health component that you can add to players and npc actors.

Does UEFN have the same concept or does everything created in Verse have to be a device that references other actors? Or is there a better way to model this?

Thanks!

1 Like

Any class you make you can use as a field in any other class. be careful this because the interactions between classes can be strange.
I made a post about this earlier today. Using creative_device classes as an editable requires it to be optional.

I believe this is the best way make ‘component’ like classes in verse. I’ve also seen people make custom ‘player’ classes that make keeping track of a player’s state a lot easier.

I hope that answers your question.

1 Like

That’s awesome. I’ll look into that. Do you happen to have a link or example of the custom “player” classes?

Thank you!

I don’t have a link but here’s the basic idea of the top of my head

custom_player := class:
    Agent : agent #this could also be player or fortcharacter
    Team : int
    Score : int
    LoadOut : load_out = load_out {} #uses the defalts in a load_out class you make

when the game loads you can get a list of all the players then initialize a custom_player for each and keep track of them in an array or map. There’s also an event for when ever someone joins your game that will let you handle adding new players.

2 Likes