Commit Graph

18 Commits

Author SHA1 Message Date
9d2a2f4195 [Fix] Separate single-player and multiplayer ports. 2025-10-04 05:20:50 +01:00
666b4f554b [Add] File loading and fix local 'exit' command. 2025-10-01 21:38:33 +01:00
ebd1e222d7 [Add] File saving for the fancy new text editor. 2025-09-30 21:37:24 +01:00
cf48324516 [Refactor] Givin' the client some luv!
Refactored client-side rendering code to use a Color struct rather than
raw float arrays.
2025-09-27 22:58:04 +01:00
c052cf3cbf [Fix] Implement destructors preventing memleaks.
Fixes a bunch of memleaks related to the new Machine and VFS
architecture.

The Machine and vfs_node objects were created with 'new' but were never
properly destroyed, leading to memleaks during CoW operations and on
server shutdown.

- Added a recursive 'delete_vfs_tree' function
- Machine destructor calls this function to lean up its VFS
- CommandProcessor correctly deletes old Machine objects after a CoW
- Player destructor cleans up the player's home machine.
- NetworkManager destructor cleans up all world machines.
2025-09-27 22:18:13 +01:00
59783d2408 [Refactor] :O Machines now walk the earth!!
Old vfs_node was getting a bit big for its boots, trying to be a
filesystem, network interface and the whole damn computer all at once.

This server-side refactor introduces a 'Machine' class that rightfully
owns the VFS, network services and other machine-state sh.t.
2025-09-27 17:30:14 +01:00
fde6879720 [Add] Implement nmap network scanner. 2025-09-27 00:13:56 +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
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
274ff9f665 [Fix] SDL3_net has no official release. Use main branch. 2025-09-21 17:04:41 +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
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
01e6d432a4 [Add] Initial project structure. 2025-09-20 01:03:03 +01:00