• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Extending packages or class wrappers [Wurst]

Status
Not open for further replies.
Level 2
Joined
Aug 6, 2010
Messages
7
What's the best way to handle custom player attributes in Wurst? I went with the approach of creating a wrapper Player class that contains my custom attributes and also contains a native player object. This lead to some additional wrapper classes needing to be created like Team which contains n wrapper Player objects and my custom team attributes. It also meant I needed a way to convert from the native player type to my new wrapped Player type.


Is this the correct way to do it in Wurst, or is there a way to add variables + functions to a package? Will I also hit any type of performance issue with my simple wrappers?
 
Level 23
Joined
Jan 1, 2009
Messages
1,617
There are many possible ways, and what you described is one possible one, yes.
It is usually a matter of taste whether you want to use custom data structures and wrap stuff in classes or not.
With the use of generics you don't need a separate class for everything though.
I often do something like this: wurstbin (missing some things like ondestroy, just for illustration)
As you can see the teams are simply lists.

Will I also hit any type of performance issue with my simple wrappers?
As a general rule: Worry about performance problems when you encounter them.
 
Level 2
Joined
Aug 6, 2010
Messages
7
This is sort of off topic, but is there a way to add scoping to pData?

If I have two packages that are imported with pData then I would like to be able to differentiate. PackageA::pData vs PackageB::pData.
 
Status
Not open for further replies.
Top