First cut of pulling out the relevant parts of my original game to make a little framework.

This commit is contained in:
Zed A. Shaw 2026-03-22 10:37:45 -04:00
commit 6a0c9e8d46
177 changed files with 18197 additions and 0 deletions

140
assets/ai.json Normal file
View file

@ -0,0 +1,140 @@
{
"profile": {
"enemy_found": 0,
"enemy_dead": 1,
"health_good": 2,
"no_more_items": 3,
"no_more_enemies": 4,
"in_combat": 5,
"have_item": 6,
"have_healing": 7,
"detect_enemy": 8,
"tough_personality": 9,
"cant_move": 10
},
"actions": [
{
"name": "find_enemy",
"cost": 5,
"needs": {
"detect_enemy": true,
"in_combat": false,
"no_more_enemies": false,
"enemy_found": false
},
"effects": {
"in_combat": true,
"enemy_found": true
}
},
{
"name": "run_away",
"cost": 0,
"needs": {
"tough_personality": false,
"in_combat": true,
"have_healing": false,
"health_good": false,
"cant_move": false
},
"effects": {
"in_combat": false
}
},
{
"name": "kill_enemy",
"cost": 10,
"needs": {
"no_more_enemies": false,
"in_combat": true,
"enemy_found": true,
"enemy_dead": false
},
"effects": {
"enemy_dead": true
}
},
{
"name": "collect_items",
"cost": 5,
"needs": {
"no_more_enemies": true,
"no_more_items": false
},
"effects": {
"no_more_items": true
}
},
{
"name": "find_healing",
"cost": 2,
"needs": {
"have_healing": false,
"in_combat": false,
"health_good": false
},
"effects": {
"health_good": true
}
},
{
"name": "use_healing",
"cost": 1,
"needs": {
"have_healing": true,
"health_good": false
},
"effects": {
"health_good": true
}
}
],
"states": {
"Host::initial_state": {
"enemy_found": false,
"enemy_dead": false,
"health_good": true,
"no_more_items": false,
"no_more_enemies": false,
"in_combat": false,
"have_item": false,
"have_healing": false,
"detect_enemy": true,
"tough_personality": true
},
"Host::final_state": {
"enemy_found": true,
"enemy_dead": true,
"health_good": true,
"no_more_items": true,
"in_combat": false,
"no_more_enemies": true
},
"Enemy::initial_state": {
"detect_enemy": false,
"tough_personality": true,
"enemy_found": false,
"enemy_dead": false,
"health_good": true,
"in_combat": false
},
"Enemy::final_state": {
"detect_enemy": true,
"enemy_found": true,
"enemy_dead": true,
"health_good": true
}
},
"scripts": {
"Host::actions":
["find_enemy",
"kill_enemy",
"collect_items",
"find_healing",
"run_away",
"use_healing"],
"Enemy::actions":
["find_enemy", "run_away", "kill_enemy", "use_healing"]
}
}

132
assets/animation.json Normal file
View file

