Log In  

Cart #cc_geneticalgorithm-29 | 2024-05-17 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
16

CC GENETIC ALGORITHM

This is a mod of Celeste classic where you get to watch a genetic algorithm learn how to play Celeste classic.

Note that longer runs will show better results. it takes roughly 10 minutes to beat 100m. be prepared to wait awhile for results! Also note that too many players will lag the machine. 10 Works best without slowing it too much. The default is 5.

Wiki page for the Genetic Algorithm

SETTINGS REFERENCE

CELESTE CLASSIC GENETIC ALGORITHM [CCGA]
MOD BY ANTIBRAIN

[SETTINGS REFERENCE]

`FPS` : Simulation FPS. The timer in the corner will not be affected. 
You do not need to set it to a normal number. framerates like 22 and 46 are just fine.

`# OF PLAYERS` : How many players to simulate at once. 
More players means it will learn faster, but too many can lag the machine.

`CYCLE LEN` : How many cycles to run before selecting iteration to reproduce and grow.

`ADDED PER C` : How many FRAMES to add after every cycle SET. [after `cycle>=max_cycle`]

`FALLBACK` : Max # of frames the ai is allowed to go back from preserved solution in the event of faliure.

`DEATH PEN` : Amount of points deducted. Can not go below `COIN REWARD`.

`COIN REWARD` : Amount of points given for collecting a coin. Can not go above `DEATH PEN`.

`BASE MUTATE` : The base mutate chance from 0-100%, without any deaths or changes. The mutate chance for each instance will never go below this number.

`SFX?` : Toggles sound effects that instances can make. (dashing, jumping, etc)

`MUSIC?` : Toggles music.

`SHOW N` : Toggles whether to display each player's instance number on itself. Enable to keep track of players.

`FLIP?` : Toggles whether to call flip() every frame to update the screen. When disabled, each frame will be updated instantly after the last frame. When disabled, It does break menus and cause a LOT of flickering, so use caution.

`▤  PAGE X/Y  ▤` : Current page number. Left/right to view other pages.

Numbers can be changed with L/R. Booleans [TRUE/FALSE] can be changed with any button.

CHANGELOG

CELESTE CLASSIC GENETIC ALGORITHM [CCGA]
MOD BY ANTIBRAIN

[CHANGELOG]

1.0: 
- Initial release

1.1:
- Added - This changelog
- Changed - Balloons now reward the ai for collecting them THE FIRST TIME
    - This is to increase the chances of winning levels like 2800m and 900m, where balloons are the only way of beating them, and there isn't much vertical reward.

1.2:
- Added - Reward coin collectibles that make ai happy when grabbed :D
    - This is to make sure the ai wont just ignore certain VERY IMPORTANT sections of levels. aka ALL OF 200M AAAAAAAAAAAAA

1.3:
- Added - Several menuitem features to change how the AI "Learns", As well as sim speed and such.
    - Functions include: FPS (10-60), Weather springs reward the AI, Weather Walljumping rewards the ai (Based on height walljumped from), Reward granted from collecting a coin, Score penalty for dying, Frames added per generation, % chance to mutate each instruction not kept, and the ability to reset the AI, starting fresh with new params.
- Changed - Coins no longer respawn once collected, as the ai would just die to get them again, and it follows the same path regardless of if the coin is there or not if it was collected at least once. (unless it died and the death pen is more then coin reward)

1.4:
- Removed - Reset AI menuitem
    - Caused too many issues, might add back later once fixed.

1.41:
- Fixed - "Last Improvement" Showed FRAME number instead of GENERATION number

1.5:
- Added - Simple title screen with basic instructions
    - This is to allow changing settings before a simulation has been started.
- Added - SRAND settings
    - Accessible when on title screen, select to enable, l/r to change seed.

1.6:
- Changed - Dying now removes all collectibles.
    - This is to prevent the ai from just dying over and over again to keep getting the reward from grabbing coins or berries.

1.61:
- Removed - Testing things i accidentally left behind (Whoops!)
- Fixed - Typos

2.0 :
- Major release
- Removed - A ton of settings that dont work anymore
- Removed - Some text that doesnt apply anymore
- Added - Multiple players at once
- Added - Fallback system
    - Based on deaths that generation. The more deaths the farther back mutations can be made, up to two seconds if 90% die, and 10 seconds if 100% die. This is to ensure that they dont get softlocked.
- Changed - Its a real genetic algorithm now
- Changed - Reward values
    - Higher death penelty
