WIP: Reorganize the codebase, splitting game, render and input logic #3

Draft
Avery wants to merge 7 commits from Avery/MineClone:master into master
Avery commented 2 months ago

PR marked as WIP since I am very much learning as I go and I expect that this first attempt needs a few time back and forth between reviews and fixes before it can be merged.

In this version, the game logic is driven by the state of the game, making it essentially a state machine. While currently there is only states for loading and InWorld, once a main menu and such is implemented, those will get their own states in the state machine, thus being able to render their own things and handle their own input. I imagine a valid and sensible flow of states could look something like this:

Unstarted ->
(create basic rendering data)  ->
RenderAvailable ->
(create main menu and its renderer) ->
MainMenu ->
(Select world to play and set target state to Loading world) ->
(then destroy main menu renderer) ->
RenderAvailable ->
Create world renderer part 1)-> 
LoadingWorld
(Load world, potentially mods, and create world render part 2) ->
InWorld -> 
(Exit world and destroy world renderer) -> 
RenderAvailable -> <Back to creating main menu>

For further details on the reorg, see 2f15842ca4.

PR marked as WIP since I am very much learning as I go and I expect that this first attempt needs a few time back and forth between reviews and fixes before it can be merged. In this version, the game logic is driven by the state of the game, making it essentially a state machine. While currently there is only states for loading and InWorld, once a main menu and such is implemented, those will get their own states in the state machine, thus being able to render their own things and handle their own input. I imagine a valid and sensible flow of states could look something like this: ``` Unstarted -> (create basic rendering data) -> RenderAvailable -> (create main menu and its renderer) -> MainMenu -> (Select world to play and set target state to Loading world) -> (then destroy main menu renderer) -> RenderAvailable -> Create world renderer part 1)-> LoadingWorld (Load world, potentially mods, and create world render part 2) -> InWorld -> (Exit world and destroy world renderer) -> RenderAvailable -> <Back to creating main menu> ``` For further details on the reorg, see 2f15842ca45d29316a35b1fe5ee1e7bf8b5ddb3c.
Avery added 3 commits 2 months ago
2f15842ca4
Reorganise and split `main.rs`
Avery added 1 commit 2 months ago
dbce32f625
Fix `VK_ERROR_SURFACE_LOST_KHR`, `VK_ERROR_OUT_OF_POOL_MEMORY`, typos in shader names
Avery added 1 commit 2 months ago
Avery added 1 commit 2 months ago
32aa330b33
Add doc comments to various things
Avery added 1 commit 2 months ago
c9fdcfe008
Deduplicate setup_dest_layout
This pull request is marked as a work in progress.
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: itycodes/MineClone#3
Loading…
There is no content yet.