Networking assignment

Plan

For the networking assignment I plan on doing a really simple League of Legends (LoL) style game with multiple players and a set of about 3 different spells.

I’ll be using the “Arena.fbx” (converted to AIE format to help loading times) and Marv as he character.

Arena level
Arena level preview. The red glitches are the nav mesh (I’ll hide it in game)

The characters will be sort of “Space adventure” rather than the genre of LoL because it suits Marv better.

I’ll be texturing the entire level with a space looking metal texture (maybe tinted blue or something) and the players will just be tinted their colour.

I plan on making it similar to LoL.

20130626004050

So because I had actually not played much of it before I decided to play it, and got dragged into a game with friends (when I say dragged I just mean easily peer pressured because I’m a chump and I’m just procrastinating).

The results were a bit sad:

20130626005557

So after enduring that escapade, I figured the game will appear as follows:

  • Camera’s Z and angle will be locked at a 45 degree angle looking down at the player
  • the player will move around independently of the camera’s X and Z position (the player can move the camera around)
  • The player will use a* to move around a nav mesh when clicked on a certain position
  • The player will have various abilities assigned to certain keys

The players can attack and do spells. Each spell costs mana and has a cooldown. Each character will have the same spells and attacks as I’m going to focus on the networking rather than the depth of the game.

So this is what the players can do:

  • Level up – they start at level 1 and each level takes twice as many points to reach. you gain more and more XP the more you kill players and get hits on players / not dying for ages (multiplier)
  • Attack (more damage per level) (click on enemy)
  • Medkit – heals player over time, has a cooldown (A) (requires level 2)
  • Throw Mine – explodes when player touches it does lots of damage – get 1 every time you die and respawn (S) (requires level 3)
  • Shoot Destroyer Blaser- does lots of damage depending on your level, has a cooldown (D) (requires level 5)

Technical:

Movement

  • Right clicking places a target for player to walk to
  • When a target is places, the player must perform an A* pathfinding search to get to it
  • When the player has found this path, he will have to walk towards it in nodes
  • Once the player is in the last node’s triangle, he will seek out the point directly
  • Player will animate and face the direction he’s walking
  • I won’t worry about player colissions, but if I do, I can check to see if there’s an enemy in the current tri, then check the distance

Camera

  • Camera will be locked to a good distance and angle
  • When player moved mouse pointer to a certain distance from the screen’s edge, the camera will move in that direction
  • The camera should have a limit to how far it can be moved in certain directions so player doesn’t get lost (There’s no minimap)

Attacking

  • Clicking on an enemy will do a spherical collision and attackes will be dealt to that enemy
  • The player will send attacks constantly 1 after the other like a gun
  • Each bullet will fly towards the enemy, if it hits it, it will take damage (spherical collision)
  • The big bullets will move the same speed but will look bigger
  • The mines will basically be the same as big bullets except they won’t move. They will also do the same damage

Other

  • Healing will just be done with a timer and heal a certain amount of player health over time
  • When a player has no health, he dies and is re-spawned in 5 seconds
  • The game ends after a 5 minute timer runs out (or 10 minutes, whatever). The winner is the one with the most kills
  • Or first to 20
  • Player is spawned as far away from the opponent as possible on a random nav point (loop through each nav point and get distance)

Networking

Yeah I know, all that other stuff is fluff, but here’s the juice to the orange of assignment:

  • First time you run the program, it asks to be a server or client
  • if you are a client, the client will ask to connect to a server. Once connected, the client will send all player info to the server
  • On the server side, when started the game, the player is put in the game and assigned as player 1. Their colour is random.
  • The server will listen for connections, and if there is one, it will add the new player with its data to the game, and then send the client the server’s player info
  • When the client is connected to the server, it will wait for all players on the server’s info and add all these players to the list on the client side with unique IDs.
  • The client will update its positions and send the server every action that is performed and also the position. Each client or server will then animate each character and move it to the new position. Animations and effects will be done on client side.
  • If a player’s client decides that a player has been hit with a bullet, then that info is sent to the server, the server then tells every client this so it updates its info
  • This info is sent at about 12 times per second (every 0.083 seconds)

Apart from these points, the only other thing would be end game state which will be controlled by the server. The timer will also be synced with the server.

That’s it for now. Happy everything.

20130626014922

Let’s make Marv do things

Scaling

Today I updated the scaling part of my vertex shader because it seemed wrong. And it was wrong. Before:

mat4 newmodel = Model;
newmodel[3][3] = Scale;
vWorldPos = newmodel * PosWithBone / Scale;
// output position
gl_Position = Projection * View * newmodel * PosWithBone;

After

// for scaling
PosWithBone.x *= Scale;
PosWithBone.y *= Scale;
PosWithBone.z *= Scale;
vWorldPos = Model * PosWithBone / Scale;
// output position
gl_Position = Projection * View * Model * PosWithBone;

The vWorldPosition is set so the pixel shader knows easily where the world is so I don’t have to send it as a uniform.

Flags

I plan on adding flags for capture the flag. I spent a bit of time on TurboSquid finding some free flags but only one was free in FBX format and it didn’t import properly, so I decided to go with using the dragon FBX, despite it being extrem,ely high poly count. I believe this won’t be a problem but if frame-rates slow down then I’ll just use another random object like soulspear.

Lights and scenes

The light were originally just structs, so I moved them out into their own header and class files for better code standards.

So far here’s what we have:

20130528000756

Playing with fog. Using the z buffer to darken the fragments depending on distance from the camera.20130528000839

Got a nice specular effect using a normal map created in crazybump.20130528001303 20130527232639

Marv ready to be animated.20130527232702

 

Testing fog colours. Here we have red fog.20130528001501

Using different textures on the level. Lava texture looks a bit too bright.20130528030046

Here we see the result of what Marv animated like before I removed the 4th bone transform from the indices. I’m going to assume that that last one is for the transform of the gun Marv is supposed to be holding.20130528030328

Using emissive textures to light up areas that are not lit. I couldn’t figure out the formula though so I removed it.20130528030358

Go home Marv, you are drunk.20130528030522 20130528032217Trying with only 1 bone index. Marv hated that.