@ -0,0 +1,132 @@
{
"burning_animation": {
"sheet": {
"frames": 3,
"frame_width": 256,
"frame_height": 256
},
"sequences": {
"idle": {"frames": [0,1,2,1,0], "durations": [5,5,5,5,5] }
},
"transforms": {
"basic": {
"min_x": 1.0,
"min_y": 1.0,
"max_x": 1.0,
"max_y": 1.0,
"flipped": false,
"scaled": true,
"toggled": false,
"looped": false,
"relative": true,
"easing": "none",
"motion": "move_none"
}
},
"forms": {
"idle": ["idle", "basic"]
},
"sounds": {
"idle": [],
"open": [],
"close": []
}
},
"lightning_animation": {
"sheet": {
"frames": 5,
"frame_width": 256,
"frame_height": 256
},
"sequences": {
"idle": {"frames": [0,1,2,3,4], "durations": [5,5,5,5,5] }
},
"transforms": {
"basic": {
"min_x": 1.0,
"min_y": 1.0,
"max_x": 1.0,
"max_y": 1.0,
"flipped": false,
"scaled": true,
"toggled": false,
"looped": false,
"relative": false,
"easing": "none",
"motion": "move_none"
}
},
"forms": {
"idle": ["idle", "basic"]
},
"sounds": {
"idle": [],
"open": [],
"close": []
}
},
"rat_with_sword": {
"sheet": {
"frames": 1,
"frame_width": 256,
"frame_height": 256
},
"sequences": {
"idle": {"frames": [0], "durations": [50] }
},
"transforms": {
"basic": {
"min_x": 1.0,
"min_y": 1.0,
"max_x": 1.22,
"max_y": 1.22,
"flipped": false,
"scaled": true,
"toggled": false,
"looped": false,
"relative": false,
"easing": "sine",
"motion": "scale_both"
}
},
"forms": {
"idle": ["idle", "basic"]
},
"sounds": {
"idle": [],
"open": [],
"close": []
}
},
"female_hand": {
"sheet": {
"frames": 3,
"frame_width": 900,
"frame_height": 600
},
"sequences": {
"idle": {"frames": [0, 1, 2], "durations": [10, 10, 20] }
},
"transforms": {
"basic": {
"min_x": 1.0,
"min_y": 1.0,
"max_x": 1.0,
"max_y": 1.0,
"flipped": false,
"scaled": false,
"toggled": true,
"looped": false,
"relative": false,
"easing": "none",
"motion": "move_none"
}
},
"forms": {
"idle": ["idle", "basic"]
},
"sounds": {
"idle": []
}
}
}

163
assets/cameras.json Normal file
View file

@ -0,0 +1,163 @@
{
"scene": {
"sheet": {
"frames": 1,
"frame_width": 1024,
"frame_height": 768
},
"sequences": {
"idle": {"frames": [0], "durations": [60] },
"pan": {"frames": [0], "durations": [60] },
"shake": {"frames": [0], "durations": [60] },
"dolly": {"frames": [0], "durations": [60] },
"bounce": {"frames": [0], "durations": [60] }
},
"transforms": {
"pan": {
"min_x": 0.0,
"min_y": 0.0,
"max_x": 0.0,
"max_y": 0.0,
"flipped": false,
"scaled": false,
"toggled": false,
"looped": true,
"easing": "linear",
"relative": false,
"motion": "move_slide"
},
"shake": {
"min_x": -10.0,
"min_y": -10.0,
"max_x": 10.0,
"max_y": 10.0,
"flipped": false,
"scaled": false,
"toggled": false,
"looped": true,
"relative": true,
"easing": "normal_dist",
"motion": "move_shake"
},
"dolly": {
"min_x": 0.8,
"min_y": 0.8,
"max_x": 1.0,
"max_y": 1.0,
"flipped": false,
"scaled": false,
"toggled": false,
"looped": true,
"easing": "sine",
"relative": true,
"motion": "move_rush"
},
"bounce": {
"min_x": 0,
"min_y": -20,
"max_x": 0,
"max_y": 0,
"flipped": false,
"scaled": false,
"toggled": false,
"looped": true,
"relative": true,
"easing": "in_out_back",
"motion": "move_bounce"
}
},
"forms": {
"idle": ["idle", "idle"],
"pan": ["pan", "pan"],
"dolly": ["dolly", "dolly"],
"shake": ["shake", "shake"],
"bounce": ["bounce", "bounce"]
},
"sounds": {
"idle": [],
"pan": [],
"dolly": [],
"shake": [],
"bounce": []
}
},
"story": {
"sheet": {
"frames": 1,
"frame_width": 1024,
"frame_height": 768
},
"sequences": {},
"transforms": {
"pan": {
"min_x": 0.0,
"min_y": 0.0,
"max_x": 0.0,
"max_y": 0.0,
"flipped": false,
"scaled": false,
"toggled": false,
"looped": false,
"easing": "linear",
"relative": false,
"motion": "move_slide"
},
"shake": {
"min_x": -10.0,
"min_y": -10.0,
"max_x": 10.0,
"max_y": 10.0,
"flipped": false,
"scaled": false,
"toggled": false,
"looped": false,
"relative": true,
"easing": "normal_dist",
"motion": "move_shake"
},
"dolly": {
"min_x": 0.8,
"min_y": 0.8,
"max_x": 1.0,
"max_y": 1.0,
"flipped": false,
"scaled": false,
"toggled": false,
"looped": false,
"easing": "sine",
"relative": true,
"motion": "move_rush"
},
"bounce": {
"min_x": 0,
"min_y": -20,
"max_x": 0,
"max_y": 0,
"flipped": false,
"scaled": false,
"toggled": false,
"looped": false,
"relative": true,
"easing": "in_out_back",
"motion": "move_bounce"
},
"pause": {
"min_x": 0,
"min_y": 0,
"max_x": 0,
"max_y": 0,
"flipped": false,
"scaled": false,
"toggled": false,
"looped": false,
"relative": false,
"easing": "none",
"motion": "move_none"
}
},
"forms": {},
"sounds": {
"idle": []
}
}
}

