160 likes | 274 Views
Coping with Fixed Point. Arto Astala, CTO Arto@Fathammer.com. Fathammer. Mobile Gaming Technology X-Forge™ Game Development System Client focused Complete solution 4 years of experience Game development Internal development Game Development Partners Industry cooperation
E N D
Coping with Fixed Point Arto Astala, CTOArto@Fathammer.com
Fathammer • Mobile Gaming Technology • X-Forge™ Game Development System • Client focused • Complete solution • 4 years of experience • Game development • Internal development • Game Development Partners • Industry cooperation • Samsung, Gizmondo, Tapwave, Nokia • Intel, TI, Nvidia (& MediaQ), ATI • Channels (TBA)
Summary • How do you do it without floats? You don’t !!!
Outline • The Audience • The Difference • General Strategies • The Production Chain • Coding • Summary • Q & A • Demo
The Audience • Who you are? • Professional experience • Graphics experience • Art experience
The Difference • Problems in any math • Loss of precision • Speed of calculation • Implementation effort • The artists • With floats you don’t usually notice • In mobile / embedded there is no difference • You can partly choose your problems • There is a difference • Space, Speed, Effort limitation • Try to optimize the recurring effort • Fixed is better sometimes
General Strategies • Don’t fight the system • Some things are just done in float, no matter what • Avoid risky operations • Train the artists • Know your system • Order operations • Debug math • Create precision offline • How many polys per pixel you need • Be careful • Audit the content • Debug the math • Use floats when needed (e.g. physics)
Production Chain • All starts with content • Usually most effort, by far • Optimize effort • Avoid mistakes • Tool chain massages it into suitable shape • Use all the precision you can • Verify everything • Pre-calculate • Real-time processing in the device • Understand the problems • Don’t cumulate the errors • Solutions available, both math only and full game engine
Production Chain: Art • Love your artist • Art is done in float but understanding is needed • Set limits • Use natural one unit • Avoid extreme differences and sizes • Document! • There is enough precision • Scale at export if necessary • Track the scaling factors • Remember textures & UV mapping • Remember device differences • Perspective correction, lights, raw performance differences
Production Chain: Tools • Use all available precision • Doubles are good for fixed point • Select appropriate representation (quarternion) • Filter out all unnecessary data • Pre-calculate as much as you can • Win-win: improves both performance and precision • Verify your content • Weed out problems • Fast preview for artists helps • Verify limits • Useful error messages • Keep the coder out of the loop
Production Chain: Device • Use old coders • Re-use at its best :-) • Avoid risky things, bad things • Order of operations • Use alternative algorithms (normalize, length) • Exploit the content • You know it, trust it! (limits) • Discard errors, not precision • Collect transformations • Delay or eliminate world space • Calculate relative to camera
Coding • Make always the same errors • Use libraries, they are there • Debug / trace your system • Use precision where needed • Cumulation of errors • Catastrophic errors • Low volume • Physics • Alternative ways • Sliding origo • World size limits • Shift decimal point, use multiple representations
Summary • Success is achieved by care and feeding of the artists • Understand your system • Discard errors, not precision • Just do it (without floats) • Don’t reinvent the wheel • There is always a way
COPING WITH FIXED POINT: • Using fixed point in applications on top of OpenGL ES • Maintain accuracy, avoid overflows and methods for improved performance • Effective use of fixed point in OpenGL ES applications • Float to Fixed-point based engine conversions, for those who want to write for common-lite STAYING GROUNDED IN A FLOAT FREE WORLD