--- /dev/null
+{
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "Attach",
+ "type": "onyx",
+ "request": "attach",
+ "socketPath": "/tmp/ovm-debug.0000",
+ "stopOnEntry": true,
+ "debugServer": 5876
+ },
+ {
+ "name": "Launch",
+ "type": "onyx",
+ "request": "launch",
+ "wasmFile": "game.wasm",
+ "workingDir": "${workspaceFolder}/run_tree",
+ "stopOnEntry": true,
+ "preLaunchTask": "Build Game"
+ },
+ {
+ "name": "Launch Server",
+ "type": "onyx",
+ "request": "launch",
+ "wasmFile": "server.wasm",
+ "workingDir": "${workspaceFolder}/server",
+ "stopOnEntry": true
+ }
+ ]
+}
"kind": "build",
"isDefault": true
}
+ },
+ {
+ "label": "Build Game",
+ "type": "shell",
+ "problemMatcher": "$onyx",
+ "options": {
+ "cwd": "${workspaceFolder}/run_tree",
+ "shell": {
+ "executable": "/bin/sh",
+ "args": ["-c"]
+ }
+ },
+ "presentation": {
+ "echo": true,
+ "reveal": "silent",
+ "focus": false,
+ "panel": "shared",
+ "showReuseMessage": false,
+ "clear": false
+ },
+ "windows": {
+ "command": "run.bat",
+ },
+ "linux": {
+ "command": "./run.sh",
+ "args": ["build", "--debug"]
+ },
+ "group": {
+ "kind": "build",
+ "isDefault": true
+ }
}
]
}
\ No newline at end of file
--- /dev/null
+
+* TODO Add pick-up-able items (guns, ammo, etc.)
+
+* TODO Add UI (hotbar, current item, etc.)
+
+* TODO Separate client and server with current code
+++ /dev/null
-Subproject commit 97c1582fda5f2881588a1fc0296ba9401af8bb7e
-onyx -V build -I ../src/client -o game.wasm $@ && onyx-run game.wasm
+case "$1" in
+ build) onyx -V build -I ../src/client -o game.wasm $@ ;;
+ debug) onyx-run --debug game.wasm ;;
+ *) onyx-run game.wasm ;;
+esac
#!/bin/sh
-onyx -V build -I ../src/server -o server.wasm $@ && onyx-run server.wasm
\ No newline at end of file
+case "$1" in
+ build) onyx -V build -I ../src/server -o server.wasm $@ ;;
+ debug) onyx-run --debug server.wasm ;;
+ *) onyx-run server.wasm ;;
+esac
world_shader: Shader;
chat_font: Font;
-
+
fog_color :: Vector3.{ 0.6, 0.6, 0.6 };
}
font: Font;
player: Player;
world: ^World;
-player_manager: ^Player_Manager;
+player_manager: ^Player_Manager
selected_block: Vector3i;
player_shader: Shader;
}
#local {
- send_movement_timeout := 0.0f;
+ send_movement_timeout := 0.0f;
}
use core
-use core.intrinsics.onyx {__zero_value}
use stb_truetype
use opengles
ttf_file := os.get_contents(fd.path);
if ttf_file.count == 0 {
println("Bad font");
- return __zero_value(Font);
+ return .{};
}
defer cfree(ttf_file.data);
use core
-use core.intrinsics.onyx { __zero_value as Zero }
use opengles
use stb_image
pixels := stbi_load(path, ^tex.width, ^tex.height, ^tex.channels, 4);
if pixels == null {
debug_log(.Warning, "Failed to load texture: {}", filename);
- return Zero(Texture), false;
+ return .{}, false;
}
defer stbi_image_free(pixels);
}
map.clear(^texture_cache);
-}
\ No newline at end of file
+}
-@GlobalVariable window: glfw3.GLFWwindow_p;
+use glfw3 { GLFWwindow_p }
+@GlobalVariable window: GLFWwindow_p;
debug_screen := false;
State :: struct {
data: rawptr;
- init: (rawptr) -> void = null_proc;
- deinit: (rawptr) -> void = null_proc;
- enter: (rawptr, ^State) -> void = null_proc;
- leave: (rawptr) -> void = null_proc;
- update: (rawptr, dt: f32) -> void = null_proc;
- draw: (rawptr) -> void = null_proc;
+ init: (rawptr) -> void;
+ deinit: (rawptr) -> void;
+ enter: (rawptr, ^State) -> void;
+ leave: (rawptr) -> void;
+ update: (rawptr, dt: f32) -> void;
+ draw: (rawptr) -> void;
}
#local state_stack: [..] State;
world_make :: (allocator := context.allocator) -> ^World {
world := new(World, allocator);
- world.chunk_dist = 2;
+ world.chunk_dist = 1;
world.center_chunk = .{0,0,0};
sl := world.chunk_dist * 2 + 1;
package runtime.vars
-Enable_Heap_Debug :: true
+// Enable_Heap_Debug :: true
Game_Version :: 0x0001
Game_Port :: cast(u16) 5123
name: str;
peer: ^onet.Peer;
- position: Vector3 = .{0,0,0};
- velocity: Vector3 = .{0,0,0};
- facing: Vector3 = .{0,0,0};
- on_ground := false;
+ position: Vector3;
+ velocity: Vector3;
+ facing: Vector3;
+ on_ground: bool;
}
max_connected_players := 8;