- Changed - Height Rewards
    - Only counts as grounded if this.spd.y==0
- Changed - Most of the algorithm and code to work with multiple instances.
- Changed - Title Screen
- Changed - Keep system doesnt HAVE to keep "working" solutions if they are terrible

2.1 :
- Fixed bugs
- Changed - Fallback only resets to unmodified best if ALL instances die in a single generation.

2.2 :
- Fixed bugs
- Working towards fitness choosing error
    - For some reason, the program will choose a different instance then the one who was selected to reproduce, to reproduce. I have no idea why that is, as its not supposed to do that. Also sometimes instruction sets get boggled randomly and i dont know why. Patch in progress.

2.3 :
- Fixed bugs
    - Note that this version is not public, due to some issues regarding the fitness function.

3.0 :
- Added - Cycle Based system
- Added - Ability to change `max_cycles`, and `frames_added_per_cycle` in pause menu. [SEE SETTINGS REFERENCE ABOVE]
- After X cycles, Best of X cycles reproduces, Add X frames.
- Changed - Algorithm now reproduces after `cycle>=max_cycle`
- Removed - Old reproduction system
- Fixed - Issue where system would choose wrong iteration to reproduce.
    - I'm not entirely sure what fixed it, but it definitely shows up way less now.
- Changed - Reformatted [CHANGELOG] and [COMMAND REFERENCE] to be in code blocks, because i think it looks nice.

3.1 :
- Changed - Default Population from 5 -> 10
    - 5 Was simply too slow. 10 is low enough where the flickering wasn't too bad, and high enough where it wont take too long to beat scores and learn.
- Updated - Cart label

3.21 :
- Attempt to fix bugs
    - At STILL for SOME REASON just picks the WRONG instance to reproduce. Most of the time this wont really do much besides make it take longer to beat levels, but sometimes it can lead to them all dying over and over.

3.22 :
- Added - Ability to change fallback length
    - This is to allow users to work around a suspected cause of the wrong_reproduce bug, until it is fixed.

3.3 :
- Added - Many settings accessible from pause menu on title screen. See [COMMAND REFRENCE] Above for more info.

3.31 :
- Changed - Each instance may only pick one coin up per generation
- Changed - Coins no longer despawn on collect
    - These two fixes are to make sure that instances dont mess things up and devalue other, better instances.

3.4 :
- Added - Ability to disable FLIP() call every frame
    - Note that this causes a lot of flickering and breaks the pause menu.
- Removed - FREEZE function. Removed so that the whole cart will not freeze when an instance opens the big chest containing the gem.

3.41 :
- Fixed - Timer silliness when FLIP() is disabled.

3.5 :
- Changed - Fallback system only happens if all instances die in a run
- Changed - Fallback duration is now no longer dynamic
P#147618 2024-04-30 02:43 ( Edited 2024-05-17 22:04)

1

gonna leave this in the background for a while, brb

P#147631 2024-04-30 08:22
2

half an hour later,

last improvement gen: 88
generation: 300

kind of wish pico-8 had turbowarp like for scratch

P#147632 2024-04-30 08:59
2

This is an interesting experiment! I wonder if you'd get faster results by evolving a 2d matrix that determines actions based on the player's screen position rather than your current time-based list of actions.

P#147644 2024-04-30 13:17
1

AI generation 100 made it past the pink flower.

P#147647 2024-04-30 14:11
3

thats so cool, I wonder if you could do the same for other games as well.
After one about 55 minutes, I stopped. I think it couldn't get past gen 175.

P#147671 2024-04-30 19:33
3

had the last one running for 13 hours, then v2 came out and now I'm up running it again :) cool stuff friend

P#147754 2024-05-02 06:33
1

Really cool with the improvements. Can you make it so that after you pass a level, you don't have to watch it redo all the levels before that level?

P#148501 2024-05-16 19:36

@micahc1113 i could, but i would have to do some shenanigans with the algorithm i havent gotten around to. also if it enters a level and dies really quickly, then it wont be able to use fallback frames to go back a level, which could cause issues.

I am planning on having it be toggleable though in an update, ill let you know when that happens.

P#148513 2024-05-16 23:41
1

yes! got past 100m

P#148546 2024-05-17 15:46
1

gen 220 to finish the level!!! gen 135 was the one that reached the strawberry platform and it was fabulous, and then gen 199 was the one to reach the end platform
if youre curious my settings were cycle 1, frame increase 1, 20 madelines

P#148547 2024-05-17 16:16

[Please log in to post a comment]