Terminal Game Q&A

Please ask questions here! Also, feel free to check out our live Q&A from Friday on twitch – https://www.twitch.tv/videos/273645916

1 Like

Question about decay of the stability granted by encryptors - Say a ping gets encrypted by 5 encryptors for a total of 50 additional stability. Does all of the stability decay at a single rate of .15 per frame (that is, in 10 frames it will have .15 * 10 = 1.5 less stability), or does each encryptor boost decay individually (that is, in 10 frames it will have .15 * 10 * 5 = 7.5 less stability)?

1 Like

The later. Each boost decays individually.

1 Like

Is there a way to get crash reports from leaderboard matches? I’ll see weird things in my ELO matches where my algo wins many but on some will crash for seemingly no reason on one of the early turns. Difficult to debug this as I can’t reproduce it in the playground.

1 Like

Can you send us the zipped version of your algo that has random crashes? Please email to junaid@correlation-one.com

1 Like

I could do that. Although I’m sure the crashes are due to my programming. I found one by painstakingly watching the replay and manually making identical moves to the opponent I crashed to; there was division by zero if the enemy units had no path to my board. It’s little things like that which I keep missing.

For now I think I can find them by making identical moves as the opponents in the playground, rather than emailing you for each new algo with a mysterious problem :slight_smile:

Long-term though, are there any plans to make debug situations like this easier?

1 Like

Ah ic, I was worried there might be a bug in the ranked matches that doesn’t exist in the playground.

Eventually we want to make it so that you can challenge any algo in playground so you could replay a ranked game with a particular algo you versed that caused a bug and see the debug errors there.

3 Likes

New question. Looking for advice. Having a little trouble getting my head around how the game state operates. It seems like I only have access to the state of the game at the start of each turn, before either algo has placed any new units. If, instead, I wanted to analyse a copy of the map at the moment after both algos have placed new walls and info for the turn, but before any other frames have passed, do I have a way to access this? I looked at algocore and game_state classes but I can’t quite see a way to modify them to save this particular frame of data for me.

1 Like

Yep algocore is what you want to look at.

If you look at this part:

            if stateType == 0:
                """
                This is the game turn game state message. Algo must now print to stdout 2 lines, one for build phase one for
                deploy phase. Printing is handled by the provided functions.
                """
                self.on_turn(game_state_string)
            elif stateType == 1:
                """
                If stateType == 1, this game_state_string string represents the results of an action phase
                """
                continue

You can see that the way it works now you forward the start of every turn to your “on_turn” function. You can do the same thing for when stateType == 1 which is the action phase. Forward the string to a different function, maybe one that stores the first one every turn but ignores the rest or whatever you like. After storing it you can deserialize it using the game_state class just like what on_turn function already does.

1 Like

Ah, perfect. I was misunderstanding how the action phase was processed. I thought that the stateType == 1 string was only sent back once at the end of the action phase, containing the resulting game state after all the action frames. If this is sent once per frame I can definitely find the frame I want to look at. Thanks.

1 Like

Alright, more questions, woohoo!
Today’s thought: Because action frames are handled by the game engine after the ‘build’ and ‘deploy units’ phases are submitted by our algos, if we desired a more advanced predictive pathfinding method to determine optimal unit placement, one that took into account path changes due to destroyed units, is the only way to do this currently to write our own mini game engine that runs the action phase inside our algos?

1 Like

You have to decide where to deploy ahead of time ya. But, you can try to predict changes in the map. For example one of your firewalls or enemy firewalls might be very damaged and so likely to be destroyed. What you can do is edit the game_state map and remove those firewalls, so that the path the pathfinding returns takes that into account. Similarly, you can make copies of the game_state that add extra firewalls, or go through other hypothetical situations that are likely to occur. For example if you are thinking of removing one of your firewalls so your units path better, you can make a copy of the game_state and remove the firewall, get the new path, and check to see if its better, and if it is refund that firewall (remember it takes a turn to refund, so don’t deploy your information units until after a turn).

Relevant code:

Make copy of game_state:
game_state2 = gamelib.GameState(self.config, turn_state)

Add or remove a unit manually:
game_state2.game_map.add_unit(FILTER, [13,13], 0)
game_state2.game_map.remove_unit([13,13])

Get path:
game_state2.find_path_to_edge([13,0], game_state2.game_map.TOP_RIGHT)

1 Like

Ah ok. Pathing on hypothetical maps is almost as good.

I was thrown off by this entry in the documentation:

add_unit(unit_type, location, player_index=0)[source] :
Add a single GameUnit to the map at the given location.

Args:
unit_type: The type of the new unit
location: The location of the new unit
player_index: The index corresponding to the player controlling the new unit, 0 for you 1 for the enemy
This function does not affect your turn and only changes the data stored in GameMap. The intended use of this function is to allow you to create arbitrary gamestates. Using this function on the GameMap inside game_state can cause your algo to crash.

But I suppose this does not crash as long as you copy gamestate first and don’t submit the modified copy?

1 Like

Ya that’s there just to advise you to make a copy basically. We should change the wording.

If you make a copy of it, it should be fine.

1 Like

Hi,

I’m new, so sorry if this information is somewhere in the docs and I missed it. I’m a bit confused about where our logic begins and where the engine takes over. From the getting started tutorial, it says:

Movement and Pathing are automated by the game’s engine.

And it goes on to explain the logic behind the engine’s movement.

However, when looking at the file structure of starter-algo there is a file navigation.py and the very first function has the comment:

This class helps with pathfinding. We guarantee the results will
be accurate, but top players may want to write their own pathfinding
code to maximize time efficiency

Is the tutorial simply explaining the way this default library works, and we are free to expand/change it in navigation.py? Does this apply to the other files? I understand that the pathfinding library will probably be just fine for most applications; I am just trying to get a sense of what aspects we as the user have control over.

Thanks!

1 Like

Great question.

Players cannot control their units pathing at all. The provided pathfinding function is used to predict where a unit will path. Calling game_state. find_path_to_edge(location, edge) is the same as asking 'If there is a unit at this location, what path will it take to reach its target edge?" As opposed to telling a unit to actually take some path.

2 Likes

How do packages work? Is it possible to import a package, and use it with the AI on the website?

And can we use files that are created in the algo folder? For example, if I want to import some data from a .txt file in the algo folder, is that possible?

1 Like

Thanks for the answer @RegularRyan, that makes sense. So we are free to edit that file, etc, but it would be mostly pointless because it will not change our bots behavior. Instead, it could end up giving us false information as we evaluate possible future positions.

3 Likes

You can store whatever you want in the algo folder you upload including a .txt with data (as long as the total folder size isn’t ridiculously huge). Note however, that the .txt wouldn’t change between matches. It would be the same .txt you uploaded to the site originally.

As for packages see this answer: Machine learning libraries
Essentially for now just include the library files themselves in the algo you upload. You can also import default libraries in python3.

2 Likes

Quick question, what does ELO mean for algorithms? I see it listed on the algos page and it seems to rank the algos on the leaderboard, but I don’t see it listed anywhere in the docs.

2 Likes