Jump to content
  • 0

Performant way of handling skill conditions


IVeve

Question

In my game I'm making spells, each for a different type of weapon. What's a scalable and efficient way of handling weapon type checks for each of the spells? I figured that running a check for each weapon every time you want to cast a spell wouldn't be great, so my next idea was to implement a common event that gets called every time you change equipment - problem is, it'd be a colossal event that checks through every type of weapon (don't think that'd be very performant). Is there a way to attach a common event to an item, so that when it's equipped I can change some variable? Or maybe there's a better way to implement the system I'm trying to go for.

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 1
3 minutes ago, IVeve said:

 

That'd be the most optimal solution, unfortunately I'm either blind or the Tag system wasn't brought over (using the Development version from today).

 

 

Well, since you seem to be versed in coding, ill post the link to the touched up version Cheshire made if you want to peek around and see if you can fix it up for your client, but beware as updates to intersect could break it or cause merge conflicts.

 

 

Link to comment
Share on other sites

  • 0

The single massive event whenever any equipment changes actually wouldn't hinder performance that bad. That's how I would do it, because equipment doesnt actually change that often and that event will only take a few milliseconds to run at most. 

 

That event will also catch forced unequips too. Such as the case where the class changes and none of the requirements are met anymore to wear the items or when the player sells the items, etc. 

Link to comment
Share on other sites

  • 0

I'm not sure if it made it into the base engine, but Leafling uses a Tag system i believe was brought over. You can assign Tag to items like for example "Bow" and then put conditional checks on your spells for if item equipped has "Bow" 

Link to comment
Share on other sites

  • 0
6 minutes ago, Aesthetic said:

I'm not sure if it made it into the base engine, but Leafling uses a Tag system i believe was brought over. You can assign Tag to items like for example "Bow" and then put conditional checks on your spells for if item equipped has "Bow" 

 

It wasn't, because the way it was implemented was up for debate and needed a better implementation.

(Something with a table to store the tags in so we could more easily reverse search rather than going through every object and string checking them)

Link to comment
Share on other sites

  • 0
7 minutes ago, Aesthetic said:

I'm not sure if it made it into the base engine, but Leafling uses a Tag system i believe was brought over. You can assign Tag to items like for example "Bow" and then put conditional checks on your spells for if item equipped has "Bow" 

 

That'd be the most optimal solution, unfortunately I'm either blind or the Tag system wasn't brought over (using the Development version from today).

 

EDIT: seconds later.

  

1 minute ago, Cheshire said:

 

It wasn't, because the way it was implemented was up for debate and needed a better implementation.

 

Well, seems like I'll have to add and maintain a massive common event every time I add an item. Thanks for the info.

Link to comment
Share on other sites

  • 0
2 minutes ago, Aesthetic said:

 

Well, since you seem to be versed in coding, ill post the link to the touched up version Cheshire made if you want to peek around and see if you can fix it up for your client, but beware as updates to intersect could break it or cause merge conflicts.

 

 

 

Oh, that's amazing, thanks!

Link to comment
Share on other sites

×
×
  • Create New...