GET ‘/ RescueSquad2 / RenderStats’ 1.1
Sometimes you get an idea that's a little bit oddball but for some reason you can't get out of your head and just have to run with it. This has been bouncing around my head for the last couple of days and has just been translated into code:
Yes, I embedded a web server inside of Rescue Squad and as well as static content (like the images) it can serve up live render stats direct from the game engine. I'm pleasantly surprised how easy it was, it only took about an hour to grab NanoHttpd, integrate it and slightly tweak it to also serve a (semi)hardcoded stats page.
I plan to extend this somewhat to make it more useful, like having multiple (cross linked) pages of stats, a logging page containing trace messages, and possibly a resource/texture/rendertarget viewer as well. Any suggestions as to what else to (ab)use http for are welcome.
May 7th, 2009 at 10:39 am
Interesting. Why a webserver instead of a more general viewer? Did you choose that because it was a convenient way of displaying and tracking the data you need?
May 9th, 2009 at 1:44 pm
I’m not entirely sure what you mean by a more general viewer, could you elaborate?
The advantage of a webserver is that the actual data it has to send back is very, very simple – I just have to output the text and stats I want with a little html markup, and can easily style and make it look pretty with static css and image files.
I do have some in-game debug overlays, but sometimes you want it to show in a separate window, or you need a bigger display area. In particular I want to be able to view the render-to-texture results which are often as big as the screen so having them in a separate browser would be very handy (and make capturing them to file trivial too).
May 11th, 2009 at 11:01 pm
By “general viewer” I just meant a generic windowing system or library where you’d position the elements and text boxes yourself.
I understand the benefit of having simple formatting. I like to do that with log files sometimes, as if you output HTML with the right tags you can use custom CSS to colour and format different types of log messages however you wish. I’d just never considered incorporating an entire HTML browser as a log system within an applicaiton before – it makes sense.
May 23rd, 2009 at 5:21 pm
How would you deal with quickly updating stats? AJAX, Applet, … ?