Showing posts with label Unity. Show all posts
Showing posts with label Unity. Show all posts

Wednesday, 17 February 2016

PUN shooter #4 - More drama

In the last 4 sessions I added the following:

  • A game menu
  • UI elements to 'dramatise' the re-spawn process
  • Sound effects and music
  • A credits section.
Nothing too hard or complex here, even though getting all this done has been a long day's work.


You can try the game [here]

Tuesday, 16 February 2016

PUN shooter #3 - Footprints and footsteps.

In the past couple of days I worked on scripts for footprints and footsteps. Also, proxies didn't play animation.

<> Velocity and collisions may report incorrectly for kinematic bodies updated over the network.

The tricky part was getting a good enough answer to the simple question, "is the avatar walking". This breaks down into "is the avatar moving" and "is the avatar grounded".


Since collisions report inaccurately we can't use OnCollisionStay() to tell us an avatar is grounded. Instead, use raycasting.

Surprisingly, speed reported via position sampling proved inaccurate enough that I had to average readings over time to get acceptable results.

Saturday, 13 February 2016

Pun shooter #1 - Shooting

In the past couple of days I've been making a basic shooter. Caveats.

Transform sync doesn't work. Why?

  • If using a rigid body, ensure kinematic is on for the proxy (but you should still see some sync regardless.
  • Remember to add the NetworkTransformView to PhotonView.
Collisions not working

Kinematic proxies aren't good at generating collisions. Why? Because if you receive say, 10 positions per second, and an object bounces on the remote, the proxy may interpolate towards the new direction without picking up the actual collision.



I realised this while dealing with physical projectiles. This time around I decided to Network-Instantiate projectiles but adding physics locally via script attached to the bullet prefab.

Ghost bullets

What we create with PhotonNetwork.Instantiate(...) must be destroyed with PhotonNetwork.Destroy(...). A symptom of doing otherwise (for example, destroy all local copies of an object) is that entering clients will "replay" previously instantiated objects.

Input methods

After I put a little game together we got to try it on two laptops simultaneously. One of the laptops didn't respond to key strokes. Investigating, we found that a foreign input method was conflicting with game input.