Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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:

  1. 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)

  2. 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.

  3. 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.

share|improve this question

migrated from stackoverflow.com Sep 4 '11 at 3:19

This question came from our site for professional and enthusiast programmers.

1  
You might have better luck asking on the Game Development section/site of Stack Exchange, try to get a Mod to move it, though chances are they will anyways. A jungling simulator would be kind of interesting, I'll give it some thought and see what I come up with. –  Karoly S Sep 1 '11 at 14:29
    
Thanks for the quick answer, your help is much appreciated. My guess is right that you are hungarian too? –  etheld Sep 1 '11 at 15:02
    
Absolutely, this is something I've thought about though not nearly this in depth, but I would be interested in. My initial approach would be to see if an effective though simpler version of your #2 is possible. I would love to discuss this with you at greater lengths. And yes, your guess would be correct :) –  Karoly S Sep 1 '11 at 16:20
    
Sounds cool for me, I will leave the topic open, maybe someone already has an idea about it. my email (etheld at gwelican dot com) –  etheld Sep 1 '11 at 16:33
    
Sounds good, I'll put some thought into it and email you a little later today. –  Karoly S Sep 1 '11 at 16:41

1 Answer 1

Alternatives to frame-by-frame simulation:

You can get kind of a reasonable approximation for simulation by a formula such as

rawDamage = <some function of strength?)
Damage = rawDamage - enemyArmorReduction
DPS = (attackSpeed * Damage) * enemyArmorMod
myRemainingHP = myDPS / theirHP  - theirDPS / myHP

You can also maintain a move-queue, so that you simulate per-move, not per-tick:

// my aspd = 4 attacks per second, his aspd = 3 attacks per second
0.0s : start battle
0.25s: I attack
0.33s: He attacks
0.50s: I attack again
...
1.00s: I attack
1.00s: He attacks
...
share|improve this answer
    
The move queue will be more accurate, as it correctly deals with the fact that damage is discrete, not continuous. For example, if I do 50 damage at 0 seconds, and another 50 at 1 second, My DPS would be 50, yet I would kill a 100 HP target in 1 second. –  hammar Sep 1 '11 at 19:39
    
@hammar: that's true. the shorter the fight, the less accurate a DPS-based estimate will be. –  Jimmy Sep 1 '11 at 22:08
    
The fact that the game has stuns and other debuffs would make such a tool really hard to achieve, because different players could have different results in they killing rate. Anyway good answer. –  Grimshaw Jul 8 '12 at 23:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.