Register for free, and make this box disappear!

Welcome to the BF Forums! Register Now, It's Free!


Welcome to the BF Forums; your source for the latest video game news, strategies, discussions, and resources. Join over 66,000 like-minded gamers to chat about your interests in our community.

You are currently viewing the forums as a guest user, which limits your access to certain content, contests, downloads, and more. By joining our free community, you will be able to respond in discussions/articles, contact members privately (PM), participate in regular-scheduled contests, see less advertisements, and have access to many other features. Registration is quick, easy, and completely free. Whatever your game interest may be, you'll find information here where people realize that games are more than just poker online.


Have your questions answered. Share your thoughts about a topic. Take 2 minutes, Register Now!
BattleForums.com Blizzard Gaming Forums > Warcraft > Warcraft General > Warcraft Maps and Modifications

We're Half-Way There!! - BF Lotto: $50 Ebay or Amazon Gift Card - A Single Click is All It Takes...

Reply
 
Thread Tools Display Modes
Old 04-18-2006, 09:59 PM   #1 (permalink)
 
Chris's Avatar
 
Join Date: May 2003
Location: Temple Prime, Sarajevo
Age: 22
Posts: 16,118
Random hero theory

You know how in Footmen Frenzy by Hato, you can get a random hero from the tavern then it will randomly pick you one. I wonder how that is done.

In my theory, I can declare an array that holds unit type, up to the number of heroes + the secrets. Then whenever a random hero is done, that person gets a random number from 0-max and that number will reference an element in the array. Like if you get 0, you can get Paladin or if you get 35: you get Bill.

