Hello,
I've programmed a raffle-style rarity system for my obstacle spawning and I want to run it by the community to see if the method I devised is efficient or not. Please have a look.
~~~~~ ~~~~~ ~~~~~
1) Create a data table drawing from a structure with a map of actors keyed to integers (commonalities).

2) Retrieve commonality map from data table using the name of the current level as the row name.
3) Loop through all the actors in the commonality map, adding up their commonality (as if they were raffle tickets), and storing them in a new map where each obstacle is paired with an Int32Range.
4) Store the total number of "tickets".

5) Get a random integer between 1 and the total number of tickets counted.
6) Loop through all the actors in the new commonality map, checking if the random integer exists in any of their paired ranges.
7) Spawn the actor whose range includes the random integer.

~~~~~ ~~~~~ ~~~~~
Is this a good method for object rarity? I like that it allows me to tune the rarity in one place inside the data table.
I plan on executing SpawnObjects multiple times a second during play. Will looping through maps of actors and structs like this be inefficient?
Any advice would be appreciated.
Cheers.
I've programmed a raffle-style rarity system for my obstacle spawning and I want to run it by the community to see if the method I devised is efficient or not. Please have a look.
~~~~~ ~~~~~ ~~~~~
1) Create a data table drawing from a structure with a map of actors keyed to integers (commonalities).
2) Retrieve commonality map from data table using the name of the current level as the row name.
3) Loop through all the actors in the commonality map, adding up their commonality (as if they were raffle tickets), and storing them in a new map where each obstacle is paired with an Int32Range.
4) Store the total number of "tickets".
5) Get a random integer between 1 and the total number of tickets counted.
6) Loop through all the actors in the new commonality map, checking if the random integer exists in any of their paired ranges.
7) Spawn the actor whose range includes the random integer.
~~~~~ ~~~~~ ~~~~~
Is this a good method for object rarity? I like that it allows me to tune the rarity in one place inside the data table.
I plan on executing SpawnObjects multiple times a second during play. Will looping through maps of actors and structs like this be inefficient?
Any advice would be appreciated.
Cheers.
Comment