117
assets/config.json Normal file
View file

@ -0,0 +1,117 @@
{
"sounds": {
"Sword_Hit_1": "assets/sounds/Creature_Sounds-Sword_Hit_1.ogg",
"Evil_Eye_Sound_1": "assets/sounds/Creature_Sounds-Evil_Eye_Sound_1.ogg",
"Evil_Eye_Sound_2": "assets/sounds/Creature_Sounds-Evil_Eye_Sound_2.ogg",
"Giant_Voice_1": "assets/sounds/Creature_Sounds-Giant_Voice_1.ogg",
"Medium_Rat": "assets/sounds/Creature_Sounds-Medium_Rat.ogg",
"Ranger_1": "assets/sounds/Creature_Sounds-Ranger_1.ogg",
"Small_Rat": "assets/sounds/Creature_Sounds-Small_Rat.ogg",
"Spider_1": "assets/sounds/Creature_Sounds-Spider_1.ogg",
"Spider_2": "assets/sounds/Creature_Sounds-Spider_2.ogg",
"Sword_Hit_1": "assets/sounds/Creature_Sounds-Sword_Hit_1.ogg",
"Sword_Hit_2": "assets/sounds/Creature_Sounds-Sword_Hit_2.ogg",
"walk": "assets/sounds/Creature_Sounds-Walk.ogg",
"Creature_Death_1": "assets/sounds/Creature_Sounds-Creature_Death_1.ogg",
"Humanoid_Death_1": "assets/sounds/Creature_Sounds-Humanoid_Death_1.ogg",
"Marmot_Scream_1": "assets/sounds/Creature_Sounds-Marmot_Scream_1.ogg",
"blank": "assets/sounds/blank.ogg",
"pickup": "assets/sounds/pickup.ogg",
"ambient_1": "assets/sounds/ambient_1.ogg",
"ui_click": "assets/sounds/ui_click.ogg",
"ui_hover": "assets/sounds/ui_hover.ogg",
"punch_cartoony": "assets/sounds/punch_cartoony.ogg",
"electric_shock_01": "assets/sounds/electric_shock_01.ogg",
"fireball_01": "assets/sounds/fireball_01.ogg",
"hp_status_80": "assets/sounds/hp_status_80.ogg",
"hp_status_60": "assets/sounds/hp_status_60.ogg",
"hp_status_30": "assets/sounds/hp_status_30.ogg",
"hp_status_10": "assets/sounds/hp_status_10.ogg",
"hp_status_00": "assets/sounds/hp_status_00.ogg"
},
"sprites": {
"rat_with_sword":
{"path": "assets/sprites/rat_with_sword.png",
"frame_width": 256,
"frame_height": 256
},
"torch_crappy":
{"path": "assets/items/torch_crappy.png",
"frame_width": 256,
"frame_height": 256
},
"torch_horizontal_floor":
{"path": "assets/items/torch_horizontal_floor.png",
"frame_width": 256,
"frame_height": 256
},
"peasant_girl":
{"path": "assets/sprites/peasant_girl_2.png",
"frame_width": 256,
"frame_height": 256
},
"healing_potion_small":
{"path": "assets/items/healing_potion_small.png",
"frame_width": 256,
"frame_height": 256
},
"well_down":
{"path": "assets/sprites/well_down.png",
"frame_width": 256,
"frame_height": 256
},
"dead_body":
{"path": "assets/sprites/dead_body.png",
"frame_width": 256,
"frame_height": 256
},
"door_plain":
{"path": "assets/doors/door_plain.png",
"frame_width": 256,
"frame_height": 256
},
"dead_body_lootable":
{"path": "assets/sprites/dead_body_lootable.png",
"frame_width": 256,
"frame_height": 256
},
"peasant_girl":
{"path": "assets/sprites/peasant_girl_2.png",
"frame_width": 256,
"frame_height": 256
},
"female_hand":
{"path": "assets/hands/female_hand.png",
"frame_width": 900,
"frame_height": 600
}
},
"worldgen": {
"enemy_probability": 50,
"device_probability": 10
},
"graphics": {
"smooth_textures": false
},
"compass": {
"N": 65514,
"NE": 8663,
"E": 8594,
"SE": 8600,
"S": 65516,
"SW": 8665,
"W": 8592,
"NW": 8598
},
"theme": {
"NOTE": "colors are in assets/palette.json",
"padding": 3,
"border_px": 1,
"text_size": 20,
"label_size": 20,
"font_file_name": "assets/text.otf"
},
"player": {
"hands": "female_hand"
}
}

