All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog.
- The
make_decisions_random
property is now correctly initialized.
- Alerts are now shown even if they're created from the web worker. In particular, bot exception alerts are now visible.
- The
GameCanvas
has a newdraw_rectangle
method which can fill/stroke a given rectangle.
- You may now
pause
inmake_decisions
to let the bots pause the simulation in interesting frames! - You may now use the
download_image
method instead ofdownload_images
to download a single image.
- No UI simulations are now non-verbose by default, meaning alerts shouldn't be shown and sounds are not played (unless the new
force
parameter is specified).
- Canvas dimensions are now slightly improved.
- Documentation of web-only methods is now accurate by using
functools.wraps
.
- Logs added immediately one after another now correctly added.
- Peer dependency on
dayjs
now specified correctly.
- If the simulation randomness seed is set to "-" it still succeeds.
useLocalStorage
now updates falsy variables.- Log viewer now doesn't reset all of the time.
- Second simulation not working because start button would not bind to Python simulation start.
- Running simulation files which were generated locally now works because previous they did not have the correct
_logs
.
- Support for output file in the CLI.
- Random differs on the browser (pyodide) and local (python) because of floating point stuff.
- Infinite loop of
is_web
.
- The CLI now works again and supports the new randomness seed option and execution from a file.
- Log function now automatically casts to
str
iftext
is not a string. - Logs are now persistent across rerenders, instead of previously being unstable.
- Round page fixes.
- Simulation files are now seeded.
- When running a simulation, you may now choose a specific randomness seed.
- You should now use
self.make_decisions_random
for any randomness usage inmake_decisions
. - The
random
global for bots is now a seeded pseudorandom generator initialized from the simulation seed by default (this can be customized withconfigure_bot_globals
). - You should now use
self.random
to make your game deterministic for a given seed.
- Running N times now resets the
Results
to make sure the alert at the end is of exactly N times.
- You must now add
@mantine/dropzone
to your dependencies.
- You can now download and upload simulation files. You may also use
configure_version
to invalidate previous simulation files, and choose a custom name for your main class (inheriting fromCodeBattles
) so your website can check that simulation files are of your game. - You may now specify a varying render rate with
configure_render_rate
for render-intensive code battle games. - The web worker rendering time is now shown.
- The error when
play_sound
fails is now more readable.
- The canvas dimensions in showcase mode are now more accurate (with regard to the height).
-
You must now add the following to your
index.html
insidebody
:<script type="py" src="/scripts/main.py" config="/config.json" worker name="worker" ></script>
- The
make_decisions
method is now called in a web worker and the entire game is able to be rendered before playing. If a frame's decisions hadn't been made and the user tries to play, the browser will sleep until it's ready (currently a fixed amount of time). - The
GameCanvas
has a newdraw_line
method which can draw a given line.
- You can now configure the globals given to each bot (e.g.
time
,math
,random
, etc.) withconfigure_bot_globals()
. - You may now also specify extra width with
configure_extra_width
which works similarly toconfigure_extra_height
. - The
GameCanvas
has a newdraw_circle
method which can fill/stroke a given circle.
- The Python library and pdoc template are now part of the library.
- There is a new vite plugin to include the Python library, update PyScript configuration etc. named vite-plugin-code-battles.
- The documentation now also has a reference of the Python library.
- Breaking changes will now be versioned correctly.