It's me again. Working on some autonomous multi-binary and managed to break the game. The main base somehow built the turret even though there was not enough data to build it.
The code that probably caused this weird bug(pretty messy but i'm currently working in "as long as it works" mode):
enum{ TARGET_BUILT_BY, TARGET_RIGHT, TARGET_BACK, TARGET_LEFT, TARGET_FWD, TARGET_BUILDER, TARGET_SCOUT, TARGET_COMM, TARGET_SCAN1, TARGET_SCAN2, TARGET_SCAN3, TARGET_SCAN4, TARGET_SCAN5, TARGET_SCAN6, TARGET_DEFENCES, TARGET_ENEMIES_SEEN = 32 }; enum{ TURRET_DEFENCE_RATING = 15, INTERIOR_DEFENCE_RATING = 5, WALL_DEFENCE_RATING = 20 }; enum{ TEMP_BUILDER, TEMP_MINER, TEMP_BASE, TEMP_SHIP1, TEMP_SHIP2, TEMP_SCOUT, TEMP_TURRET, TEMP_INNER, TEMP_WALL }; int empty_defence_slot; int buffer; int buffer2; int defences_rating; int largest_enemy_attack_size; int perform_defence_scan; //... perform_defence_scan--; //... if(scan_for_threat(...)) //... }else{ if(perform_defence_scan<0){ perform_defence_scan = 40; defences_rating = 20; //Base counts for 20 defence for(buffer = TARGET_DEFENCES; buffer<TARGET_ENEMIES_SEEN; buffer++){ if(process[buffer].visible()){ switch(process[buffer].get_template()){ case TEMP_TURRET: defences_rating += TURRET_DEFENCE_RATING; break; case TEMP_INNER: defences_rating += INTERIOR_DEFENCE_RATING; break; case TEMP_WALL: defences_rating += WALL_DEFENCE_RATING; break; } } } } auto_stability.set_stability(0); auto_harvest.gather_data(); auto_allocate.allocate_data(2); if(empty_defence_slot != -1) if(defences_rating<largest_enemy_attack_size&&random(3)==2){ buffer = random(3) + TEMP_TURRET; buffer2 = random(8000); switch(buffer){ //The next line is, i bet, what caused the bug: case TEMP_TURRET: build_process(buffer, cos(buffer2, 400), sin(buffer2, 400), buffer2, empty_defence_slot); //as we can see on the screenshot, the process that was just built is TEMP_TURRET case TEMP_INNER: build_process(buffer, cos(buffer2, 200), sin(buffer2, 200), buffer2, empty_defence_slot); case TEMP_WALL: build_process(buffer, cos(buffer2, 600), sin(buffer2, 600), buffer2, empty_defence_slot); } } //Deploys a builder if none present, otherwise deploys a scout if none present if(get_available_data()>1000){ //Deploys a random unit } } //Other code, including the code that keeps targeting memory consistent by collapsing all the gaps between TARGET_DEFENCES and TARGET_ENEMIES_SEEN, and also between TARGET_ENEMIES_SEEN and 64
This code is only partial, if you need the whole process, or even the whole pack of processes, tell me and i'll send you a .zip of all .c files + the seed & settings for this battle.
Although it doesn't seem like that outcome can be replicated, not sure how that is possible. Just tried to re-do that battle, no bug this time.