46
assets/devices.json Normal file
View file

@ -0,0 +1,46 @@
{
"STAIRS_DOWN": {
"id": "STAIRS_DOWN",
"name": "Stairs Down",
"placement": "fixed",
"description": "Stairs that go down further into the dungeon.",
"inventory_count": 0,
"randomized": false,
"components": [
{"_type": "Tile", "display": 6105,
"foreground": "devices/fg:stairs_down",
"background": "devices/bg:stairs_down"
},
{"_type": "Device",
"config": {},
"events": ["STAIRS_DOWN"]},
{"_type": "Sprite", "name": "well_down", "width": 256, "height": 256, "scale": 1.0}
]
},
"DEAD_BODY_LOOTABLE": {
"id": "DEAD_BODY_LOOTABLE",
"name": "Grave Stone",
"description": "Something died here. Was this your doing?",
"components": [
{"_type": "Tile", "display": 1890,
"foreground": "devices/fg:dead_body_lootable",
"background": "devices/bg:dead_body_lootable"
},
{"_type": "Device", "config": {}, "events": ["LOOT_CONTAINER"]},
{"_type": "Sprite", "name": "dead_body_lootable", "width": 256, "height": 256, "scale": 1.0},
{"_type": "Sound", "attack": "pickup", "death": "blank"}
]
},
"DEAD_BODY": {
"id": "DEAD_BODY",
"name": "Something Dead",
"description": "You can't loot this, weirdo.",
"components": [
{"_type": "Tile", "display": 1939,
"foreground": "devices/fg:dead_body",
"background": "devices/bg:dead_body"
},
{"_type": "Sprite", "name": "dead_body", "width": 256, "height": 256, "scale": 1.0}
]
}
}

32
assets/enemies.json Normal file
View file

@ -0,0 +1,32 @@
{
"PLAYER_TILE": {
"placement": "fixed",
"components": [
{"_type": "Tile", "display": 10733,
"foreground": "enemies/fg:player",
"background": "color:transparent"
},
{"_type": "Combat", "hp": 200, "max_hp": 200, "ap": 0, "max_ap": 12, "ap_delta": 6, "damage": 50, "dead": false},
{"_type": "Motion", "dx": 0, "dy": 0, "random": false},
{"_type": "Collision", "has": true},
{"_type": "EnemyConfig", "ai_script": "Host::actions", "ai_start_name": "Host::initial_state", "ai_goal_name": "Host::final_state"},
{"_type": "Personality", "hearing_distance": 5, "tough": false},
{"_type": "LightSource", "strength": 35, "radius": 2.0}
]
},
"RAT_GIANT": {
"components": [
{"_type": "Tile", "display": 2220,
"foreground": "enemies/fg:rat_giant",
"background": "color:transparent"
},
{"_type": "Combat", "hp": 50, "max_hp": 50, "ap": 0, "max_ap": 12, "ap_delta": 6,"damage": 2, "dead": false},
{"_type": "Collision", "has": true},
{"_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": "Personality", "hearing_distance": 5, "tough": false},
{"_type": "Sprite", "name": "rat_with_sword", "scale": 1.0},
{"_type": "Sound", "attack": "Small_Rat", "death": "Creature_Death_1"}
]
}
}

