First commit that disconnects this game from the game framework so it can be its own thing.

This commit is contained in:
Zed A. Shaw 2026-03-29 11:02:02 -04:00
parent 8073997eb3
commit db60f75bd9
29 changed files with 37 additions and 36 deletions

View file

@ -37,7 +37,7 @@ tracy_build:
meson compile -j 10 -C builddir meson compile -j 10 -C builddir
test: build test: build
./builddir/runtests -d yes "[systems-engine]" ./builddir/runtests -d yes
run: build test run: build test
ifeq '$(OS)' 'Windows_NT' ifeq '$(OS)' 'Windows_NT'
@ -48,7 +48,7 @@ else
endif endif
debug: build debug: build
gdb --nx -x .gdbinit --ex run --args builddir/runtests "[systems-engine]" gdb --nx -x .gdbinit --ex run --args builddir/runtests
debug_run: build debug_run: build
gdb --nx -x .gdbinit --batch --ex run --ex bt --ex q --args builddir/zedcaster gdb --nx -x .gdbinit --batch --ex run --ex bt --ex q --args builddir/zedcaster
@ -60,7 +60,7 @@ clean:
meson compile --clean -C builddir meson compile --clean -C builddir
debug_test: build debug_test: build
gdb --nx -x .gdbinit --ex run --ex bt --ex q --args builddir/runtests "[systems-engine]" gdb --nx -x .gdbinit --ex run --ex bt --ex q --args builddir/runtests
win_installer: win_installer:
powershell 'start "C:\Program Files (x86)\solicus\InstallForge\bin\ifbuilderenvx86.exe" scripts\win_installer.ifp' powershell 'start "C:\Program Files (x86)\solicus\InstallForge\bin\ifbuilderenvx86.exe" scripts\win_installer.ifp'

View file

