ChrisH36
Guy with Most Posts on Quiet Board.
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!
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!