Dev Blog #3: Well, THAT's not going to work.

Up to today the visuals for Davenport have been using Unity's UI layout system, which is pretty darn good as these things go.

Then I tried stress-testing it.


I used randomlists to generate 1000 random words and spawned them as 1000 notes in a single drawer.

Ouch.

The framerate - even in a build, let alone the editor - dropped to around 8fps, absolutely unacceptable for interactive use. I'm targeting a smooth 60fps on any laptop or desktop that isn't coal-fired, so this left a lot to be desired.

As it happens, I have a UI engine of my own creation that I've been using in some recent mobile games, so I fired that up and threw 1000 much longer text notes at it:

Not shown: about 980 more

That's more like it: 60fps with 4% CPU and 10% GPU usage. The thing is, for productivity reasons I would much rather work in Unity than in C++ if I possibly can. Surely Unity can't be that much slower?

As it turns out, it can - if you rely on the UI layout system. I did a third test with just 1000 pieces of text and sprites in a scene, and that performed very nicely - about the same CPU as my engine and 15% GPU usage, which is fair since the font renderer in Unity uses a more expensive (but much nicer) shader than I was using. It was a bit galling to see Unity use 3x the run-time memory but that's much easier to live with than a sluggish interface.

The only problem is that now I have to go back to the drawing board with my note rendering and layout code. Better now than later, I suppose!

Comments

Popular Posts