Commit Graph

47 Commits

Author SHA1 Message Date
a1c214caec [Add] Procedural cloud rendering.
Adds a skydome with two scrolling layers of procedurally generated
clouds to create an interestingish environment.
2025-09-18 20:18:02 +01:00
8c701d39b7 [Add] Added detailmap for more detailed terrain. 2025-09-17 23:14:48 +01:00
6186952313 Use fabsf() in _generate_chunk 2025-09-17 20:34:09 +01:00
653a30f60c [Add] seemless chunk loading with increased view dist. 2025-09-17 20:28:37 +01:00
107c6a7382 [Add] Dynamic world chunk loading. 2025-09-17 20:07:02 +01:00
5678b0f0c3 [Add] Fractal noise and random seed to world gen. 2025-09-17 19:45:02 +01:00
5d045e2fa7 [Fix] Issue with gravity sucking half the player into the ground. 2025-09-17 19:29:18 +01:00
c5a722b047 [Fix] Accidently removed rotation of local player. 2025-09-17 19:25:31 +01:00
e35c4b5d61 [Fix] Visible lighting seems between chunks.
Server now generates and sends an expanded 34x34 heightmap for each
chunk, which includes a 1-vertex border containing height information
from all adjacent chunks.

Client ChunkMesh class updated to consume this extra data, allowing it
to calcualte perfectly accurate normal vectors for all vertices,
including those at the very edge of a chunk.
2025-09-17 19:19:38 +01:00
fa7159587d [Add] Terrain lighting.
* Chunks are now rendered as solid, lit meshes instead of wireframe.
* The GLSL shaders have been updated to a directional lighting model.
* Chunkmes now calculates normal vectors for each vertex to enable the
  lighting.
* Shader class now has a 'set_vec3' method for sending lighting date to
  the GPU.

Bug Fix:
* Resolves visual artifacts and "seams" at chunk boundaries.

Next up:
* To calculate the correct angle for a vertex at the edge of chunk A, we
  need to know the height of the terrain in the neighboiring Chunk B.
Since it doesn't have that information, the GPU's making an appoximate
guess. We need to generate and send a small "border" of height data
along with each chunk, I'll do this by increasing the size of the
heightmap array in the network message so it can hold the 32x32 chunk
plus 1 vertex border all around. MAking it 34x34 for each chunk.
2025-09-16 23:58:03 +01:00
744c41b8ce [Add] Terrain collision and gravity.
Physics and collision system to make players interact with the generated
terraine without falling through the world like lemmings.

It uses a shared bilinear interpolation function for terrain height for
smooth and consistant height queries on the client and server.
2025-09-16 22:13:15 +01:00
7ba0b348bc [Add] Initial terrain generation. 2025-09-16 20:49:00 +01:00
506356458a [Add] Noise Generation library. Credit: Jordan Peck.
https://github.com/Auburn/FastNoiseLite/tree/master
2025-09-16 19:09:54 +01:00
eb38a34c93 [Add] Camera modes, for first person/third person. 2025-09-16 18:59:57 +01:00
ad2a540554 [Refactor] Unify client and server player classes.
A bit of an architectural change before we progress further. Moved
player code into a shared PlayerBass class to elimnate some severe code
duplication while i was getting things working.
2025-09-16 00:10:35 +01:00
c083df9958 [Change] Implement 3D character controls/rotation. 2025-09-15 21:28:17 +01:00
42ca31946b [Add] Design doc to .gitignore. 2025-09-15 19:41:21 +01:00
6af39c4f82 [Fix] _world_up vector initialiser for z-coord. 2025-09-15 18:29:01 +01:00
9bf8b277ff [Add] 3D orbit camera and refactor renderer. 2025-09-14 22:17:47 +01:00
a6646820c5 [Add] Ground plane. 2025-09-14 21:26:54 +01:00
e208f49674 [Add] Gone with 3D renderer instead. added z coord. 2025-09-14 20:26:37 +01:00
9615c39e67 [Refac] Separate rendering, game and application. 2025-09-14 16:09:44 +01:00
e4b66aa68f [Fix] remove a duplicate memcpy. 2025-09-14 04:36:32 +01:00
f653c34baf [Change] Switched to an input-based reconcilation
Replaced the previous correction models with a full "Reconciliation by
Replaying Inputs system".
2025-09-14 04:25:10 +01:00
8d59e79f8a [Add] Smooth correction for server reconciliation. 2025-09-14 02:24:17 +01:00
6aa204672e Fix: Handle remote player disconnections. 2025-09-14 02:06:35 +01:00
81b8972742 [Add] Entity interpolation for remote players.
Added linear interpolation for remote player movement to provide a
smoother and more visually appealing experience.

