Skip to content

Free games for graphing calculators: NumWorks, TI-Nspire CX, Casio fx-CG50 and soon TI-84 Plus CE. Balatro, Celeste, Hollow Knight, Minecraft and more.

FNAF World: in the build, the release, the tests and the docs

Mason3630637034b9191
diff --git a/Makefile b/Makefile
index f59a887b..14b55627 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@ PY ?= python3
CARGO ?= cargo
B = build/data
# Conventional games honor a configurable output directory; special layouts are kept local.
-GAMES_REDIRECT = angrybirds badtime balatro blockblast breakout buckshot celeste championisland chess connectfour cookieclicker coreball dinorun donkeykong doodlejump doom dune famidash finalearth2 flappybird flappydunk fnaf fnaf2 fnaf3 fnaf4 fnf g2048 hillclimb hollowknight invaders isaac jetpackjoyride leveldevil mahjong meowdoku minesweeper monkeymart numblocks numpowder numvisuals pacman paperclips polytrack portal pvz rider snake snowrider sokoban solitaire sonic stickmanhook subway sudoku suika templerun tombofthemask towerblock turborush twoplayer undertale uno uttt
+GAMES_REDIRECT = angrybirds badtime balatro blockblast breakout buckshot celeste championisland chess connectfour cookieclicker coreball dinorun donkeykong doodlejump doom dune famidash finalearth2 flappybird flappydunk fnaf fnaf2 fnaf3 fnaf4 fnafworld fnf g2048 hillclimb hollowknight invaders isaac jetpackjoyride leveldevil mahjong meowdoku minesweeper monkeymart numblocks numpowder numvisuals pacman paperclips polytrack portal pvz rider snake snowrider sokoban solitaire sonic stickmanhook subway sudoku suika templerun tombofthemask towerblock turborush twoplayer undertale uno uttt
GAMES_OUT = dinorun
GAME_REDIRECT_ARG = $(if $(filter $(1),$(GAMES_OUT)),OUT=../../$(B)/games/$(1),BUILD_DIR=../../$(B)/games/$(1))
# the RAM the oldest calculator software that runs apps gives them (23.2: 148928 bytes; 25.2 gives 153676).
@@ -29,7 +29,7 @@ RAM_LIMIT = 148928
# custom builds of Epsilon 25.2's source give apps less: 133652 bytes; every game fits there too, in NumPlay and on
# its own (their big buffers are on the stack, 32 KB apart from that RAM, or in the RAM the software has left)
CUSTOM_RAM = 133652
-BIG_APPS = Celeste HollowKnight Undertale ChampionIsland FinalEarth2 NumPowder NumBlocks NumDrive SubwaySurfers FiveNightsAtFreddys Doom BindingOfIsaac HillClimbRacing PlantsVsZombies SonicTheHedgehog CookieClicker LevelDevil JetpackJoyride StickmanHook DonkeyKong Dune MonkeyMart TombOfTheMask UNO FridayNightFunkin TurboRush AngryBirds PolyTrack UniversalPaperclips BadTimeSimulator Mahjong Rider SnowRider3D TempleRun FiveNightsAtFreddys2 FiveNightsAtFreddys3 FiveNightsAtFreddys4 Famidash UniversalPaperclips-French
+BIG_APPS = Celeste HollowKnight Undertale ChampionIsland FinalEarth2 NumPowder NumBlocks NumDrive SubwaySurfers FiveNightsAtFreddys Doom BindingOfIsaac HillClimbRacing PlantsVsZombies SonicTheHedgehog CookieClicker LevelDevil JetpackJoyride StickmanHook DonkeyKong Dune MonkeyMart TombOfTheMask UNO FridayNightFunkin TurboRush AngryBirds PolyTrack UniversalPaperclips BadTimeSimulator Mahjong Rider SnowRider3D TempleRun FiveNightsAtFreddys2 FiveNightsAtFreddys3 FiveNightsAtFreddys4 FiveNightsAtFreddysWorld Famidash UniversalPaperclips-French
# the calculator's space for installed apps: from the end of its software (64 KiB aligned) to 64 KiB before the
# end of its 4 MiB slot of flash, 0x903F0000. The software's size sets the start: 0x90200000 is the latest a
# NumPlay counts on (1.94 MB, APP_SPACE); Epsilon 26.4 on an N0120 ends at 0x90180000 (2.44 MB, the
@@ -336,6 +336,7 @@ APP_templerun = $(B)/games/templerun/templerun.nwa:TempleRun.nwa
APP_fnaf2 = $(B)/games/fnaf2/fnaf2.nwa:FiveNightsAtFreddys2.nwa
APP_fnaf3 = $(B)/games/fnaf3/fnaf3.nwa:FiveNightsAtFreddys3.nwa
APP_fnaf4 = $(B)/games/fnaf4/fnaf4.nwa:FiveNightsAtFreddys4.nwa
+APP_fnafworld = $(B)/games/fnafworld/fnafworld.nwa:FiveNightsAtFreddysWorld.nwa
APP_famidash = $(B)/games/famidash/famidash.nwa:Famidash.nwa
# the big games' modules are made from these (the kit)
$(foreach g,$(XL_GAMES),$(eval MOD_$(g) = $$(word 1,$$(subst :, ,$$(APP_$(g))))))
@@ -384,6 +385,7 @@ apps: | $(B)
$(MAKE) -C games/fnaf2 build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/fnaf2
$(MAKE) -C games/fnaf3 build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/fnaf3
$(MAKE) -C games/fnaf4 build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/fnaf4
+ $(MAKE) -C games/fnafworld build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/fnafworld
$(MAKE) -C games/famidash build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/famidash
cd games/tetris/tetris && NWLINK="$(NWLINK)" $(CARGO) build --release --quiet
cp $(word 1,$(subst :, ,$(APP_numdash))) $(B)/apps/$(word 2,$(subst :, ,$(APP_numdash)))
@@ -431,6 +433,7 @@ apps: | $(B)
cp $(word 1,$(subst :, ,$(APP_fnaf2))) $(B)/apps/$(word 2,$(subst :, ,$(APP_fnaf2)))
cp $(word 1,$(subst :, ,$(APP_fnaf3))) $(B)/apps/$(word 2,$(subst :, ,$(APP_fnaf3)))
cp $(word 1,$(subst :, ,$(APP_fnaf4))) $(B)/apps/$(word 2,$(subst :, ,$(APP_fnaf4)))
+ cp $(word 1,$(subst :, ,$(APP_fnafworld))) $(B)/apps/$(word 2,$(subst :, ,$(APP_fnafworld)))
cp $(word 1,$(subst :, ,$(APP_famidash))) $(B)/apps/$(word 2,$(subst :, ,$(APP_famidash)))
arm-none-eabi-strip --strip-unneeded $(B)/apps/Tetris.nwa
@@ -518,6 +521,7 @@ clean:
-$(MAKE) -C games/fnaf2 clean
-$(MAKE) -C games/fnaf3 clean
-$(MAKE) -C games/fnaf4 clean
+ -$(MAKE) -C games/fnafworld clean
-$(MAKE) -C games/famidash clean
-cd games/tetris/tetris && $(CARGO) clean
-$(foreach g,$(STD_GAMES),$(MAKE) -C games/$(g) clean;)
diff --git a/docs/media/gallery/fnafworld.gif b/docs/media/gallery/fnafworld.gif
new file mode 100644
index 00000000..8d667a77
Binary files /dev/null and b/docs/media/gallery/fnafworld.gif differ
diff --git a/docs/media/thumb_fnafworld.png b/docs/media/thumb_fnafworld.png
new file mode 100644
index 00000000..222f440e
Binary files /dev/null and b/docs/media/thumb_fnafworld.png differ
diff --git a/docs/play.md b/docs/play.md
index 5a02d196..0e314390 100644
--- a/docs/play.md
+++ b/docs/play.md
@@ -789,6 +789,25 @@ Last from 12 to 6 AM at Fazbear's Fright. Springtrap comes room by room: play th
Last from 12 to 6 AM in the bedroom. At a door, listen with the light off: breathing means someone stands right there, so hold the door shut until the steps go; no breathing, light the hall. Shut the closet on Foxy, light the Freddles off the bed. Fredbear comes up a hall on the 5th night: hold that door shut. After each of the first five nights, stop Plushtrap on the X to start the next at 2 AM. Night 5 opens the 6th and the Extras.
<br clear="right">
+
+## FNAF World
+
+<img src="../games/fnafworld/docs/shot.png" width="320" align="right" alt="FNAF World: a battle, Bonnie's attacks to pick">
+
+| Key | What it does |
+| --- | --- |
+| **Arrows** | Walk, pick |
+| **OK** or **EXE** | Attack, choose |
+| **1 2 3** | An attack straight away |
+| **Backspace** | Switch the party's rows in a battle |
+| **0** held | Run from a battle |
+| **Back** | Menu: party, chips, bytes, jump, save |
+| **Home** | Save and quit |
+
+Walk the world and enemies jump you. In a battle each of your four fills its charge; when one is full, pick one of its three attacks. Switch to the other four when they tire. Win exp, levels and Faz Tokens. Chests hold chips, Lolbit sells bytes, Mendo sells armor. Beat a challenger after a battle to make it yours, and take on the bosses on the map.
+
+<br clear="right">
+
## Famidash
<img src="../games/famidash/docs/shot.png" width="320" align="right" alt="Famidash">
diff --git a/games/fnafworld/README.md b/games/fnafworld/README.md
index 4260cd90..be4dafcd 100644
--- a/games/fnafworld/README.md
+++ b/games/fnafworld/README.md
@@ -14,6 +14,37 @@
&nbsp;·&nbsp; <a href="#controls">Controls</a>
</p>
+<p align="center">
+ <img src="../../docs/media/gallery/fnafworld.gif" width="320" alt="Walking Fazbear Hills, then a battle against Gearrats won">
+</p>
+
+## Highlights
+
+* **The whole overworld:** Fazbear Hills, Choppy's Woods, Dusting Fields, Lilygear Lake, Mysterious Mine, Blacktomb Yard, Deep-Metal Mine, Pinwheel Circus, Pinwheel Funhouse and the Geist Lair, with their chests, switches, keys, mines and jumps.
+* **The game's battles:** a party of eight in two rows, charges, the 48 characters with their 60 attacks, the enemies of each area with their specials, exp, levels and Faz Tokens, read from the game's own events.
+* **Challengers** after a battle: beat them to make them yours.
+* **Chips and bytes:** 21 chips from the chests, 21 bytes from Lolbit's shops, armor from Mendo.
+* **The bosses** on the map, from Auto Chipper to Chipper's Revenge, and the endings.
+
+<table>
+ <tr>
+ <td align="center"><img src="docs/shot.png" width="390" alt="A battle against Gearrats, Bonnie's attacks to pick"><br><sub>A battle</sub></td>
+ <td align="center"><img src="docs/map.png" width="390" alt="Fazbear Hills"><br><sub>Fazbear Hills</sub></td>
+ </tr>
+ <tr>
+ <td align="center"><img src="docs/boss.png" width="390" alt="Seagoon on Lilygear Lake"><br><sub>A boss</sub></td>
+ <td align="center"><img src="docs/party.png" width="390" alt="The party of eight"><br><sub>The party</sub></td>
+ </tr>
+</table>
+
+## How to play
+
+Pick a file, then Adventure (find new characters as you play) or Fixed Party, and Normal or Hard. Choose your eight.
+
+Walk the world: enemies jump you now and then. In a battle each of your four fills its charge; when one is full its three attacks show, pick one. Some attacks hit, some heal or help the party. The other four come in with the backspace key. Win for exp, levels and Faz Tokens. A challenger may follow a battle: beat it and it joins you.
+
+Chests hold chips; wear four from the menu. Lolbit sells bytes, helpers that fight with you; Mendo sells armor. Switches open new ways and the jumps between areas. In Normal the road ends at the end of the Pinwheel Funhouse; in Hard it goes on to the last boss.
+
## Controls
| Key | What it does |
@@ -21,13 +52,29 @@
| Arrows | Walk, pick |
| OK or EXE | Attack, choose |
| 1 2 3 | An attack straight away |
-| Backspace | Switch the party's rows in battle |
+| Backspace | Switch the party's rows in a battle |
| 0 held | Run from a battle |
-| Back | Menu, go back |
+| Back | Menu: party, chips, bytes, jump, save, how to play |
| Home | Save and quit |
+## Good to know
+
+* **Needs 6 MB apps** (Enlarged Extra Apps with Nwagra): the game is 4.9 MB. It comes on its own, not inside NumPlay. Your files are kept in each.
+* **No sound:** the calculator has no speaker.
+* **The pictures are the game's,** at 0.4 of their size: the battle is the game's 800 x 480 screen, the map at the same scale.
+* **Not in this version:** Halloween Land and its minigames (the portal there leads straight to the Geist Lair, once Security is beaten), the fishing spot, the hidden dungeons under the map, the clock, Fredbear's hints and the cutscenes.
+
## Credits
Inspired by FNAF World by Scott Cawthon, not affiliated with him.
+* The pictures, the map and the rules come from the game's Windows release (its Clickteam application): `tools/ccn.py` reads its pictures and objects, `tools/world.py` its map and `tools/pack.py` makes them into `src/data.bin`. The battles follow the game's own events, read out of the same file.
+* The words are drawn in the DejaVu fonts ([license](../../LICENSES/DejaVu.txt)).
+
Made by Mason Chen as part of NumPlay.
+
+## License
+
+The game's code is licensed under the GNU General Public License v3.0: see the `LICENSE` file at the root of the repository. The game's pictures keep their own terms (see Credits).
+
+Build: `make` (needs `arm-none-eabi-gcc` and Node.js for nwlink), `make test` on a computer.
diff --git a/games/fnafworld/docs/attack.png b/games/fnafworld/docs/attack.png
new file mode 100644
index 00000000..13764953
Binary files /dev/null and b/games/fnafworld/docs/attack.png differ
diff --git a/games/fnafworld/docs/boss.png b/games/fnafworld/docs/boss.png
new file mode 100644
index 00000000..ac7d70e6
Binary files /dev/null and b/games/fnafworld/docs/boss.png differ
diff --git a/games/fnafworld/docs/map.png b/games/fnafworld/docs/map.png
new file mode 100644
index 00000000..f421c5f4
Binary files /dev/null and b/games/fnafworld/docs/map.png differ
diff --git a/games/fnafworld/docs/party.png b/games/fnafworld/docs/party.png
new file mode 100644
index 00000000..9ae45335
Binary files /dev/null and b/games/fnafworld/docs/party.png differ
diff --git a/games/fnafworld/docs/shot.png b/games/fnafworld/docs/shot.png
new file mode 100644
index 00000000..eb1d6ecc
Binary files /dev/null and b/games/fnafworld/docs/shot.png differ
diff --git a/games/fnafworld/tests/rules.c b/games/fnafworld/tests/rules.c
index 9341975e..2e568567 100644
--- a/games/fnafworld/tests/rules.c
+++ b/games/fnafworld/tests/rules.c
@@ -263,12 +263,42 @@ static void shots(const char *dir) {
snprintf(p, sizeof p, "%s/chips.ppm", dir), host_shot(p);
}
+/* frames for the gallery's GIF: the map, a battle to its victory (a frame each 5 steps: 12 a second) */
+static void gif(const char *dir) {
+ char p[512];
+ int n = 0;
+ new_game(1, 1);
+ tap(K_DIGIT(0));
+ g.w.x = 1700, g.w.y = 1023;
+ for (int i = 0; i < 100; i++) {
+ step(i < 50 ? K_RIGHT : K_DOWN);
+ if (i % 5 == 0) game_draw(), snprintf(p, sizeof p, "%s/f%04d.ppm", dir, n++), host_shot(p);
+ }
+ for (int c = 1; c <= 8; c++) g.f.lv[c] = 4;
+ battle_start(0);
+ g.scene = SC_BATTLE;
+ int picked = 0;
+ for (int i = 0; i < 60 * 40 && g.scene == SC_BATTLE; i++) {
+ uint32_t k = 0;
+ if (B.ready && !B.att_slot) {
+ if (++picked % 40 == 20) k = K_DOWN;
+ if (picked % 40 == 39) k = K_OK;
+ }
+ step(k);
+ if (i % 5 == 0) game_draw(), snprintf(p, sizeof p, "%s/f%04d.ppm", dir, n++), host_shot(p);
+ }
+}
+
int main(int argc, char **argv) {
static uint16_t band[SCREEN_W * BAND_H];
gfx_set_band_memory(band);
fnafw_bin = fnafw_data;
host_save_dir("build/host-saves");
system("mkdir -p build/host-saves");
+ if (argc > 2 && !strcmp(argv[1], "gif")) {
+ gif(argv[2]);
+ return 0;
+ }
if (argc > 2 && !strcmp(argv[1], "shots")) {
shots(argv[2]);
return 0;
diff --git a/games/games.json b/games/games.json
index b7116273..155af781 100644
--- a/games/games.json
+++ b/games/games.json
@@ -1429,6 +1429,29 @@
"default": false,
"xl": true
},
+ {
+ "id": "fnafworld",
+ "rank": 37,
+ "title": "FNAF World",
+ "tagline": "Battle through the world",
+ "credit": "Based on the game by Scott Cawthon",
+ "top": "0x2A6AC8",
+ "bottom": "0x0C2A16",
+ "accent": "0x8CD25A",
+ "colors": 16,
+ "records": [
+ "fnafw1.sav",
+ "fnafw2.sav",
+ "fnafw3.sav",
+ "fnafw_saves.py"
+ ],
+ "shots": [
+ "docs/shot.png"
+ ],
+ "repo": "https://github.com/Mason363/NumPlay/tree/main/games/fnafworld",
+ "default": false,
+ "xl": true
+ },
{
"id": "famidash",
"rank": 34,
diff --git a/tests/test_games.py b/tests/test_games.py
index 749ec92d..5fd8859f 100644
--- a/tests/test_games.py
+++ b/tests/test_games.py
@@ -310,6 +310,13 @@ GAMES = {
# in it, paused
"fnaf4": ("FiveNightsAtFreddys4.nwa", "fnaf4res.sav", presses((1500, "ok"), (2200, "ok")), 9000,
presses((1500, "back")), 5000),
+ # the title, file 1, New Game, yes, Adventure, Normal, the party (0 done), the map; Home keeps the file. Next time,
+ # from the copy: the title, file 1, Continue, the party, the map, quit with On/Off
+ "fnafworld": ("FiveNightsAtFreddysWorld.nwa", "fnafw1.sav",
+ presses((1500, "ok"), (2200, "ok"), (2900, "ok"), (3600, "up"), (4100, "ok"), (4800, "ok"),
+ (5500, "ok"), (6400, "0")) + [(7200, 9000, K["right"])], 11000,
+ presses((1500, "ok"), (2200, "ok"), (2900, "down"), (3400, "ok"), (4100, "0"))
+ + [(4800, 6400, K["left"])], 9000),
# how to play (the first time: two pages), Play, Stereo Madness, OK held to jump, Back to pause; Home keeps the
# guide read and the time played. Next time, from the copy, Play straight away, quit with On/Off
"famidash": ("Famidash.nwa", "famidash.sav",
@@ -386,7 +393,8 @@ COPIES = {"championisland": "champion_saves.py", "numblocks": "numblocks_saves.p
"angrybirds": "angrybirds_saves.py", "polytrack": "polytrack_saves.py", "paperclips": "paperclips_saves.py",
"badtime": "badtime_saves.py", "mahjong": "mahjong_saves.py",
"rider": "rider_saves.py", "snowrider": "snowrider_saves.py", "templerun": "templerun_saves.py",
- "fnaf2": "fnaf2_saves.py", "fnaf3": "fnaf3_saves.py", "fnaf4": "fnaf4_saves.py", "famidash": "famidash_saves.py"}
+ "fnaf2": "fnaf2_saves.py", "fnaf3": "fnaf3_saves.py", "fnaf4": "fnaf4_saves.py", "fnafworld": "fnafw_saves.py",
+ "famidash": "famidash_saves.py"}
def paperclips_ok(v):
@@ -650,6 +658,9 @@ CHECKS = {
# the night kept ("FNF4", its steps at 652); after the reinstall, from the copy, it goes on
"fnaf4": (lambda v: v[:4] == b"FNF4" and struct.unpack_from("<I", v, 652)[0] > 120,
lambda v: v[:4] == b"FNF4" and struct.unpack_from("<I", v, 652)[0] > 300),
+ # "FNFW", the file started (at 8), the time played (minutes, seconds at 396); after the reinstall, from the copy, more
+ "fnafworld": (lambda v: v[:4] == b"FNFW" and v[8] == 1 and v[396] * 60 + v[397] >= 3,
+ lambda v: v[:4] == b"FNFW" and v[8] == 1 and v[396] * 60 + v[397] >= 6),
# "FMD1", version 1: how to play read (flags at 5), time played (564); after the reinstall, from the copy, more
"famidash": (lambda v: famidash_ok(v) and v[5] & 1 and struct.unpack_from("<I", v, 2100)[0] >= 7000,
lambda v: famidash_ok(v) and v[5] & 1 and struct.unpack_from("<I", v, 2100)[0] >= 12000),
@@ -725,6 +736,7 @@ def play(name, path, out, index=None, copy=None, tag=None, start=800):
game's own copy of its saves: only the scripts are left before the second session, as after installing
the app again. The problems, the stack used and the files after the first session."""
nwa, save, keys1, home1, keys2, home2 = GAMES[name]
+ emu.configure(xl=os.path.getsize(path) > 2 * 1024 * 1024) # (a 6 MB app: Enlarged Extra Apps)
tag = tag or name
if index is not None: # Home in a game quits NumPlay altogether
keys1, home1 = through_launcher(index, keys1, home1, start)
diff --git a/tools/release.py b/tools/release.py
index c930fa8d..ab3a3ab2 100644
--- a/tools/release.py
+++ b/tools/release.py
@@ -63,6 +63,7 @@ ALONE = {
"fnaf2": ("Five Nights at Freddy's 2", "the new pizzeria's six nights and the Custom Night: the mask, the music box, the flashlight"),
"fnaf3": ("Five Nights at Freddy's 3", "Fazbear's Fright's six nights with Springtrap and the phantoms: the lure, the vents, the maintenance panel"),
"fnaf4": ("Five Nights at Freddy's 4", "the bedroom's nights with the Nightmares: listen at the doors, the closet, the bed, Fun with Plushtrap"),
+ "fnafworld": ("FNAF World", "the RPG: the overworld, battles with a party of eight, 48 characters, chips, bytes, bosses and endings (6 MB apps only)"),
"famidash": ("Famidash", "TFDSoft's Geometry Dash for the NES, made for the calculator: the 173 levels of Famidash HUGE, every mode, practice mode"),
}
VARIANTS = [