12
assets/icons.json Normal file
View file

@ -0,0 +1,12 @@
{
"healing_potion_small":
{"path": "assets/icons/healing_potion_small.png",
"frame_width": 96,
"frame_height": 96
},
"torch_horizontal_floor":
{"path": "assets/icons/torch_horizontal_floor.png",
"frame_width": 96,
"frame_height": 96
}
}

32
assets/items.json Normal file
View file

@ -0,0 +1,32 @@
{
"TORCH_BAD": {
"id": "TORCH_BAD",
"name": "Crappy Torch",
"description": "A torch that barely lights the way. You wonder if it'd be better to not see the person who murders you.",
"inventory_count": 1,
"components": [
{"_type": "LightSource", "strength": 50, "radius": 2.5},
{"_type": "Tile", "display": 3848,
"foreground": "items/fg:flame",
"background": "color:transparent"
},
{"_type": "Sprite", "name": "torch_horizontal_floor", "width": 256, "height": 256, "scale": 1.0},
{"_type": "Sound", "attack": "pickup", "death": "blank"}
]
},
"POTION_HEALING_SMALL": {
"id": "POTION_HEALING_SMALL",
"name": "Small Healing Potion",
"description": "A small healing potion.",
"inventory_count": 1,
"components": [
{"_type": "Tile", "display": 1003,
"foreground": "items/fg:potion",
"background": "color:transparent"
},
{"_type": "Curative", "hp": 20},
{"_type": "Sprite", "name": "healing_potion_small", "width": 256, "height": 256, "scale": 1.0},
{"_type": "Sound", "attack": "pickup", "death": "blank"}
]
}
}

146
assets/map_tiles.json Normal file
View file

@ -0,0 +1,146 @@
[
{
"centered": false,
"display": 35,
"x": 0,
"y": 0
},
{
"centered": false,
"display": 8284,
"x": 64,
"y": 0
},
{
"centered": false,
"display": 11590,
"x": 128,
"y": 0
},
{
"centered": false,
"display": 10899,
"x": 192,
"y": 0
},
{
"centered": false,
"display": 9256,
"x": 256,
"y": 0
},
{
"centered": false,
"display": 9608,
"x": 320,
"y": 0
},
{
"centered": false,
"display": 10747,
"x": 384,
"y": 0
},
{
"centered": false,
"display": 8285,
"x": 448,
"y": 0
},
{
"centered": true,
"display": 1003,
"x": 512,
"y": 0
},
{
"centered": true,
"display": 3848,
"x": 576,
"y": 0
},
{
"centered": true,
"display": 85,
"x": 0,
"y": 64
},
{
"centered": true,
"display": 1939,
"x": 64,
"y": 64
},
{
"centered": true,
"display": 1890,
"x": 128,
"y": 64
},
{
"centered": true,
"display": 8687,
"x": 192,
"y": 64
},
{
"centered": true,
"display": 6105,
"x": 256,
"y": 64
},
{
"centered": true,
"display": 8793,
"x": 320,
"y": 64
},
{
"centered": true,
"display": 95,
"x": 384,
"y": 64
},
{
"centered": true,
"display": 1898,
"x": 448,
"y": 64
},
{
"centered": true,
"display": 42586,
"x": 512,
"y": 64
},
{
"centered": true,
"display": 2216,
"x": 576,
"y": 64
},
{
"centered": true,
"display": 10733,
"x": 0,
"y": 128
},
{
"centered": true,
"display": 2220,
"x": 64,
"y": 128
},
{
"centered": true,
"display": 1218,
"x": 128,
"y": 128
},
{
"centered": true,
"display": 1087,
"x": 128,
"y": 128
}
]

