- Joined
- Aug 7, 2013
- Messages
- 1,338
Hi,
Suppose I'm creating a (very) large item system (perhaps on the scale of Diablo, though I know little to nothing of its actual implementations).
What would be the highest level, general, and modular method to do this?
1. Make the items via Lua object scripts (or your favorite object creation scripts)--and for each item, make a corresponding item ability. This is O(2n) space, which is just O(n) complexity.
2. Alternatively, create O(n) item abilities, but create only c item objects. In this system, an item actually has no abilities, but rather they are assigned through some vJASS system by applying abilities (i.e. a bonus mod). To change the type of an item, we simply change what bonuses are assigned to the unit that wears it.
The downside is that the item's description and name will always be the same.
This will still have O(n) complexity, albeit O(n + c), which might possibly matter?
3. Last solution: use a constant/closed set of abilities like bonus mod, and a constant set of items (like solution 2). This results in the lowest amount of custom objects. But it also carries the penalty from 2. (item names/descriptions can't be changed) and puts most of the system in VJASS.
So, what would be the best solution?
I am guessing that because WC3 objects are immutable in game, but JASS data structures are mutable, representing a WC3 object in game as a JASS data structure should probably be more costly than just having a custom object, plus there is overhead.
On the other hand, systems 2, 3 offer the potential for nearly infinite items, since we can combine bonus mods in arbitrary ways (it's not really infinite but a very very large number).
I have been going with solution 1 (the naive solution). The biggest issue is I can't really test all my items at once (I can, but map loading takes awhile), since right now I've got over 1000 item abilities + the same number of items.
Suppose I'm creating a (very) large item system (perhaps on the scale of Diablo, though I know little to nothing of its actual implementations).
What would be the highest level, general, and modular method to do this?
1. Make the items via Lua object scripts (or your favorite object creation scripts)--and for each item, make a corresponding item ability. This is O(2n) space, which is just O(n) complexity.
2. Alternatively, create O(n) item abilities, but create only c item objects. In this system, an item actually has no abilities, but rather they are assigned through some vJASS system by applying abilities (i.e. a bonus mod). To change the type of an item, we simply change what bonuses are assigned to the unit that wears it.
The downside is that the item's description and name will always be the same.
This will still have O(n) complexity, albeit O(n + c), which might possibly matter?
3. Last solution: use a constant/closed set of abilities like bonus mod, and a constant set of items (like solution 2). This results in the lowest amount of custom objects. But it also carries the penalty from 2. (item names/descriptions can't be changed) and puts most of the system in VJASS.
So, what would be the best solution?
I am guessing that because WC3 objects are immutable in game, but JASS data structures are mutable, representing a WC3 object in game as a JASS data structure should probably be more costly than just having a custom object, plus there is overhead.
On the other hand, systems 2, 3 offer the potential for nearly infinite items, since we can combine bonus mods in arbitrary ways (it's not really infinite but a very very large number).
I have been going with solution 1 (the naive solution). The biggest issue is I can't really test all my items at once (I can, but map loading takes awhile), since right now I've got over 1000 item abilities + the same number of items.
Last edited: