Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Oculus Rift Development

You're reading from   Mastering Oculus Rift Development The next frontier of gaming and simulation

Arrow left icon
Product type Paperback
Published in Feb 2017
Publisher Packt
ISBN-13 9781786461155
Length 306 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Jack Donovan Jack Donovan
Author Profile Icon Jack Donovan
Jack Donovan
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Exploring a New Reality with the Oculus Rift 2. Stepping into Virtual Reality FREE CHAPTER 3. Improving Performance and Avoiding Discomfort 4. Interacting with Virtual Worlds 5. Establishing Presence 6. Adding Depth and Intuition to a User Interface 7. Hearing and Believing with 3D Audio 8. Adding Tone and Realism with Graphics 9. Bringing Players Together in VR 10. Publishing on the Oculus Store

Synchronizing data in multiplayer matches

Everything that you've done up to this point has been about getting players in the same match, but we haven't covered anything about keeping in-game events synced between the server and client. Fortunately, Unity's networking API makes this very easy; we can use most of the code we've already written with some slight modifications to make it network-aware.

Syncing player movement

The first thing we'll tackle is player movement, so you can see other people walking around the map. We'll build upon our existing player prefab and the NetworkIdentity component, as well as a new kind of component: NetworkTransform.

Select the ArenaPlayer prefab in your Project window and add a NetworkTransform component in the Inspector. This alone is enough to sync the position across the network but, if you tested now, you'd run into an interesting problem: input from any player would be reflected on every other player instance in...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image