But there must be another way in theory. Well declaring an array takes up memory on your PC. Its the size of a Unit Object (like footman or something's info) x the max number of elements. You can easily blow a high amount of space, but its more efficient.

Why I want to know this? Well, maybe there is a way that you don't really need an array, have to blow memory then destroy it (all wanted memory such as variables are destroyed when the game ends). I can figure it out, but some input would help!
__________________



One Vision. One Purpose.
Through leadership in Kane, we seek a new Tiberium future.
Our stealth and advanced weaponry will bring swift death to any who oppose us.
PEACE THRU POWER!


Warlock-Rauteus - Zy-el Necromancer - Level 143 of 10000

My Personal Blog Page - Updated every Friday
Join the Phantasy Star Online sensation - ChrisH36
Chris is online now   Reply With Quote
Beitrag Sponsored Links

__________________
Ads suck! Take 2 minutes to register for your free account, and GET RID OF THESE ADS!
Old 04-19-2006, 01:00 AM   #2 (permalink)
I still play games
 
Octopor's Avatar
 
Join Date: Nov 2003
Posts: 1,725
Unit Aquires Item

Item equal to "Random Hero"

If Then Else:

If Random Integer between 1 and (ammount of heroes) is equal to 1 (or whatever).
Then create hero for owner of triggering unit at region.
Else do nothing.
__________________
Quote:
My perception crit, now I can see why kids love Cinnamon Toast Crunch cereal.
Octopor is offline   Reply With Quote
Old 04-19-2006, 02:48 AM   #3 (permalink)
BattleForums Senior Member
 
Dream_Walker's Avatar
 
Join Date: Feb 2005
Location: Arcanum
Age: 18
Posts: 1,936
I think you are right Chris. Maybe we should put that in our map Marc :O
__________________
(\_/)
(O.o)
(> <) Bunnies rule the world. Paste him in your sig for world domination!
Married to §tar§oft
:heart Krobelus :heart

Quote:
Originally Posted by §tar§oft
don't make me smother your face in my thousand year old pussy
Quote:
Originally Posted by Trojan
Because Jenny is like an unfiltered bottle of water. You want it, but once you see whats on the bottom, you go ewww.
Thanks to Hellwolf_36 for my avatars .
Dream_Walker is offline   Reply With Quote
Old 04-19-2006, 04:10 AM   #4 (permalink)
 
Chris's Avatar
 
Join Date: May 2003
Location: Temple Prime, Sarajevo
Age: 22
Posts: 16,118
I know how the trigger works Marc, its my theory and its the only one that I know works. Besides, indexes start at 0.
__________________



One Vision. One Purpose.
Through leadership in Kane, we seek a new Tiberium future.
Our stealth and advanced weaponry will bring swift death to any who oppose us.
PEACE THRU POWER!


Warlock-Rauteus - Zy-el Necromancer - Level 143 of 10000

My Personal Blog Page - Updated every Friday
Join the Phantasy Star Online sensation - ChrisH36
Chris is online now   Reply With Quote
Old 04-20-2006, 03:50 AM   #5 (permalink)
I still play games
 
Octopor's Avatar
 
Join Date: Nov 2003
Posts: 1,725
Quote:
Originally Posted by Hellwolf_36
I know how the trigger works Marc, its my theory and its the only one that I know works. Besides, indexes start at 0.
I'm not talking about indexes.
__________________
Quote:
My perception crit, now I can see why kids love Cinnamon Toast Crunch cereal.
Octopor is offline   Reply With Quote
Old 04-20-2006, 03:51 AM   #6 (permalink)
 
Chris's Avatar
 
Join Date: May 2003
Location: Temple Prime, Sarajevo
Age: 22
Posts: 16,118
If you don't use indexes. You would need 1-whatever maximum heroes you can have in one huge ass if statement chain. Variables are good for these reasons .
__________________



One Vision. One Purpose.
Through leadership in Kane, we seek a new Tiberium future.
Our stealth and advanced weaponry will bring swift death to any who oppose us.
PEACE THRU POWER!


Warlock-Rauteus - Zy-el Necromancer - Level 143 of 10000

My Personal Blog Page - Updated every Friday
Join the Phantasy Star Online sensation - ChrisH36
Chris is online now   Reply With Quote
Old 04-20-2006, 03:55 AM   #7 (permalink)
Aya Matsuura is awesome
 
x42bn6's Avatar
 
Join Date: Nov 2002
Location: Trieste, Friuli-Venezia Giulia
Age: 20
Posts: 15,282
You could generate all 36 heroes in a region, make them Neutral Hostile and make them invisible to all and get a trigger to pick a random unit inside that region, then change its user and make it visible, but that blows even more memory.

No, I think the above way is the only sensible way.

Besides, a 36-member array is nothing compared to the visual effects in games like D-Day.*
__________________
* IM IN UR WIKI RVRTING UR EDITS

x42bn6 is offline   Reply With Quote
Old 04-20-2006, 03:57 AM   #8 (permalink)
 
Chris's Avatar
 
Join Date: May 2003
Location: Temple Prime, Sarajevo
Age: 22
Posts: 16,118
Well, the problem is when you allocate memory, you need to destroy it. Sometimes, memory isn't destroyed or destroyed completely, so you start getting small "data leaks". Also, you would need to display these heroes in a section of the map where nobody can see them.

But the memory of a hero depends on what makes up a "unit". If it's small, then its no problem. But if it's big... then there is a problem.
__________________



One Vision. One Purpose.
Through leadership in Kane, we seek a new Tiberium future.
Our stealth and advanced weaponry will bring swift death to any who oppose us.
PEACE THRU POWER!


Warlock-Rauteus - Zy-el Necromancer - Level 143 of 10000

My Personal Blog Page - Updated every Friday
Join the Phantasy Star Online sensation - ChrisH36

Last edited by Chris; 04-20-2006 at 04:01 AM.
Chris is online now   Reply With Quote
Old 04-20-2006, 04:50 AM   #9 (permalink)
Aya Matsuura is awesome
 
x42bn6's Avatar
 
Join Date: Nov 2002
Location: Trieste, Friuli-Venezia Giulia
Age: 20
Posts: 15,282
Quote:
Originally Posted by Hellwolf_36
Well, the problem is when you allocate memory, you need to destroy it. Sometimes, memory isn't destroyed or destroyed completely, so you start getting small "data leaks". Also, you would need to display these heroes in a section of the map where nobody can see them.

But the memory of a hero depends on what makes up a "unit". If it's small, then its no problem. But if it's big... then there is a problem.
I think Warcraft is secure enough for those memory leaks. Besides, the memory leaked from loading 36 models shouldn't be detrimental.*
__________________
* IM IN UR WIKI RVRTING UR EDITS

x42bn6 is offline   Reply With Quote
Old 04-20-2006, 05:46 AM   #10 (permalink)
 
Chris's Avatar
 
Join Date: May 2003
Location: Temple Prime, Sarajevo
Age: 22
Posts: 16,118
Well, the array of units is probably a pointer to unit objects. So it will only take up the memory of what its pointing too. Like in C++, a class can have something like

char * y;

This is a char pointer that is currently Null. You can use Dynamic Memory Allocation to populate it with whatever you wanted. Like to put the word LOL in it, you would need to allocate 4 elements (1 byte/element up to 3, including the terminating byte).

Units might be classes in that case, so there would be a pointer of unit classes inside the program when you do this. So, I guess it would be fine, I will try it out and see if there is any changes.

Man this talk about arrays has really gone technical.
__________________



One Vision. One Purpose.
Through leadership in Kane, we seek a new Tiberium future.
Our stealth and advanced weaponry will bring swift death to any who oppose us.
PEACE THRU POWER!


Warlock-Rauteus - Zy-el Necromancer - Level 143 of 10000

My Personal Blog Page - Updated every Friday
Join the Phantasy Star Online sensation - ChrisH36
Chris is online now   Reply With Quote
Old 04-20-2006, 03:15 PM   #11 (permalink)
Aya Matsuura is awesome
 
x42bn6's Avatar
 
Join Date: Nov 2002
Location: Trieste, Friuli-Venezia Giulia
Age: 20
Posts: 15,282
You don't have to go that far. D-Day, one of the most complicated maps out there, has tons of variables and plenty of arrays. Yet the game seldom crashes on high-end computers (if ever). Memory leak? Nah.*
__________________
* IM IN UR WIKI RVRTING UR EDITS

x42bn6 is offline   Reply With Quote
Old 04-20-2006, 04:57 PM   #12 (permalink)
 
Chris's Avatar
 
Join Date: May 2003
Location: Temple Prime, Sarajevo
Age: 22
Posts: 16,118
I guess the guy must be doing something dumb in that map like referencing outside the bounds of an array. The Fatal Error is a fail safe to avoid crashing the game too bad.
__________________



One Vision. One Purpose.
Through leadership in Kane, we seek a new Tiberium future.
Our stealth and advanced weaponry will bring swift death to any who oppose us.
PEACE THRU POWER!


Warlock-Rauteus - Zy-el Necromancer - Level 143 of 10000

My Personal Blog Page - Updated every Friday
Join the Phantasy Star Online sensation - ChrisH36
Chris is online now   Reply With Quote
Old 04-20-2006, 07:25 PM   #13 (permalink)
Premium Member
 
Forged's Avatar
 
Join Date: Nov 2002
Location: Texas
Age: 22
Posts: 5,374
Your idea for an array is the best way I can think of. Assign every Hero to a number in an array and then create a random number generator to pick one.
Forged is offline   Reply With Quote
Old 04-20-2006, 09:40 PM   #14 (permalink)
 
Chris's Avatar
 
Join Date: May 2003
Location: Temple Prime, Sarajevo
Age: 22
Posts: 16,118
Heh, I guess I will implement it into my footmen frenzy then.
__________________



One Vision. One Purpose.
Through leadership in Kane, we seek a new Tiberium future.
Our stealth and advanced weaponry will bring swift death to any who oppose us.
PEACE THRU POWER!


Warlock-Rauteus - Zy-el Necromancer - Level 143 of 10000

My Personal Blog Page - Updated every Friday
Join the Phantasy Star Online sensation - ChrisH36
Chris is online now   Reply With Quote
 
Reply

Get rid of all these ads! Take 30 seconds to register.

« Need map protection and DDscore. | Phoenix Burrow »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


All times are GMT +1. The time now is 12:55 PM.



Powered by vBulletin® Version 3.7.2 | Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0