61
assets/palette.json Normal file
View file

@ -0,0 +1,61 @@
{
"color": {
"transparent": [100, 100, 100, 100],
"BAD": [255, 0, 0]
},
"gui/theme": {
"black": [0, 0, 0, 255],
"dark_dark": [10, 10, 10, 255],
"dark_mid": [30, 30, 30, 255],
"dark_light": [60, 60, 60, 255],
"mid": [100, 100, 100, 255],
"light_dark": [150, 150, 150, 255],
"light_mid": [200, 200, 200, 255],
"light_light": [230, 230, 230, 255],
"white": [255, 255, 255, 255],
"fill_color": "gui/theme:dark_mid",
"text_color": "gui/theme:light_light",
"bg_color": "gui/theme:mid",
"border_color": "gui/theme:dark_dark",
"bg_color_dark": "gui/theme:black"
},
"map/theme": {
"black": [0, 0, 0, 255],
"dark_dark": [10, 10, 10, 255],
"dark_mid": [30, 30, 30, 255],
"dark_light": [60, 60, 60, 255],
"mid": [100, 100, 100, 255],
"light_dark": [150, 150, 150, 255],
"light_mid": [200, 200, 200, 255],
"light_light": [230, 230, 230, 255],
"white": [255, 255, 255, 255]
},
"items/fg": {
"flame": "map/theme:white",
"potion": "map/theme:white"
},
"enemies/fg": {
"player": "map/theme:white",
"rat_giant": "map/theme:white"
},
"tiles/fg": {
"floor_tile": "map/theme:mid",
"wall_plain": "map/theme:dark_mid",
"ceiling_black": "color:transparent"
},
"tiles/bg": {
"floor_tile": "map/theme:dark_dark",
"wall_plain": "map/theme:dark_dark",
"ceiling_black": "color:transparent"
},
"devices/fg": {
"stairs_down": [24, 205, 189],
"dead_body": [32, 123, 164],
"dead_body_lootable": [32, 123, 164]
},
"devices/bg": {
"stairs_down": [24, 205, 189],
"dead_body": [24, 205, 189],
"dead_body_lootable": [24, 205, 189]
}
}

7
assets/room_themes.json Normal file
View file

@ -0,0 +1,7 @@
[
{
"name": "Plain",
"floor": "floor_tile",
"walls": "wall_plain"
}
]

26
assets/shaders.json Normal file
View file

@ -0,0 +1,26 @@
{
"ui_shader": {
"file_name": "assets/shaders/ui_shader.frag",
"type": "fragment"
},
"ERROR": {
"file_name": "assets/shaders/ui_error.frag",
"type": "fragment"
},
"rayview_sprites": {
"file_name": "assets/shaders/rayview_sprites.frag",
"type": "fragment"
},
"flame": {
"file_name": "assets/shaders/flame_trash.frag",
"type": "fragment"
},
"lightning": {
"file_name": "assets/shaders/lightning_attack.frag",
"type": "fragment"
},
"boss_hit": {
"file_name": "assets/shaders/flame_trash.frag",
"type": "fragment"
}
}

View file

