CprE 288 * May 16th C - Senior Design Dec 14-04

advertisement
SuperCY
Group Dec 14-04
http://dec1404.ece.iastate.edu
-orhttp://seniordesigndec1404.weebly.com
Dec14-04
1
Team Members
•
•
•
•
Paul Danner – Leader
Taylor Gehling – Communications
Austen Gregor – Key Idea Holder
Trevor McCormack – Webmaster
• Manimaran Govindarasu – Advisor/Client
Dec14-04
2
Scope of Project
Initial
• Create testbed to implement network optimizations
over Android based system
• Optional Goal: Integrate with Union Pacific Multimedia
Wall
Modified
• Made integration with media wall mandatory
• Removed network optimization goal
Iowa State University
3
Reasons for Project Re-specification
• To attract potential students and show them what
current students are capable of creating
• Lay a foundation for future apps looking to utilize the
multimedia wall
• Give department something fun and exciting to show on
multimedia wall
Iowa State University
4
Demo
Iowa State University
5
App Overview - SuperCY
• Side-scrolling shooter game
• Shoot at hordes of enemies, resulting in boss battle
• Multiplayer – Potential for up to 20 players
• Powerups add competitive element to game
• Interacts with media wall for unique experience
Iowa State University
6
Screenshot of App
Iowa State University
7
Unity
• Game Engine for variety of platforms
– Android, iOS, PS3, Xbox, Windows/Mac
• Handles much of back end
programming
• Focused around GameObjects
– Players, background objects, scenery,
etc.
– Write scripts (C#, JS) to control the
various GameObjects
Iowa State University
8
Application Design – Stage I – Singleplayer
• Created GameObjects to represent player/enemies
• Write C# scripts to control behavior of various
GameObjects
– Health
– Movement
– Shooting/collisions
• Unity provides means for modularization of
GameObjects
– i.e. Health script attached to each enemy/player
Iowa State University
9
Modularization
CY
Iowa State University
Player
Script
Weapon Script
Move
Script
Shot
Script
Move
Script
Health
Script
Photon
View
Script
Cy
Network
Script
10
Powerups – Challenges
• Singleplayer
– How to get a powerup to spawn on an enemy death
– Doesn’t need to spawn on each enemy death – random
• Multiplayer
– Disallowing multiple players to obtain single powerup
– Disallow multiple spawning of same powerup
– Caused by technical network latency of GameObject Destroy
Iowa State University
11
Powerups – Solution
• Singleplayer
– Add XYZ_powerup_module for each powerup
• Sprite renderer – Graphic for powerup to spawn
• Powerup_Script – Controls collision and corresponding actions
– On each enemy death, generate random number to determine
if powerup needs to spawn
• Multiplayer
– Assign boolean within powerup scripts, keep track of collisions
– On first collision with player
• Set boolean to false to disallow other players to interact with it
Iowa State University
12
Application Design – Stage II – Multiplayer
• Integrated Photon Unity Networking into singleplayer
project
• Modify how game runs across multiple devices
– Player/Enemy Spawning
– Player/Enemy Shots
– Player/Enemy Movement
• Modified game settings to accommodate media wall
Iowa State University
13
Character Spawning
• Treat media wall as host of game
– Spawn enemies/boss
– Synchronize background
• Treat each Android device as client of game
– Spawn character
– Update movement/shots across network
• Host and client interact across Photon Cloud and RPC
messages
Iowa State University
14
Networking Breakdown
Photon Instantiated Objects
• Player movement/shots
• Boss movement/shots
• Level Synchronization
• Player Score/Ammo/Health
Iowa State University
RPC
• Enemy damage/destruction
• Player joining/leaving game
• Call a function on networked
object
15
Synchronization – Challenge
• Player movements getting relayed to other devices
– Very jittery & delayed
• Player/enemy shot collisions & destruction
– Because enemies were spawned locally on each device via RPC
call, object collision was not uniform across network
• Boss health/spawning across devices
– Delay caused by network transmissions cause player shots to
last longer
Iowa State University
16
Player Synchronization – Solution
• Linear Interpolation
– Method of “curve fitting” using linear polynomials
• Used to smooth out player movement across devices
– Player sends updated position periodically
– Other devices receive, and take average over a time frame to
smooth out other player movements
Iowa State University
17
Collision/Destruction – Solution
• Updated enemy spawning to only spawn one character
across the network
– Pro: Much easier to synchronize states
– Con: Enemy position messages increases network traffic
• When one device damages enemy, send RPC to all users
– If enemy health is low enough, make host “Network Destroy”
object
• Keeps all device’s levels synchronized within technical
delay time
Iowa State University
18
Boss Synchronization – Solution
• Player bullets would hit multiple vertices before being
“network destroyed”
– Cause each bullet to cause additional damage to boss
• Caused by technical network delay in message
transmissions
• Updated shot mechanics to cause it not to make more
than one damage to enemy/boss
Iowa State University
19
Garbage Collection – Challenge
• GameObjects that were not in use anymore would build
up and drastically reduce game performance
– Issue with both Single and Multiplayer development
• Examples
– Enemies that weren’t destroyed would continue forever
– Bullets that missed would continue forever
Iowa State University
20
Garbage Collection – Solution
• Attach a frame counter to each GameObject
– Count the number of frames since instantiation
• After ‘X’ amount of frames, destroy the GameObject
• Example
– @ 60 fps
– Enemy will cross screen from right  left in 4 seconds
if (enemy crosses screen without being destroyed)
Destroy ( GameObject ) at frame_count = (60 * 4 + buf)
Iowa State University
21
Testing
• Test early, Test often
– After each small addition to game logic, test using controlled
level variables
– Able to isolate problems easily by manipulating level
– Make use of Debug Logs
• Beta-test – FAN Club
– Let 40-50 students test our game on media wall
– Received feedback from testers
– Observed game from developmental perspective
Iowa State University
22
Questions?
Thank you for your time
Iowa State University
23
BACKUP SLIDES
Iowa State University
24
Menu Diagram - Note
• Like functional decomp in 491 project
Iowa State University
25
HW/SW Technology
Software
• Unity Game Engine
– Used to create Android
application
– Utilizes C# scripts written by
user to complement traditional
game mechanic backing
• Photon Unity Networking
Hardware
• Android Devices
– Up to 20 devices concurrently
• Union Pacific Multimedia Wall
– Runs Windows 7
– 12 touch screen monitors
– Located in Coover East Entrance
– Unity backed network support
for multi-player apps
– Cross-compatibility between
different devices
• i.e. Windows, Android, iOS, etc.
Iowa State University
26
(X2, Y2, t2)
(X1, Y1, t1)
Download