Commit Graph

39 Commits

Author SHA1 Message Date
5f648440c5 [Add] Implement file I/O and remote CoW. 2025-09-26 23:50:01 +01:00
a80764a70e [Add] Implemented 'cat' command 2025-09-26 21:45:40 +01:00
bb17cf3473 [Add] Implement remote sessions and server exit. 2025-09-26 21:32:08 +01:00
c7e8d97c63 [Add] Add back the SSH functionality. 2025-09-25 23:05:21 +01:00
6272800a22 [Refactor] Migrate networking from SDL_net to Asio.
the SDL3_net implementation was causing blocking behaviour and was
difficult to debug and has bad docs due to not being released. Caused
crashes all over. so moved to Asio. This thing took so damn long as this
also had it's issues!

- All networking now uses Asio's async callback model.
- TcpConnection class encapsulates logic for a single client-server
  connection, managing socket and message framing.
- Implmented thread-safe queues for handling incoming and outgoing
  messages between the network thread and the main application.
- Refactored ClientNetwork and NetworkManager, the primary client and
  server networking classes have been rewritten to use the new
asio-based architecture.
- Player objects on the server are not managed by std::unique_ptr to
  ensure proper lifetime management and prevent memleaks.
- VFSManager is now a single instance on the server, passed by reference
  to new players, avoding redundant script loading for every connection.
- Resolved server crash that occured immediately upon client connection.
  This was traced to an object lifetime issue within Asio's async
handlers which was fixed by simplifying the send operation.
2025-09-25 22:41:01 +01:00
388c6429cf [Change] Remove hybrid local/remote network model
Client architecture has been refactored to be fully
server-authoritative, remove the previous "hybrid" model that supported
both local and remote command execution, that was a stupid idea.

- Client now connects to server on startup.
- The local command processor and VFS have been removed from the
  Terminal class.
- All command processing is now handled by the server.
- The client is now just a thin client essentially

I'll in the future enable single player mode by running the server on
the local machine in a separate thread.
2025-09-23 20:54:39 +01:00
a502fa64cf [Add] Load command scripts from filesystem. 2025-09-22 19:24:44 +01:00
cb6022116a Just a quick whitespace cleanup. 2025-09-21 23:57:51 +01:00
267d2477de [Add] Implemented Copy-on-Write and scriptable rm.
OK, this commit finally implements the Copy-on-Write architecure I spoke
about in previous commits.. It also refactors command execution to be
safer and more extensible.

To enable CoW and centralise state-changing, command scripts no longer
modify the VFS directly. Instead, they return a table describing their
intended action '{ action = "rm", target = "file.txt" }'. The C++
CommandProcessor is then responsible for interpreting this and executing
it safely.
2025-09-21 23:52:36 +01:00
b30c497769 [Add] CoW foundation and scriptable rm command.
Putting down the nessassary steps for the Copy-on-Write described in the
previous commit. Implemented the first script based write command, 'rm'
2025-09-21 22:39:16 +01:00
ea0605711d [Refactor] Shared VFS template for CoW foundation.
Refactors the Virtual file System creation process to improve memory
efficiency at scale. This is laying the ground work for a copy-on-write
system.

Previously, each new VFS instance was a full copy, which won't scale to
a large number of NPC's. Especially now that we are loading in entire
Lua scripts.

- Added VFSManager class which now manages the lifecycle of all VFS
  instances.
- VFSManager creates a single "template" VFS on initilisation. The
  template holds the shared, read-only directories like '/bin' and their
command scripts.
- When a new VFS is created (for a client or NPC), it links it's 'bin'
  directory to the shared template's '/bin' by pointer rather than
creating a copy of it.

this makes sure the content for *all* common command scripts exists in
memory only once, regardless of the number of NPC's we will later
generate.
2025-09-21 21:50:06 +01:00
62d5f0526f [Add] Implemented Lua command execution engine.
Replacing hardcoded c++ 'ls' command with a generic system that finds and
runs Lua scripts from the virual file system.
2025-09-21 20:42:25 +01:00
fbf70c43b3 [Add] Embedded Lua scripting language.
Over the past couple of commits, the build process now automates the
dependenices you'd normally compile from source.
This commit is focused on laying the foundation for scriptable in-game
commands using Lua.