@ -65,7 +65,7 @@
"close": [] "close": []
} }
}, },
"rat_with_sword": { "spider_bot": {
"sheet": { "sheet": {
"frames": 1, "frames": 1,
"frame_width": 256, "frame_width": 256,
@ -101,11 +101,11 @@
"hands_sword_attack": { "hands_sword_attack": {
"sheet": { "sheet": {
"frames": 3, "frames": 3,
"frame_width": 900, "frame_width": 512,
"frame_height": 600 "frame_height": 341
}, },
"sequences": { "sequences": {
"idle": {"frames": [0, 1, 2], "durations": [10, 10, 20] } "idle": {"frames": [0, 1, 2], "durations": [5, 10, 20] }
}, },
"transforms": { "transforms": {
"basic": { "basic": {
@ -115,7 +115,7 @@
"max_y": 1.0, "max_y": 1.0,
"flipped": false, "flipped": false,
"scaled": false, "scaled": false,
"toggled": true, "toggled": false,
"looped": false, "looped": false,
"relative": false, "relative": false,
"easing": "none", "easing": "none",

View file

@ -7,18 +7,18 @@
"walk": "assets/sounds/walk.ogg" "walk": "assets/sounds/walk.ogg"
}, },
"sprites": { "sprites": {
"rat_with_sword": "spider_bot":
{"path": "assets/sprites/rat_with_sword.png", {"path": "assets/sprites/spider_bot.png",
"frame_width": 256, "frame_width": 256,
"frame_height": 256 "frame_height": 256
}, },
"healing_potion_small": "repair_kit":
{"path": "assets/items/healing_potion_small.png", {"path": "assets/items/repair_kit.png",
"frame_width": 256, "frame_width": 256,
"frame_height": 256 "frame_height": 256
}, },
"well_down": "ladder_down":
{"path": "assets/sprites/well_down.png", {"path": "assets/sprites/ladder_down.png",
"frame_width": 256, "frame_width": 256,
"frame_height": 256 "frame_height": 256
}, },

View file

@ -14,7 +14,7 @@
{"_type": "Device", {"_type": "Device",
"config": {}, "config": {},
"events": ["STAIRS_DOWN"]}, "events": ["STAIRS_DOWN"]},
{"_type": "Sprite", "name": "well_down", "width": 256, "height": 256, "scale": 1.0} {"_type": "Sprite", "name": "ladder_down", "width": 256, "height": 256, "scale": 1.0}
] ]
}, },
"DEAD_BODY_LOOTABLE": { "DEAD_BODY_LOOTABLE": {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before After
Before After

View file

@ -14,7 +14,7 @@
{"_type": "LightSource", "strength": 35, "radius": 2.0} {"_type": "LightSource", "strength": 35, "radius": 2.0}
] ]
}, },
"RAT_GIANT": { "SPIDER_BOT": {
"components": [ "components": [
{"_type": "Tile", "display": 2220, {"_type": "Tile", "display": 2220,
"foreground": "enemies/fg:rat_giant", "foreground": "enemies/fg:rat_giant",
@ -25,8 +25,7 @@
{"_type": "Motion", "dx": 0, "dy": 0, "random": false}, {"_type": "Motion", "dx": 0, "dy": 0, "random": false},
{"_type": "EnemyConfig", "ai_script": "Enemy::actions", "ai_start_name": "Enemy::initial_state", "ai_goal_name": "Enemy::final_state"}, {"_type": "EnemyConfig", "ai_script": "Enemy::actions", "ai_start_name": "Enemy::initial_state", "ai_goal_name": "Enemy::final_state"},
{"_type": "Personality", "hearing_distance": 5, "tough": false}, {"_type": "Personality", "hearing_distance": 5, "tough": false},
{"_type": "Sprite", "name": "rat_with_sword", "scale": 1.0}, {"_type": "Sprite", "name": "spider_bot", "scale": 1.0}
{"_type": "Sound", "attack": "Small_Rat", "death": "Creature_Death_1"}
] ]
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Before After
Before After

View file

@ -1,6 +1,6 @@
{ {
"healing_potion_small": "repair_kit":
{"path": "assets/icons/healing_potion_small.png", {"path": "assets/icons/repair_kit.png",
"frame_width": 96, "frame_width": 96,
"frame_height": 96 "frame_height": 96
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

BIN
assets/icons/repair_kit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

View file

@ -1,8 +1,8 @@
{ {
"POTION_HEALING_SMALL": { "REPAIR_KIT": {
"id": "POTION_HEALING_SMALL", "id": "REPAIR_KIT",
"name": "Small Healing Potion", "name": "Robot Repair Kit",
"description": "A small healing potion.", "description": "A healing item for robots.",
"inventory_count": 1, "inventory_count": 1,
"components": [ "components": [
{"_type": "Tile", "display": 1003, {"_type": "Tile", "display": 1003,
@ -10,7 +10,7 @@
"background": "color:transparent" "background": "color:transparent"
}, },
{"_type": "Curative", "hp": 20}, {"_type": "Curative", "hp": 20},
{"_type": "Sprite", "name": "healing_potion_small", "width": 256, "height": 256, "scale": 1.0}, {"_type": "Sprite", "name": "repair_kit", "width": 256, "height": 256, "scale": 1.0},
{"_type": "Sound", "attack": "pickup", "death": "blank"} {"_type": "Sound", "attack": "pickup", "death": "blank"}
] ]
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

BIN
assets/items/repair_kit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Before After
Before After

View file

@ -201,7 +201,7 @@ void WorldBuilder::configure_starting_items(DinkyECS::World &world) {
auto& player = world.get_the<Player>(); auto& player = world.get_the<Player>();
auto &inventory = world.get<inventory::Model>(player.entity); auto &inventory = world.get<inventory::Model>(player.entity);
auto healing = System::spawn_item(world, "POTION_HEALING_SMALL"); auto healing = System::spawn_item(world, "REPAIR_KIT");
inventory.add("pocket_l", healing); inventory.add("pocket_l", healing);
world.make_constant(healing); world.make_constant(healing);
} }

View file

@ -19,7 +19,7 @@ namespace gui {
"[spawn1|spawn2|spawn3]" "[spawn1|spawn2|spawn3]"
"[spawn4|spawn5|spawn6]"); "[spawn4|spawn5|spawn6]");
add_spawn_button("RAT_GIANT", "rat_with_sword", "spawn4"); // add_spawn_button("RAT_GIANT", "rat_with_sword", "spawn4");
$gui.init(); $gui.init();
} }

View file

@ -19,6 +19,9 @@ namespace gui {
auto config = settings::get("config"); auto config = settings::get("config");
$hand = textures::get_sprite(config["player"]["hands"]); $hand = textures::get_sprite(config["player"]["hands"]);
$hand_anim = animation::load("assets/animation.json", config["player"]["hands"]); $hand_anim = animation::load("assets/animation.json", config["player"]["hands"]);
int width = $hand_anim.sheet.frame_width;
int height = $hand_anim.sheet.frame_height;
$hand.sprite->setPosition({float(RAY_VIEW_X + (RAY_VIEW_WIDTH - width) / 2), float(RAY_VIEW_HEIGHT - height)});
} }
void MainUI::dirty() { void MainUI::dirty() {
@ -147,7 +150,6 @@ namespace gui {
if($hand_anim.playing) { if($hand_anim.playing) {
$hand_anim.update(); $hand_anim.update();
$hand_anim.apply(*$hand.sprite); $hand_anim.apply(*$hand.sprite);
$hand.sprite->setPosition({RAY_VIEW_X, RAY_VIEW_Y});
$window.draw(*$hand.sprite); $window.draw(*$hand.sprite);
} }
} }

View file

@ -10,12 +10,12 @@ using namespace components;
TEST_CASE("test the loot ui", "[loot]") { TEST_CASE("test the loot ui", "[loot]") {
auto items = settings::get("assets/items.json"); auto items = settings::get("assets/items.json");
DinkyECS::World world; DinkyECS::World world;
auto torch = world.entity(); auto repair_kit = world.entity();
auto& data = items["TORCH_BAD"]; auto& data = items["REPAIR_KIT"];
components::init(); components::init();
components::configure_entity(world, torch, data["components"]); components::configure_entity(world, repair_kit, data["components"]);
auto& torch_sprite = world.get<Sprite>(torch); auto& repair_kit_sprite = world.get<Sprite>(repair_kit);
REQUIRE(torch_sprite.name == "torch_horizontal_floor"); REQUIRE(repair_kit_sprite.name == "repair_kit");
} }

View file

@ -7,7 +7,7 @@
#include "algos/maze.hpp" #include "algos/maze.hpp"
#include "algos/stats.hpp" #include "algos/stats.hpp"
#define DUMP 1 #define DUMP 0
using std::string; using std::string;
using matrix::Matrix; using matrix::Matrix;

View file

@ -11,13 +11,13 @@ TEST_CASE("test texture management", "[textures]") {
components::init(); components::init();
textures::init(); textures::init();
auto spider = textures::get_sprite("rat_with_sword"); auto spider = textures::get_sprite("spider_bot");
REQUIRE(spider.sprite != nullptr); REQUIRE(spider.sprite != nullptr);
REQUIRE(spider.texture != nullptr); REQUIRE(spider.texture != nullptr);
REQUIRE(spider.frame_size.x == TEXTURE_WIDTH); REQUIRE(spider.frame_size.x == TEXTURE_WIDTH);
REQUIRE(spider.frame_size.y == TEXTURE_HEIGHT); REQUIRE(spider.frame_size.y == TEXTURE_HEIGHT);
auto image = textures::load_image("assets/sprites/rat_with_sword.png"); auto image = textures::load_image("assets/sprites/spider_bot.png");
size_t floor_tile = textures::get_id("floor_tile"); size_t floor_tile = textures::get_id("floor_tile");
size_t gray_stone = textures::get_id("door_plain"); size_t gray_stone = textures::get_id("door_plain");