@ -0,0 +1,79 @@
#version 120
uniform vec2 u_resolution;
uniform float u_time;
uniform sampler2D source;
uniform float u_mouse;
uniform float value = 0.2;
uniform int octaves=8;
float random (in vec2 st) {
return fract(sin(dot(st.xy,
vec2(12.9898,78.233)))*
43758.5453123);
}
float noise(in vec2 st) {
vec2 i = floor(st);
vec2 f = fract(st);
float a = random(i);
float b = random(i + vec2(1.0, 0.0));
float c = random(i + vec2(0.0, 1.0));
float d = random(i + vec2(1.0, 1.0));
vec2 u = f * f * (3.0 - 2.0 * f);
return mix(a, b, u.x) +
(c - a) * u.y * (1.0 - u.x) +
(d - b) * u.x * u.y;
}
float fbm(in vec2 st) {
float v = 0.0;
float a = 0.5;
vec2 shift = vec2(100.0);
mat2 rot = mat2(cos(0.5), sin(0.5),
-sin(0.5), cos(0.5));
for(int i = 0; i < octaves; i++) {
v += a * noise(st);
st = rot * st * 2.0 + shift;
a *= 0.5;
}
return v;
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution.xy * 3.0;
vec3 color = vec3(0.0);
float speed = u_time * 10.0;
float value = 0.8; // cos(u_time) * cos(u_time);
vec2 q = vec2(0.0);
q.x = fbm(st + 0.00 * speed);
q.y = fbm(st + vec2(1.0));
vec2 r = vec2(0,0);
r.x += fbm( st + 1.0*q + vec2(1.0, 0.0)+ 0.15* speed );
r.y += fbm( st + 1.0*q + vec2(-1.0, 0.0)+ 0.126* speed);
float f = fbm(st * r);
color = mix(vec3(0.666667,0.619608, 0.122777),
vec3(0.666667,0.666667,0.498039),
clamp((f*f)*4.0,0.0,1.0));
color = mix(color,
vec3(0.666667, 0.122222, 0.0666667),
clamp(length(r.x), 0.0, 1.0));
color *= (f*f*f+0.5*f*f+0.6*f) * value;
vec4 pixel = texture2D(source, gl_TexCoord[0].xy);
float mask = color.r * pixel.a;
gl_FragColor = gl_Color * vec4(color, mask) + pixel;
}

View file

@ -0,0 +1,79 @@
#version 120
uniform vec2 u_resolution;
uniform float u_time;
uniform sampler2D source;
uniform float u_mouse;
uniform float value = 0.2;
uniform int octaves=8;
float random (in vec2 st) {
return fract(sin(dot(st.xy,
vec2(12.9898,78.233)))*
43758.5453123);
}
float noise(in vec2 st) {
vec2 i = floor(st);
vec2 f = fract(st);
float a = random(i);
float b = random(i + vec2(1.0, 0.0));
float c = random(i + vec2(0.0, 1.0));
float d = random(i + vec2(1.0, 1.0));
vec2 u = f * f * (3.0 - 2.0 * f);
return mix(a, b, u.x) +
(c - a) * u.y * (1.0 - u.x) +
(d - b) * u.x * u.y;
}
float fbm(in vec2 st) {
float v = 0.0;
float a = 0.5;
vec2 shift = vec2(100.0);
mat2 rot = mat2(cos(0.5), sin(0.5),
-sin(0.5), cos(0.5));
for(int i = 0; i < octaves; i++) {
v += a * noise(st);
st = rot * st * 2.0 + shift;
a *= 0.5;
}
return v;
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution.xy * 3.0;
vec3 color = vec3(0.0);
float speed = u_time * 40.0;
float value = cos(u_time) * cos(u_time);
vec2 q = vec2(0.0);
q.x = fbm(st + 0.00 * speed);
q.y = fbm(st + vec2(1.0));
vec2 r = vec2(0,0);
r.x += fbm( st + 1.0*q + vec2(1.0, 0.0)+ 0.15* speed );
r.y += fbm( st + 1.0*q + vec2(-1.0, 0.0)+ 0.126* speed);
float f = fbm(st / r);
color = mix(vec3(0.122777,0.619608, 0.666667),
vec3(0.498039,0.666667,0.666667),
clamp((f*f)*4.0,0.0,1.0));
color = mix(color,
vec3(0.0666667, 0.122222, 0.666667),
clamp(length(r.x), 0.0, 1.0));
color *= (f*f*f+0.5*f*f+0.6*f) * value;
vec4 pixel = texture2D(source, gl_TexCoord[0].xy);
float mask = color.r * pixel.a;
gl_FragColor = gl_Color * vec4(color, mask) + pixel;
}

