I would like to create a simulator(basically for testing purposes) for a game(League of legends).
The basics of the game:
you have a hero which has some stats:
- Health Point
- Attack Damage
- Attack Speed
- Armor
- Armor Penetration
- Movement Speed
Hero can have 4 skills(you get one skillpoint at each level) (They are activated manually, most of the time, has cooldown, damage, attackpower/attackdamage scale ratio, and skill level) + a passive skill
You can kill enemy heroes, or neutral monsters, they have the same stats:
- Health Point
- Attack Damage
- Attack Speed
- Armor
What I would like to do:
Create a tool to test if a particular item, or a particular stat increase would speed up your killing power/speed.
map: http://evtron.com/Evtron-Alpha/wp-content/uploads/2011/02/Summoners-Rift.jpg
Stat examples:
- Hp: 420
- Ad: 55
- AttackSpeed: 0.613 ( attacks / s -> every attack at 1/0.613 s)
- armor penetration: 25
The character gonna autoattack the enemy with the 1/attackspeed, and damaging with attackdamage(there is a formulate to calculate the damage, but thats not important in this phase i guess), once they are dead, moving to the next one with movingspeed(you can see the camps on the map, the yellow skulls)
I was thinking about the algorithm:
I thought if i just make a for from i=0 to i=30000(counting ms), so I can just check the enemy hp and my hp as well at every ms turned out so bad(pretty cpu heavy, and i would like to put some random in it, so i should be able to sum up 1k iteration, which is impossible)
Secondly, i thought i should just do a for from i= 1 to 30, and check every second, and check what happened in the last second, but some of the neutral monsters are in a big camp (up to 4 monsters), and this way the code was getting complicated and complicated.
I'm gonna create threads for each player/monsters, and once they finished look up when they died, and reduce the hp of the player.
My question, is this the right way to go?
TLDR: I would like to create a tool to create analysis(iterate 1k and calculate average) about a game which stat increase would make the character killing faster neutral monsters.
I would prefer java, but atm I'm stuck at the algorithm.
@Karoly S: Yep, it' my bad, .com -> .eu
I've been working on this:
I'm checking the remaining time on each object(player skill, autoattack, buffs), and always pick the shorttest time, and store the last_time, and add the time to time, at the next round I calculate the time by (time-last_time)
If the object has remaining time 0, it will do whatever it needs to do.
I don't know if it's effecient way or not, but that's the best I could do.