CardGameAlpha: Progress Update

in #hivedev4 years ago

So yesterday I actually started the project and made a bit of progress. I created the Game Mode file which currently does nothing other than say it's loaded. The game mode is stored only on the server and is used to keep track of stuff related to the game mode, it gets reset on a map reload. Right now I'm not fully clear on exactly what will be in there other than stuff related to player health and game over conditions and such. I'll attach a picture of it just to show how basic it is so far.

GameMode.png

You can see at the top there there's a function with the same name as the module itself. That's a constructor function, it's called whenever the object it's in is created. What I'm doing there is telling it to use my custom game state and player controller classes whenever it's created. Then when play begins it gives a message to the log which may be very useful later on in order to debug.

What I plan on doing is putting that behind a compiler condition or whatever it's called, so that the logging only happens when it's compiled in debug mode.

After I'd created the Game Mode I created the GameState, which is loaded on every single client connected to the server. I'm fairly certain it's not unique to each player. So at some point I'm going to have to put health tracking in here so each player can know how much hp the other player has and how many cards, that sort of thing. Currently it just logs that it's loaded.

GameState.png

After getting that loading properly in GameMode, I started on the PlayerController. The PlayerController is what is your player essentially. This is where cards, health, etc will be stored. In other UE4 games, some of that functionality would be put into the pawn Such as a first person shooter, your "pawn" can die, but your player respawns at some point later. Tracking health in the playercontroller would be pointless in that case. If you entered a car, your pawn would change to a car etc.

PlayerController.PNG

So I put the same logging as in GameState into PlayerController and got it loading in Game Mode. Then I decided it would be fairly easy to implement Damage. PlayerHealth is defined in cppPlayerController.h as an integer with a starting value of 30. I'm not sure whether this actually belongs in the PlayerController or whether it should be in the card base type.

Well that was my progress yesterday, today I'm gonna make the card base type, try to implement turns and lay out the skeleton of dealing cards at the start of a match.

-Pillboxing