Entity Prefabs

Sun 24. Feb 2019, 22:09

Hi there! Forgive me if something like this has been asked before.

I was wondering if anyone knew if there was a way to create entities that inherited data from a "parent entity". As far as I understand currently, the current flow is something like "Properties->Features->Template->Entity". This means that any entity I want to make needs to have all of the properties of each feature in the template filled out.

Let's say I want to make 50 different "one hand swords" from my "Sword" template I've made, and just for the sake of this example we'll say there are a total of 10 properties combined from all the features in the "Sword" template. The only 2 properties that will be different between the 50 swords is their name and damage, and the remaining 8 properties will be identical for all 50 swords. From what I understand with the current system, my only option is to just manually fill out all 10 properties for each of the 50 swords I want to make, and if I find a balancing error later on during development, I need to go through each of those 50 swords and update their values. This gets out of hand pretty quickly, especially if I want to now also make 50 "two hand swords" from my "Sword" template that are slightly different from the "one hand swords" I've made.

What would be amazing, is if there was a work flow that went something like "Properties->Features->Template->Parent Entity->Child Entity". A "Parent Entity" (or whatever you'd want to call it) would be something similar to a Unity prefab in this case. This would allow you to have "one hand sword" and "two hand sword" "Parent Entities" that used the "Sword" template for their feature list. From there, any "Child Entity" would inherit the values of their "Parent Entity", and any values modified on the "Child Entity" would override the inherited value. A huge benefit from this would be the ability to fix a bug on 50 different "one hand swords" just by updating the "one hand sword" "Parent Entity", so long as the value you changed wasn't overridden on the "Child Entity".

Long story short, is there a means of doing something like this that already exists that I am missing? Or have a work flow they like when handling lots of similar entities with duplicate values? The only way I can think of is having a Slot property in my "Item Data" feature that I drag a "one hand sword" entity into as a pretend "parent entity", and then compare the differences between the two. Ew.

I totally feel like I'm over complicating this lol. Anyone have any ideas?
Orothin
 
Posts: 3
Joined: Sun 24. Feb 2019, 21:10

Re: Entity Prefabs

Mon 25. Feb 2019, 09:14

Hi Orothin,

It sounds like it would be useful for you if you worked with Default values in your Sword Feature / Template.

Especially, if you have a number of values that will be shared among all created entities and are not supposed to change for the individual entities.

Create a Sword Feature with the 10 properties, then create two templates (1-hand and 2-hand) and use the Sword Feature in both of them. Now you can set default values for the 8 properties that are not supposed to change in the Templates. If you know that values will be the same for both 1 and 2-handed swords you can even set the default value in the Feature itself.

If you want to change these values later, after say a balancing pass, you only need to do this in the 1-hand / 2-hand Templates or in the Sword Feature. As long as you don’t change a default value in your entity, changes made in the Feature or Template will propagate to all entities using this Template.

As an example – let’s say there’s a number value for weight in the Sword Feature. In the 1-hand Template we set the default value for it to 2, and in the 2-hand Template to 5. All sword entities created with the 1-hand Template now have a weight of 2. If you now decide that 2.5 might be a better weight for a 1-hand sword change the value in the 1-hand Template – all 1-hand swords now weigh 2.5. But if you create a wood sword entity with the 1-hand Template and overwrite the default weight value to 1.5, it will stay at this value, even after you do a change to the Template.

Best regards,
Karsten
[Articy] Karsten Feyerabend
Articy Staff
Articy Staff
 
Posts: 23
Joined: Thu 16. Mar 2017, 16:11

Re: Entity Prefabs

Tue 26. Feb 2019, 02:48

Ah! Thanks a ton for the response! I knew I had to be over complicating this in my head! For some reason I had it stuck in my head that I could only use one template for both swords, who knows why lol. That's awesome you support defaults for both features and templates that cascade down to each other. That's pretty much exactly what I was hoping for.

I guess the only thing to be careful of with the example you listed, is how I handle features when I already have multiple sword templates. Adding a property to a feature that is already on all of the sword templates would automatically update the swords. Adding a new feature would require adding that new feature to every one of the sword templates, which could be human error prone. Would I be right in guessing this might be something a plugin could take care of?

Thanks again! :)
Orothin
 
Posts: 3
Joined: Sun 24. Feb 2019, 21:10

Re: Entity Prefabs

Tue 26. Feb 2019, 10:33

Hi Orothin,

Unfortunately it is not possible to modify Templates via the functionality of the MDK.
In your case you’d have to go the manual route to update your Feature / Template structure. Sorry.

Best regards,
Karsten
[Articy] Karsten Feyerabend
Articy Staff
Articy Staff
 
Posts: 23
Joined: Thu 16. Mar 2017, 16:11

Re: Entity Prefabs

Wed 27. Feb 2019, 14:29

No worries! In my case specifically, I think a little bit of planning for how I set up features should do the trick. There might be a little granularity loss (fewer features that include more properties per feature), but it still can handle what’s needed which is awesome. :)

Thanks again for the response!
Orothin
 
Posts: 3
Joined: Sun 24. Feb 2019, 21:10

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 36 guests

Who We Are
Contact Us
Social Links