Commit Graph

83 Commits

Author SHA1 Message Date
44ca427c0e [Add] Completed the persistance layer. 2025-10-06 20:41:22 +01:00
fce3b3aad6 [Add] Implement database persistance and Login UI.
[Build System]
- Integrate 'sqlite3' and 'sqlite_modern_cpp' using FetchContent.
- Enabled 'C' language to allow compilation of 'sqlite3' lib.

[Persistance]
- Adds a 'DatabaseManager' class to handle all SQLite operations.
- Creates a 'players' table on server startup.
- Server uses separate database for single-player 'bettola_sp.db' and
  'bettola.db'

[UI]
- Adds a new 'LoginScreen' UI.
- Game flow is now MainMenu -> LoginScreen -> bootSequence -> Desktop.
- 'LoginScreen' has interactive tabs to switch between "Login" and
  "Create Account" 'modes'.
- Full client-server communication for creating accounts and
  authentication.

[Server]
- Refactor 'NetworkManager' to handle an 'AUTHENTICATING' state for new
  connectiosn.
- Player state is only set to 'ACTIVE' after a successful login
2025-10-05 22:45:33 +01:00
564512225f [Add] Beginning of login UI and db persistance. 2025-10-05 19:52:17 +01:00
1cbf8ff0d8 [Add] Debug overlay and UI fixes.
- Real time on-screen debug overlay to display performance metrics.
  Overlay can be toggled with C-d.

[Fixed]
- Corrects a "click-through" bug by implementing Z-ordering for window
  stack.
- Decouples taskbar from window z-order to provide a stable button
  layout that isn't affected by focus changes.
- Adds culling to the terminal history view to prevent rendering
  off-screen lines.
2025-10-05 00:46:19 +01:00
d37f632344 [Refactor] Implement batched shape rendering.
This mirrors the previous refactor of the TextRenderer. All calls to
draw_rect and draw_triangle now buffer vertex data (position and color).
A begin()/flush() system is introduced to manage batching.
2025-10-05 00:44:23 +01:00
d992cb54bf [Add] Occlusion culling.
Prevents rendering of UI windows that are completely hidden by other
windows.

Desktop rendering now checks if a window is fully occluded by any single
window higher in the Z-order. If a window is determined to be hidden,
its entire render function can be skipped.

This is a pragmatic implementation that handles the most common
occlusion scenario (i.e., a maximised window). There would be little
benefit of other edge cases in the particular game I think.
2025-10-04 22:27:38 +01:00
b1392c2e6b [Fix] Regression, scissor test ending before flush. 2025-10-04 21:40:27 +01:00
8d9cd9a777 [Fix] Correct terminal auto-scroll 2025-10-04 21:37:40 +01:00
caa482a7a0 [Add] Implement delta time game loop. 2025-10-04 21:28:16 +01:00
d602a8f1d4 [Fix] Correct window event handling and Z-ordering.
Resolves a bug where mouse clicks would "pass through" the top-most
window and incorrectly trigger events on windows visually behind it.
2025-10-04 21:02:21 +01:00
69eee6da8f Reapply "[Fix] Render depth on bootsequence and main menu."
This reverts commit c7469797f0.
2025-10-04 20:58:57 +01:00
c7469797f0 Revert "[Fix] Render depth on bootsequence and main menu."
This reverts commit 90ee80d0a0.
2025-10-04 20:40:40 +01:00
90ee80d0a0 [Fix] Render depth on bootsequence and main menu. 2025-10-04 18:53:14 +01:00
c3316b3da1 [Refactor] Implement batched text rendering.
Overhauls text rendering to improve performance.

Renderer was really ineffient, sending a separate GPU draw call for
every character rendered. This created a bottleneck, especially with
text-heavy UI stuff like the wallpaper.

- The 'TextRenderer' now generates a single texture atlas for all font
  glyhs on load so all characters share a single texture.
- 'begin()' / 'flush()' was added to the 'TextRenderer'. Calls to
  'render_text' now buffer vertex data (position, texture coords,
colour) instead of drawing immediately. A single 'flush()' call at the
end of a pass draws all buffered text in one draw call.
- A simple batching introduced some shitty visual layering bugs. to
  solve this, a staged flushing architecture has been implemented. Each
