Octodad Tech Postmortem

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
luthyr
Posts: 69
Joined: Wed Dec 30, 2009 5:47 pm

Octodad Tech Postmortem

Post by luthyr »

We recently published a technical postmortem (devonsoft & I) about Octodad on Gamasutra. Since a majority of our findings had to do with Irrlicht, I thought it made since to post here:

http://www.gamasutra.com/blogs/KevinGei ... 4_Tech.php

Custom drivers were written for Wii U, PlayStation 4, PlayStation Vita. The DX11 branch works with Xbox One (with relatively minor changes), and OpenGL ES branch of course works with iOS/Android. PS4 / Vita builds use a lot of the Linux code paths available in Irrlicht. Wii U did as well, but many things were incompatible, such as image loaders, where they worked without change on PS4. The endianness and other peculiarities of Wii U caused a lot of odd bugs.

Some highlights/other notes:
  • Reducing draw calls was crucial to performance (hardware skinning, instancing).
  • Calculating transformation every frame for every object was slow. We solved this by calculating relative transformation separately, only if setposition/rotation/scale actually changed to a new value. We also set a flag to recalculate absolute transformation only if parents relative transformation changed. That flag propagates to all its children.
  • Setting shader uniforms by name was expensive. Rather than storing locations on the game side, we simply stored them in a map in Irrlicht based on the const char address of the string (Lazy solution, but worked).
  • Split scene tree onAnimate() from drawAll to its own animateAll function, for optimization.
  • Character animation is pretty slow and still is. We tried to make some changes to it to reduce redundant matrix calculations. Another change is that we do not remove any duplicate frames. We would have performance hitches when the 'hint' frame failed, causing it to have to traverse the entire list. With no frames removed, the frame index and frame time are the same.
  • Added lots of SIMD functions for console versions to faster calculate matrix calculations, sins/cos/tans, etc. Accomplished with unions and casting.
  • Not specifically Irrlicht-related, but pooling objects and avoiding constant memory allocation/deallocation was important. This included making constantly-used arrays static, and using set_used(0) instead of clear, to not reallocate space unless needed.
  • A good amount of issues early on included floating point error bugs in Irrlicht math and it turning into invalid transforms in PhysX. (Those were reported/fixed).
  • We store a pointer back to the ISceneNode object in SMaterial, since we always need them in shader callbacks.
  • Our editor uses managed C++/C# and uses Irrlicht to render to a form object in WinForms.
  • .X file is our primary animation file format. We use a python script to export from Maya. It's not an ideal pipeline. Loading .X files, even in its binary format, is slow to parse. For Wii U / Vita, we save out all the animated mesh files to a strictly binary format of all the Irrlicht class data.
  • Linux had a lot of issues, we ended up bringing over SDL2, which solved many of them.
Last edited by luthyr on Mon Mar 30, 2015 8:00 pm, edited 2 times in total.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Octodad Tech Postmortem

Post by CuteAlien »

Hi, thanks for the feedback. You don't have patches by any chance? ;-)

Most of those problems are still open. Nadro replaced shader uniform names by integers some time ago, but the rest is probably as it was.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
luthyr
Posts: 69
Joined: Wed Dec 30, 2009 5:47 pm

Re: Octodad Tech Postmortem

Post by luthyr »

I'll try to make some...making patches is always more annoying than just dumping files. :P
luthyr
Posts: 69
Joined: Wed Dec 30, 2009 5:47 pm

Re: Octodad Tech Postmortem

Post by luthyr »

Here is a patch file for our ISceneNode.h:
https://mega.co.nz/#!SJ1GGaCI!8YVu9TsIz ... gA-cCXsSXk

It should be noted that we always use the setters for position/rotation/scale, otherwise this wouldn't work.
devonsoft
Posts: 8
Joined: Thu Oct 04, 2012 2:01 am

Re: Octodad Tech Postmortem

Post by devonsoft »

Here is a patch for the MacOSX changes (touch events and borderless window, joystick changes).
http://octodadgame.com/MacOSX.patch

Here is a patch for our SDL2 device (although this should probably be a whole SDL2 device, not just replace SDL, and includes some custom things like borderless window and some incomplete things.)
Also includes OpenGL changes which include storing shader names in a map, antialiased render targets, and a bunch of other mess)
http://octodadgame.com/SDL2OpenGL.patch

I don't know how well it all fits with Irrlicht coding conventions and it's a bit of a mess, but hopefully it's helpful to someone!
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Octodad Tech Postmortem

Post by CuteAlien »

Thanks for posting! Irrlicht should switch to SDL2 anyway. I just hope to merge the gl-es branch before that.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
archmagus
Posts: 25
Joined: Sat May 30, 2015 4:18 am
Location: Australia

Re: Octodad Tech Postmortem

Post by archmagus »

Will these patches be integrated into Irrlicht soon? Particularly the SDL2 patch (anti-aliased RTT!!).
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Octodad Tech Postmortem

Post by CuteAlien »

Probably not soon. I never seem to find time to continue on the OGL-ES branch (which I want merged first because otherwise it's more work). And Nadro also has enough open tasks already I think.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Octodad Tech Postmortem

Post by Nadro »

Yes, I need to close few more tasks before merge, in last weeks I was busy, but in upcoming days I'll try to find more time for tasks related to irr.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Post Reply