Skip to content

Comments

New combined JSON config proposal#1

Draft
ComplexPlane wants to merge 32 commits intomasterfrom
newconf
Draft

New combined JSON config proposal#1
ComplexPlane wants to merge 32 commits intomasterfrom
newconf

Conversation

@ComplexPlane
Copy link
Owner

@ComplexPlane ComplexPlane commented Jan 22, 2023

Proposal/prototype for a new combined JSON config for wsmod. All per-stage configuration (ID, name, theme/music ID, time limit, warp goal jump distance, etc.) is grouped by stage and organized in story/challenge layout sections. See default-config.json for a mostly complete configuration of vanilla SMB2.

Config parsing is working at both the JSON and config format level, but implementing the story/challenge configs in-game is still TODO.

I'm using ArduinoJson to parse the config which is meant to be a small code/memory size and ergonomic JSON parser. One issue is that if there's a JSON parse error you can't retrieve a error location/message, but the library's simple enough it looks eas y to add at least a parse error location if needed. I have an error suggesting people use an editor like VSCode to look for JSON parse errors as well, since it's a standard language and all. On the contrary, errors parsing the config format itself are much better IMO.

Also, the plan for memory management is to do all parse-related allocations in a separate heap allocated in a block at the end of the main heap which is freed after all init_main_loop() functions are called. The idea is patches read from config and do their thing, copying from the parse heap and/or writing to the game's memory under the assumption the parse heap will be freed. A separate heap prevents heap fragmentation.

@ComplexPlane ComplexPlane changed the title New combined JSON config New combined JSON config proposal Jan 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant