Users browsing this thread: 1 Guest(s)
What's the Most Efficient Way to Program This?
#1
So I've been thinking about a little something I want to program into the World of Chaos games, and that's randomized equipment drops. Like for example, when a monster is about to drop a Knife, instead of just getting a Knife, you have a chance to get a Polished Knife (which would be better than the regular Knife), or a Damaged Knife (worse than the regular Knife), and other tiers of such. I was mostly thinking about how the heck I should approach this efficiently.

My primary thought is to have an array that represents an inventory (naturally) of 32 or however many slots for each class of item I want: Consumables, Weapons, Armor and Key Items. Inside this array is stored an ID number to represent an item. My main focus is the Weapons (since the same could be done for the armor) array. The values stored here would be ID numbers that represent an item...for example, 0 could be a Knife, 1 could be a Machete, 2 could be a Bronze Sword, etc. However, I'd need another array that's adjusted alongside this that stores the adjusted "class" of the item. 0 would mean it's a plain old Knife, for example, 1 would mean it's a Polished Knife, 2 would mean it's a Damaged Knife, etc. And finally, I'd need to create two lookup arrays; quite possibly 2D-arrays. One with all of the weapons having their base values for each stat stored. For example, 0, 0 would represent Knife's base Power stat, 0, 1 would be the Knife's base Fort stat, and etc. The second 2D-array would be for the special classes, and how much they modify the other values by percentage. So 0, 0 would represent how much Polished affects the Base Power, 0, 1 would represent how much Polished affects the Base Fort stat, and etc. The only problem I'm seeing with this method (besides being a bit weird to keep track of once the tables get pretty big) is...what if I want weapons to get random bonus stat increasers as well. For example, you may pick up a plain old knife again, but this one has a +2 Power bonus. Do I need to make the array that stores the special classes of each specific weapon in the weapons array a 2D array to store bonus changes too, also creating a bonus lookup table as well? And is this the most efficient route, or way more work than necessary?

I hope I'm being clear enough...this is boggling my mind.
[Image: tamerkoh.gif?9][Image: DevBanner.png][Image: Youtube.gif]DLBROOKS33
Thanked by:


Messages In This Thread
What's the Most Efficient Way to Program This? - by Koh - 08-08-2013, 08:11 PM

Forum Jump: