• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Item systems: Virtual or Object based?

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,337
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.
 
Last edited:
Level 23
Joined
Apr 16, 2012
Messages
4,041
Consider the fact that map can only contain around 8k custom objects per type(8k units, 8k items etc).
The best approach imo with tons of items is to create or use some custom inventory system, which potentionally allows you to define infinitly many items with bonus mod abilities. You can also change item's tooltips, cause they would be floating texts inside the inventory space
 
Status
Not open for further replies.
Top