5:00pm - So, it's back to work again with me.
I've been thinking about the structure of the game and how I want to change it, but I haven't made any serious progress yet. So let's continue that now.
I've got a MapGenerator that generates an array of MapCell instances, and a MapCell is just a bunch of flags. The first two are simple, but the second two are probably going to have to be changed. They're "is_discovered" and "is_visible" which make the maptiles focused down to a singleplayer game, where only one player can discover or see tiles.
5:10pm - Actually, now that I'm looking at the code, why don't I take a walk through it and see how everything fits together?
It starts with the Level script running its restart_game() function, which is also used to restart the game if it needs to. It initializes everything to the starting point.
First it sets up the actor_list, which is a list of the actors in the scene, then it sets up the actor_timing_list which is an ordered list of the actors in turn.
It sets it to the player's turn, then zeroes out a bunch of game variables, then it makes the map, that should really be in the new GameMap class I want to make. The Level script should tell the map to create itself, rather than creating a map and setting it to the map's variable.
Then it sets up an AStar2D map, which is another thing that should be part of the GameMap class instead of in the Level class. I want the Level class to be a container for the GameMap and the various Actors who live on that GameMap.
After the AStar2D map is set up, the restart_game() function resumes, and creates the actors for the scene. I wonder if the Actors should be collected into some sort of 'Actor Stage' or left on the same level as the GameMap?
Then it initializes the field of view, again that should be in the GameMap class. These should all be set up as a single "GameMap.setup()" call or something.
Then it uses the player's location to determine a field of view, and modifies the cells based on that for the FogOfWarTileMap to update based on the regular terrain map.
Finally it starts the action timer, which is a timer that counts down between each actor's move. I remember I was going to modify this because it only makes sense for the actors on screen, and maybe not even then. It's important for the player though, to prevent them from moving super fast just by holding down the key too long.
That's the initialization phase of the game taken care of. After that, active play begins at the _process() function and the _input() function, two of Godot's builtin functions.
The process function runs every frame, and handles triggering the Actors' on_turn() methods. It's a game pump. The heartbeat of the whole thing.
The input function changes variables based on what keys are pressed, and if those variables are set true, the process function behaves differently.
The Actors do their thing. The tricky bit is how they interact with the Map.
Each Actor has a grid_position that says where on the map they are. There's no accordance for non-wall objects in the AStar2D map; if an Actor wants to move into a square where there's another Actor, it fails. This is a pretty big flaw in my current design, and something I need to change.
And I think that's everything I've got so far. That's it. That's the game.
6:04pm - So there's a lot of changes I'm going to want to make, but I have to figure out how it actually should be first. For that, and since I've been at this an hour now, I'm going to transfer over to my ChromeBook and work on there for a little while, and figure out what I want the game to look like while sitting somewhere else.
6:36pm - This is the sort of thing I want to use for my maps: http://www.roguelib.com/api/GoRogue.SpatialMaps.ISpatialMap-1.html
6:49pm - I'm looking at the GoRogue documentation in order to figure out how to bring what they did over to my project without using the library itself. But I'm losing steam pretty fast...
7:09pm - I realized there was something I wanted to do tonight, and it's happening at 9:30pm. So I want to play some games before then, and time is fleeting, so I'll finish this now.
Next time, I think I'll figure out how to set up an image of my current Roguelike Project on github, and start modifying it to look more like GoRogue's system.
I've been thinking about the structure of the game and how I want to change it, but I haven't made any serious progress yet. So let's continue that now.
I've got a MapGenerator that generates an array of MapCell instances, and a MapCell is just a bunch of flags. The first two are simple, but the second two are probably going to have to be changed. They're "is_discovered" and "is_visible" which make the maptiles focused down to a singleplayer game, where only one player can discover or see tiles.
5:10pm - Actually, now that I'm looking at the code, why don't I take a walk through it and see how everything fits together?
It starts with the Level script running its restart_game() function, which is also used to restart the game if it needs to. It initializes everything to the starting point.
First it sets up the actor_list, which is a list of the actors in the scene, then it sets up the actor_timing_list which is an ordered list of the actors in turn.
It sets it to the player's turn, then zeroes out a bunch of game variables, then it makes the map, that should really be in the new GameMap class I want to make. The Level script should tell the map to create itself, rather than creating a map and setting it to the map's variable.
Then it sets up an AStar2D map, which is another thing that should be part of the GameMap class instead of in the Level class. I want the Level class to be a container for the GameMap and the various Actors who live on that GameMap.
After the AStar2D map is set up, the restart_game() function resumes, and creates the actors for the scene. I wonder if the Actors should be collected into some sort of 'Actor Stage' or left on the same level as the GameMap?
Then it initializes the field of view, again that should be in the GameMap class. These should all be set up as a single "GameMap.setup()" call or something.
Then it uses the player's location to determine a field of view, and modifies the cells based on that for the FogOfWarTileMap to update based on the regular terrain map.
Finally it starts the action timer, which is a timer that counts down between each actor's move. I remember I was going to modify this because it only makes sense for the actors on screen, and maybe not even then. It's important for the player though, to prevent them from moving super fast just by holding down the key too long.
That's the initialization phase of the game taken care of. After that, active play begins at the _process() function and the _input() function, two of Godot's builtin functions.
The process function runs every frame, and handles triggering the Actors' on_turn() methods. It's a game pump. The heartbeat of the whole thing.
The input function changes variables based on what keys are pressed, and if those variables are set true, the process function behaves differently.
The Actors do their thing. The tricky bit is how they interact with the Map.
Each Actor has a grid_position that says where on the map they are. There's no accordance for non-wall objects in the AStar2D map; if an Actor wants to move into a square where there's another Actor, it fails. This is a pretty big flaw in my current design, and something I need to change.
And I think that's everything I've got so far. That's it. That's the game.
6:04pm - So there's a lot of changes I'm going to want to make, but I have to figure out how it actually should be first. For that, and since I've been at this an hour now, I'm going to transfer over to my ChromeBook and work on there for a little while, and figure out what I want the game to look like while sitting somewhere else.
6:36pm - This is the sort of thing I want to use for my maps: http://www.roguelib.com/api/GoRogue.SpatialMaps.ISpatialMap-1.html
6:49pm - I'm looking at the GoRogue documentation in order to figure out how to bring what they did over to my project without using the library itself. But I'm losing steam pretty fast...
7:09pm - I realized there was something I wanted to do tonight, and it's happening at 9:30pm. So I want to play some games before then, and time is fleeting, so I'll finish this now.
Next time, I think I'll figure out how to set up an image of my current Roguelike Project on github, and start modifying it to look more like GoRogue's system.