logical UI component is now responsible for managing its own rendering
passes, beginning and flushing text batches as needed to ensure correct
back-to-front layering.
2025-10-04 18:32:35 +01:00
9d2a2f4195 [Fix] Separate single-player and multiplayer ports. 2025-10-04 05:20:50 +01:00
e7607e3fc0 [Refactor] Created UIRenderer for consistant coord system.
The UI codebase was suffering with complexity due to the need to
manually convert between two different coordinate systems:
- Top-down "screen coordinates" used by SDL for input and windowing.
- Bottom-up "GL coordinates" used by low-level renderers.

This was making layout calculations diffucult and is bug prone.

With this commit, I'm introducing a 'UIRenderer' abstraction layer that
wraps the low-level 'ShapeRenderer' and 'TextRenderer'. This is
responsible for centralising all coordinate system conversations.

All UI components has been refactored to use the 'UIRenderer' so the
entire UI code opeates exclusively in a single, top-down screen
coordinate system as one would expect.
2025-10-04 03:11:48 +01:00
601bc86bdc [Fix] Correct menu bar rendering and event handling. 2025-10-04 00:09:34 +01:00
a6e159f0da Menu bar for for text editor etc. 2025-10-03 23:56:30 +01:00
30ae57d0ba [Fix] Created get_text_width for menu button centering. 2025-10-02 23:45:56 +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
b4d985db29 [Add] Text editor and generic window content. 2025-09-29 23:15:46 +01:00
324cc795f0 [Add] Multi-line rendering in TextView. 2025-09-29 21:26:35 +01:00
d34c13ef8b [Change] Tried to fix stupid fucking animation jitter 2025-09-29 20:36:49 +01:00
4a6d33292a [Refactor] Abstract text editing into reusable components. 2025-09-28 23:31:17 +01:00
43907509eb [Add] Graphical application launcher. 2025-09-28 20:39:11 +01:00
996bf1c62c [Add] Temp desktop background and clock widget. 2025-09-28 17:24:41 +01:00
0e7f97ca81 [Refactor] Improve window buttons and fix state handling. 2025-09-28 15:37:15 +01:00
ea25cb6cc7 [Add] Taskbar and window management work
- Adds a taskbar that displays and manages open application windows
- close, minimise and restore functionality
- resizeable windows
- Refactored desktop event handling to manage window focus and render
  order
2025-09-28 14:12:11 +01:00
6876cbff95 [Add] Implement system boot sequence screen. 2025-09-28 03:10:12 +01:00
e72cc987ff [Add] Not your boring main menu. 2025-09-28 02:21:34 +01:00
b1bdb86b76 [Add] Implement screen manager state machine. 2025-09-28 00:09:26 +01:00
5cbcfeb54e [Refactor] More spring cleaning for the renderer. 2025-09-27 23:22:51 +01:00
e8ca1630c6 [Refactor] Consolidate duplicated matrix code into math util 2025-09-27 23:13:11 +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
e06d6eec37 [Refactor] Implement scriptable Lua API
Large architecture refactor of the scripting system.

Previous implementation required Lua scripts to return "action
tables" which were interpreted by a large and not very flexible at all
if-else ladder in C++. While fine for the initial implementation, it's
not scalable, and it makes it impossible for players to write their own
meaningful tools.
2025-09-27 21:18:05 +01:00
4b21d30567 [Fix] Correct CoW logic and fix rm command fallout. 2025-09-27 18:33:45 +01:00
00e78cc2ba [Refactor] One GameState to rule them all!
Introduces a central GameState class to manage the client's lifecycle,
network connection and UI components. The Terminal has been demoted to a
pure UI widget and main has been simplified to a basic entrypoint as
they should be!
2025-09-27 18:07:01 +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
28804998d7 [Remove] Unused include directive. 2025-09-27 00:38:12 +01:00
eb49ebe6f2 [Add] make sp option in makefile. 2025-09-27 00:37:15 +01:00
2c01d53b9d [Add] Add single-player mode. 2025-09-27 00:34:38 +01:00
fde6879720 [Add] Implement nmap network scanner. 2025-09-27 00:13:56 +01:00
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