Where previously remote players would snap directly to their new coords
on receiving a game state update, making it a bit jerky, now we get a
smoothe ride.
2025-09-14 01:54:18 +01:00
9b4aa84a30 feat(network): Server reconciliation and fix UDP messaging.
Initial implementation of server-side reconciliation for player
movement.

Clients respect the server as the authoritative source for game state.
In 'process_game_state', the client compares its locally predicted pos
with the state received from the server and snaps to the server's
position if they diverge.

Had to add a defensive check to the server-side Player constructor to
fix a bug where the first connecting client was incorrectly assigned an
ID of 0. This prevented it from sending or recieving any game data.
2025-09-14 01:33:35 +01:00
a2a8b052af feat(network): hybrid TCP/UDP networking model.
Moving from a TCP only model to a hybrid TCP/UDP system. This is
required to achieve a responsive, real-time multiplayer experience.
2025-09-14 00:52:18 +01:00
5b30ab67c1 refactor(server): networking and fix mem leak. 2025-09-13 22:21:53 +01:00
5944663017 feat: Implement multiplayer functionality.
- Server can handle multiple clients simultaneously.
- Client can see other players in the game.
- Server broadcasts the game state to all clients.
- Client receives the game state and renders the other players.
- Server assigns a unique ID to each player.
- Client receives its player ID form the server.
- Server handles client disconnections.. Kinda... Server is ignoring
  SIGPIPE signal.
- Server and client signals are non-blocking.
- Moved player objects off the stack and onto the heap.
2025-09-13 19:44:35 +01:00
39a06147c8 feat(server): Implement game state broadcasting. 2025-09-13 17:49:09 +01:00
bd6281c9bc feat(server): Implement server-side game state.
* Added Player class to represent players on the server.
* Added Game class to manage the overall game state.
* Server now adds new players to the game state when they connect.
* Server now updates the players position in the game state on receiving
  a PlayerPosMessage.
2025-09-13 17:10:55 +01:00
d21a0df285 feat(server) Implement binary messaging protocol. 2025-09-13 16:33:38 +01:00
6e935918a3 feat(server) Added client/server for online play
Note: This is fucking broken! it's too early in the morning. Fix
tomorrow.
2025-09-13 05:22:30 +01:00
5a4d4ff7a3 oops: Remove .clangd from version control. 2025-09-13 02:27:59 +01:00
a8a1ea44cf refactor(math): Replace GLM with custom math lib.
Replaced the GLM dependency with a custom math lib 'libbettola'
2025-09-13 02:25:13 +01:00
22d60c7192 refactor(player): Implement state-based input. 2025-09-12 23:54:38 +01:00
c7130ac3dd feat(player) Implement key event handling.
Adds keyboard input handling to control the "player".
2025-09-12 23:00:42 +01:00
dc4dd650a4 feat(renderer) Render player quad with projection
this allows us to render a player controlled entity on screen using a 2D
projection
2025-09-12 22:46:17 +01:00
d6d3581e5b Initial player and glm lib for matrix math. 2025-09-12 22:15:59 +01:00
56bf0e9376 fix: alignment. 2025-09-12 21:51:53 +01:00
6b7684ba92 feat(render) Render shaders!
Implements the rendering pipeline to dispaly a 2D triangle using
shaders!
2025-09-12 21:49:15 +01:00
7eb86f9389 refactor: Add everything to main Bettola class. 2025-09-12 20:41:49 +01:00
557211c505 Fucking LSP adding unnessassary includes!!! 2025-09-11 23:24:04 +01:00
6a58b4a8ba feat(engine): Implement delta time calculation. 2025-09-11 23:21:37 +01:00
8dcd42c97b Initial commit of 2D RPG Engine. @dacav come help. 2025-09-11 23:07:38 +01:00