Engine Recap
Course Schedule Update
- Your source code needs to be available on GitHub or BitBucket by next week.
- Engine Proof presentations next week, February 6th. Don't over do it trying to get both sprite sheet animations and physics running, just focus on what you need to get done to get your game started!
- Final presentations March 13th.
Questions
- Any troubling systems/modules?
- Do you understand how your code is coming together?
- Do you feel proud of your work?
Long term Engine goals
Profiling
- Performance issues? Memory issues?
- Really dig down, don't assume anything
Debug systems
- Personal favorite: a run-time variable watch (should be easy in HTML5/JS)
- Debug camera
- Invincibility mode and other cheats
Optimization
- can you solve the problem a different way
- can you do any preprocessing (building more sprite sheets, minifying your code)
- are you using an API wrong
- are you be more efficient (level of detail, trivial rejections)
- HTML5 specific ways?
Advanced Gameplay
Check out this list of Various tutorials on a number of gamedev topics
There are endless ways for us to extend our engine to support our gameplay needs. Don't engineer for the sake of engineering, as much fun as that can be :)
This is a general purpose lecture, with nothing that you are ever required to do but is helpful to be aware of
Audio
- By far HTML5's biggest disadvantage (which is why it's advanced!)
- No single format is supported by all browsers
- Would love to spend an entire lecture on it.
- A minimized version of the audio manager you wrote in the first course will suffice (what would need to be changed?)
- The book's major hack for Mobile: Sound Sprite Sheet
- Great writeup on the subject: http://www.html5rocks.com/en/tutorials/webaudio/games/
- Checking for vendor feature compatibility: http://areweplayingyet.org/
Particle Systems
- Fire, Dust, Smoke, Water drops, blood, building debris, lasers
- Can range from simple to highly advanced. Plenty of different implementation patterns. Great topic to endlessly research
- Particles
- a single sprite generated by a Particle Emitter
- Particle Emitter
- creates particles with various properties: size, velocity, acceleration, speed, color, lifetime
- properties can be randomized, or controlled by a curve, or algorithm (fade out by age or color change)
- Particle System
- manage all of the created particles that have the same set of properties and algorithms
- updates the particles lifetime, interpolates any properties that change with time, and renders particles
- often just a part of the emitter, sometimes it is another object
- Concerns:
- sorting between particles when there is translucency
- performance with lots of draw calls, lots of particle updating
- how much work you put into making the system flexible, data driven (major timesink)
- How we update properties: animated sprites, linear interpolation, curves with control points, algorithms/relationships between properties, physics driven, do they move in relationship to the emitter's position?
- Particles are a simple way to simulate fluids
Other Special Effects
- HFlip for sprites
- Lighting
- Shadows
- Ink/handdrawn effects
- Parallaxing
- Transitions between levels, menus
- Using more than one canvas
- Offscreen canvas
- Procedurally generated content!!!
Game Math
Interpolation
- An interpolator takes an input [0,1] and gives you a modified value in the same domain.
- Ease Functions - Engine Utilities
- Equations for Organic Motion
- HTML5 Graphing Calculator
Curves
- Many different interpolation methods: Quadratic, BeziƩr, de Castlejau are popular ones
- Usually works off a set of control points
- Spline interpolation - smooth polynomial function defiend piecewise. Simple construction, accurate and easy to evaluate.
- Used for anything! Object movement along a path, interpolating between animation frames, 2D and 3D surfaces
- Example javascript bezier curve and quadratic curve rendering (not that useful for gameplay though)
Game Objects
- Object pooling to better manage garbage collection. Works great with the factory pattern.
- Movement component / controller
- Health component
- Weapon component
- Just shove it all into a single class (totally valid)
Pathfinding
- The best heuristic is going to depend on your goals and the type of graph you are using. Pretty math heavy but lots of available resources for it.
- Great interactive demonstration of different algorithms
- Dijkstra's algorithm (wikipedia)
- Great explanation of A star algorithm, a variant of Dijkstra's
- Browser Quest's Astar utility class
- Navigation meshes - data structure, usually a bounding volume or graph of nodes, that helps AI navigate through a level.
AI
- Finite state machines - only a single state running at a time. The transitions between states are just as important to map out as the states themselves
- Hierarchy state machines - combines the commonality between states by organizing them as a hierarchy
- Can be used for menus, input, etc. along with characters/enemies
- Simple systems can still get complex pretty easily
- Genetic algorithms, neural networks, zzzzzzzzz
Advanced Physics in Gameplay
- Joints - ropes, chains, grabble hooks
- Sweep Tests - auto targetting, picking
2D Tilemap
- Orientation can be Orthogonal or isometric
- Defined by map size and tile size
- Layers - support for more than one tile at specific grid location
- Tiles properties: sprite, collision (or collision can be its own layer), layer (so players can walk behind things like trees)
- Reading in both map and tileset data (seperate resources)
- Extremely helpful to have an editor!
Networking Roadmap
Networking Overview
- HTTP based vs. Socket based (Asynchronous vs real-time multiplayer)
- Has many layers, like an Ogre (OSI model anyone?)
- Session management, Serialization, Message Compression, Shared Code between server and client.
- Mostly it's just about sending messages between the client and the server
- We'll be writing a server application to work with our client application
What the lectures will be going covering after our Engine Proof presentations
- How to use Node.js to run a Javascript based server application
- How to write a basic server application
- Testing our server application locally (Node.js runs on your local machine as well as on many popular hosting sites)
- Setting up a Heroku user account, and a new project
- Hosting our Node.js server application on Heroku
- Using MongoDB in our server application
- Facilitating communication between client application and server application
- What our server application needs to do (listen for connections, respond to game messages, send data to clients)
- What our client application needs to do (connect to a server, send player data like score, receive data from server)