Making a simulator

Making a simulator
0

#1

I am trying to make an algorithm that uses something like min-max to choose the best actions. From reading the forums it seems like I have to make my own simulator for this. This seems really hard, especially when I have to implement so many functionalities like path finding over again on my own. Is there no better way?


#2

You can create an imperfect simulator making estimations and assumptions. You also may not need to create a pathfinding algorithm. Doing so can dramatically improve your simulator, but for starting out, the pathfinding code in the starter kit should suffice.


#3

Before I made my simulator, what I did is count destructors and encryptors along a path.
So you look at every path and count the destructors that would attack you on that path and subtract the encryptors from that value. The path with the lowest score is usually the best. Be carefull though, destructors always attack but encryptors only give you encryption once.
This is not as accurate as simulating but I was 1st on the leaderboard using this before.


#4

I did something very similar to @IWannaWin for a while, and it proved to also be quite successful. I think the game has changed a lot so it won’t do as well as it used to, but it can still do very well. Once I actually made a full simulator I found it actually isn’t as important as one might think. It doesn’t matter if you run hundreds or even thousands of simulations if you don’t run the “right” ones. I have made algos that run with 1/2 the number of simulations that have far outperformed other ones simply because of the type of simulations they ran.

It is more about finding an accurate way to decide the weak point in a defense, which uses the default pathfinding algorithm is pretty good at. I have personally found that trying to simulate or go through all of the attack options is not too bad since there aren’t as many options and you can get away with tricks like what @IWannaWin suggests that work quite well. A much more challenging thing (for me at least) has been figuring out the way to build a good base using those simulations since the event space (number of combinations/options) explodes. In this case, again, it comes down to other things not related to the simulator.

Basically, what I’m trying to say is that a simulator is only as powerful as you are able to give it good options. Then, even if your simulator makes a lot of generalizations or assumptions, as long as you’re aware of them, can still be very good.


#5

Okay so I wrote a basic simulator that takes in a game_state with units, simulates the game_state until there are no units left, and outputs that final game_state. How do I test it? Where do I put it?


#6

So this goes into my previous post about what simulations you want to run. This is something that comes from trial and error, but typically if you are ever making an important decision, like whether spawning units at a given location is a good idea, you can run your simulator to see if it would have the effect you desire. Then, after the simulation is over, you can either spawn or not depending on the result.


#7

The built in pathfinding function works pretty well… I can only only get it to do about 50 simulations in 5 seconds though. As most of the paths end up the same, you can ignore some of them or cache the results for at least a 2x-3x speed up:

self.finder = ShortestPathFinder()

locationBottomRight = game_map.get_edge_locations(game_map.BOTTOM_RIGHT)
locationTopLeft = game_map.get_edge_locations(game_map.TOP_LEFT)

for location in locationBottomRight:
  score = 0
  path = self.finder.navigate_multiple_endpoints(location, locationTopLeft, game_state)
  for loc in path:
    score += my_secret_sauce()

If you write your own full game simulation, taking into account the damage you do to the opponent, you may be able to come up with some really cool self destruction attacks, like the corners guns and ping shooters. They sometimes are very clever to attack tiny weak spots.

finally got a few wins against AELGOO, think that’s the best simulation algo out there. there’s a very nice diversity of styles in the top 20, have fun coding!

Its been a bit shameful to lose against such a simple algo as Artificial_Stupidity, think i need a clever simulation to defeat this: https://terminal.c1games.com/watch/3478106


#8

Hehe, dont worry I designed that algo to defeat demux algos (didnt really work though) but it used to win against my best aswell


#9

clever that it pushes demux attacks straight down the center into some cheap filters. made me realize straight in attacks do 1/2 damage of zig zag attacks.


#10

Yes, I also have another algo that destroyes demuxes, I might upload it soon. I like to make these, to see what weaknesses my algo has.


#11

would saying looking forward to seeing it but…

also i think i’ve spotted some hammerhammer weaknesses will also attempt something soon but guessing it may have a few shapeshifting tricks ready.


#12

would saying looking forward to seeing it but…

:joy:

also i think i’ve spotted some hammerhammer weaknesses

Nice, but the one to beat at the moment is either lasertag or mr_clean, they don’t have any losses yet


#13

mr_clean with exact same strategy steadily gaining ground…
https://terminal.c1games.com/watch/3506493

mr_clean is just smarter than livinglarge on when to popin encryptors… when i repair 1-2 filter, if those gets priority in rebuilding, then there’s not 4 cores left for an encryptor, trying to balance that.


#14

Mr_Clean wiping the floor by playing dirty, smh.


#15

Mr clean looks pretty clean to me, but i AM expecting a few dirty tricks to popup in the finals!


#16

Well here it is:
https://terminal.c1games.com/watch/3523148

Unfortunately @Ryan_Draves has already patched this weakness


#17

Interesting
https://terminal.c1games.com/watch/3545282


#18

sigh I was going to do that next. Props to him for innovating that* before I got the chance to.

Mr_Clean took care of business, but he got his hands dirty to do so and lost to the previous version…

* Not saying what that is, just saying it’s a very impressive innovation. I expect him to overtake me in the leaderboards once he sorts out his other losses