View file

@ -0,0 +1,25 @@
uniform sampler2D source;
uniform sampler2D bloom;
uniform vec2 offsetFactor;
uniform float darkness;
void main()
{
vec2 textureCoordinates = gl_TexCoord[0].xy;
vec4 color = vec4(0.0);
color += texture2D(source, textureCoordinates - 4.0 * offsetFactor) * 0.0162162162;
color += texture2D(source, textureCoordinates - 3.0 * offsetFactor) * 0.0540540541;
color += texture2D(source, textureCoordinates - 2.0 * offsetFactor) * 0.1216216216;
color += texture2D(source, textureCoordinates - offsetFactor) * 0.1945945946;
color += texture2D(source, textureCoordinates) * 0.2270270270;
color += texture2D(source, textureCoordinates + offsetFactor) * 0.1945945946;
color += texture2D(source, textureCoordinates + 2.0 * offsetFactor) * 0.1216216216;
color += texture2D(source, textureCoordinates + 3.0 * offsetFactor) * 0.0540540541;
color += texture2D(source, textureCoordinates + 4.0 * offsetFactor) * 0.0162162162;
vec4 sourceFragment = texture2D(source, gl_TexCoord[0].xy);
vec4 bloomFragment = texture2D(bloom, gl_TexCoord[0].xy);
float alpha = color.a;
gl_FragColor = (color + sourceFragment - bloomFragment) * darkness;
gl_FragColor.a = alpha;
}

View file

@ -0,0 +1,18 @@
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_duration;
uniform float u_time;
uniform float u_time_end;
uniform sampler2D texture;
uniform bool is_shape;
void main() {
if(is_shape) {
vec4 color = vec4(1.0, 0.0, 0.0, 1.0);
gl_FragColor = gl_Color * color;
} else {
vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);
vec4 color = vec4(1.0, 0.0, 0.0, 1.0);
gl_FragColor = gl_Color * color * pixel;
}
}

View file

@ -0,0 +1,29 @@
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_duration;
uniform float u_time;
uniform float u_time_end;
uniform sampler2D texture;
uniform bool is_shape;
uniform bool hover;
vec4 blink() {
if(hover) {
return vec4(0.95, 0.95, 1.0, 1.0);
} else {
float tick = (u_time_end - u_time) / u_duration;
float blink = mix(0.5, 1.0, tick);
return vec4(blink, blink, blink, 1.0);
}
}
void main() {
vec4 color = blink();
if(!is_shape) {
vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);
color *= pixel;
}
gl_FragColor = gl_Color * color;
}

View file

@ -0,0 +1,12 @@
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_duration;
uniform float u_time;
uniform float u_time_end;
void main() {
float tick = (u_time_end - u_time) / u_duration;
float blink = smoothstep(1.0, 0.5, tick);
vec4 color = vec4(blink, blink, blink, 1.0);
gl_FragColor = gl_Color * color;
}

36
assets/tiles.json Normal file
View file

@ -0,0 +1,36 @@
{
"floor_tile": {
"texture": "assets/textures/floor_gray_stone.png",
"display": 8284,
"ceiling": "ceiling_black",
"light": 0,
"foreground": "tiles/fg:floor_tile",
"background": "tiles/bg:floor_tile",
"id": 0
},
"wall_plain": {
"texture": "assets/textures/wall_plain.png",
"display": 9608,
"light": 0,
"door": "door_plain",
"foreground": "tiles/fg:wall_plain",
"background": "tiles/bg:wall_plain",
"id": 1
},
"ceiling_black": {
"texture": "assets/textures/ceiling_black.png",
"display": 35,
"light": 0,
"foreground": "tiles/fg:ceiling_black",
"background": "tiles/bg:ceiling_black",
"id": 2
},
"door_plain": {
"texture": "assets/doors/door_plain.png",
"display": 1087,
"light": 10,
"foreground": "tiles/fg:wall_plain",
"background": "tiles/bg:wall_plain",
"id": 8
}
}