Ben's blog
Software development, games, and all that jazz
Home
Archive
Posts
Pages
Search:
Edit Post
Title:
Body:
<p>I started work on CITS again a couple of weeks ago, yet somehow it's taken all that time just to get a couple of really very simple things done. All I wanted to do was to replace Simul Weather with a skybox of a Simul Weather sky, for debug builds, because it takes half a minute to load. So I went to the Ogre forums to ask how to go about saving a cubemap of the current scene out to file. I got no responses (thanks Ogre community!), so I made up my own way. Prepare for a rant.</p> <p>I figured I'd just have the camera render to texture, then on a button press have it spin round to face each direction, update the texture and save it out. My first bit of fun was in tracking down a bug caused by Simul using the same string name for a texture as I did (moral of that story: don't use string identifiers for bloody textures! What's wrong with pointers or other unique handles?). Even so, once I'd sorted that, I found that it just didn't work like that, and kept saving the currently rendered view.</p> <p>So I thought I'd have six cameras each with their own render target, which I'd set off all at the same time. Except that did exactly the same thing.</p> <p>So then I added in loads of calls to various Ogre update functions, to render extra frames in-between updating the camera and saving images. This worked to a certain extent, but gave very strange warped images for some directions, presumably because the Simul state depends on the previous frame and isn't correct for sudden changes in viewing angle.</p> <p>So then I thought I'd have twelve buttons mapped; six to get the current camera facing each direction, and six to save out the current view to each file, so I could allow the state to settle manually. Except that generated all sorts of weird twisting artifacts half the time, and the other half it'd make the clouds progressively blurrier each time I pressed a button to change the view.</p> <p>So then I sat and tweaked values and mucked about with different ways of setting the camera's direction, and eventually discovered that you could press the buttons in a certain order to get acceptable results, which finally worked. Sadly the sides of the cube don't quite match up despite setting a FOV of 90 degrees and aspect ratio of 1, and the images are even more over-exposed than they appeared in-game (quite how I don't know), but I was really quite bored of Ogre and Simul now and wanted to get on with something more fun.</p> <p>Unfortunately in the process of all this I'd had to downgrade Ogre from SVN HEAD to the last stable release, 1.6, since I suspected it of being buggy, and it just wasn't playing ball with CITS. It turned out that at some point there had been a switch from one memory manager to another, which required me to edit the Ogre source to change it back to the normal one. That was great fun, since changing something so fundamental requires a recompile, which takes a good hour or so.</p> <p>Then OPAL went bad. Well, the code that converts an Ogre mesh to a format OPAL can understand went bad. I'd made some assumptions about the index buffer format Ogre uses, which were valid before 1.6, were valid after 1.6, but apparently weren't valid at the instant 1.6 was released. That's the fun I've been having this evening.</p> <p>It's finally done now though, and I can get on with some more important tasks!</p> <p>There are a couple of other more interesting bits of news about the game, but they can wait for another update!</p>
Tags:
cities-in-the-sky
Body markup:
Plain Text
Textile
HTML
Markdown
ReStructuredText
Draft: