Tuesday, October 6, 2009

Game Update

I have a fully functional Game development state <>
The Game has:
  • Player controlled camera
  • Adhoc local multiplayer (players join and leave at will and the screen re-adjusts correctly)
  • Players can sprint and sneak. Speed modifiers will be adjusted later when the game play is more advanced. It was easy functionality to add :)
  • Basic interactions (player can pickup items within a radius. Working on accurate selection)
The Game Demo post issues
"I am attempting Splitscreen with a major bug to solve and I have to solve a problem where the player is spawned directly ontop of the ground even when higher up is required."

I managed to solve these after a good sleep.

The splitscreen problem that I had with the split screen was that with 1 player, everything worked. However with
2 players: the two views were drawn over each other.
3 players: player 1 and 3 views clashed while player 2 was fine.
4 players: player 1 and 4 views clashed and player 2 and 3 views clashed

I found this problem in the code to remove adhoc players. What caused the issue was:
  1. When a player leaves the splitscreen is refreshed so that unused screen is recovered. Unfortunately I was refreshing the screen every time.
  2. In my iterator which filtered out left players to make a new active list, I was trying to be clever by reducing calls by "i = localPlayers.Count" and working to "i >-1". This combined with cause 1 made the viewports refresh every update in the opposite order. Hence players 1 and 4 and players 2 and 3 kept swapping viewports causing the flashing bug. This was a helpful cause though as I wouldn't of caught the constant viewport refreshing if i hadn't messed up the loop order.
The bug was fixed by a boolean check that a player has left before refreshing the viewports and when I removed the leaving player, I changed the loop so that they add in the correct order.


The players height problem was caused by me directly changing the players position in the player initialize function instead of changing the value through the Position property (C# set method). the problem was that the camera was stuck on the players default height. By setting the the Position property, the camera gets updated as well.


Right now I am working on the bullet manager. It will be a factory for bullets, update them, perform collsion checks and report to the gameplaymode class when a collision occurs.
Collsion checks are called to each object that the bullet can interact with and the closest object is returned to the gameplaymode class along with the bullet info for drawing. This will be basic at first so that I can get a game running quickly but will be optimized greatly later by introducing Octtrees and quadtrees.

No comments:

Post a Comment