- sol2 and lua5.4 are the new project dependencies.
- Created a new 'LuaProcessor' class to manage a Lua state and eecute
  scripts.
- The 'CommandProcessor' now contains a 'LuaProcessor' instance.
- Replaced the hardcoded c++ 'ls' command with a system that executes a
  '/bin/ls.lua' script from the Virtual File System.
- Implemented C++ -> Lua bindings for the 'vfs_node' struct, allowing
  Lua scripts to inspect the VFS and perform actions (i.e, list files).
2025-09-21 20:13:43 +01:00
76e61336a1 Fix some fucking weird quirk in a Fedora VM. 2025-09-21 17:30:22 +01:00
03b56b44e4 Explicitly tell linker where to find SDL3_net 2025-09-21 17:10:04 +01:00
274ff9f665 [Fix] SDL3_net has no official release. Use main branch. 2025-09-21 17:04:41 +01:00
019059e209 [Add] Dependency management to build system. 2025-09-21 16:36:45 +01:00
208314f54a [Add] Remote SSH sessions and window management.
This is the beginning of the remote session functionality. It allows
players to connect to different NPC systems via an 'ssh' command.

*Server*
- Can now manage a world of multiple NPC file systems that are
  identified by IP addresses.
- Implemented SSH command to allow connection to remote NPC systems.
  Each remote session is managed via a 'CommandProcessor'.
- 'exit' command causes the remote server to terminate the client
  connection

*Client*
- Terminal can enter a 'remote' state via the SSH command which sends
  subsequent commands to the server.
- the local 'exit' command will close the terminal window.
- Refactored UI object ownership to prevent memory leaks and ensure
  proper cleanup when a window is closed or the terminal application.
2025-09-21 15:22:35 +01:00
0c4a98a03d Fine!! Stupid gitea not recognising orgmode lists. 2025-09-21 01:43:15 +01:00
aae4421819 [Fix] Fix README markdown on git instance? 2025-09-21 01:41:47 +01:00
7376761d36 [Change] Updated README with roadmap. 2025-09-21 01:37:34 +01:00
a73aa4feaf Create hybrid authority model for command processing. 2025-09-21 00:22:04 +01:00
dbe6e437ad [Add] Process cd and ls commands. 2025-09-20 22:23:04 +01:00
92106a3c44 [Add] Client/server networking and 'ls' command. 2025-09-20 18:58:24 +01:00
70f096abc4 [Add] Bound-checked terminal scrolling. 2025-09-20 15:51:55 +01:00
846b8595f4 [Add] Blinking terminal cursor. 2025-09-20 14:13:36 +01:00
2d79aba17a [Add] Window focus and event routing. 2025-09-20 14:05:00 +01:00
8a902d3034 [Add] Desktop and draggable UI windows. 2025-09-20 13:48:12 +01:00
1bce18e993 [Change] Render terminal conte in UI window. 2025-09-20 13:06:13 +01:00
a0c5eab1cf [Add] Implement basic UI windowing system. 2025-09-20 12:30:57 +01:00
92b5f54dbb [Change] Add libfreetype-dev dependency to README 2025-09-20 03:49:52 +01:00
8cc30eaa17 [Add] Implement initial interactive terminal. 2025-09-20 03:46:38 +01:00
f86015736d [Add] Text rendering. 2025-09-20 03:16:59 +01:00
c3ebd0e501 [Add] Initialise SDL and OpenGL window. 2025-09-20 01:39:32 +01:00
3272d126fd [Fix] .gitignore typo 2025-09-20 01:19:53 +01:00
13307f4871 [Add] Generate compilation database. 2025-09-20 01:18:19 +01:00
df755ff1f1 [Add] README 2025-09-20 01:09:03 +01:00
01e6d432a4 [Add] Initial project structure. 2025-09-20 01:03:03 +01:00
53d067c0e0 Initial commit: New project direction. 2025-09-20 00:02:34 +01:00