No more buildings any more
Posted by Ben Hymers | Filed under cities-in-the-sky
I've done a wee bit more work; the Person class is now completely gone and replaced by GameObjects with PersonBehaviourComponents. Also Building, and its subclasses SmallHouse, LargeHouse and RaisableHouse are gone, replaced by GameObjects with NormalBuildingBehaviourComponents and RaisableBuildingBehaviourComponents. What this means to me is squeaky clean code and the right to lord it up over other programmers, and what it means for you is that I can now edit my objects.xml file to have a "Lighthouse", "Observatory", "Sheep Factory" and so on without having to go through lots of copying and pasting (and subsequent maintaining) of lots of C++ code. Hurrah!
I actually removed Person a little while ago, but I didn't think you'd be particularly interested. Not that removing Building and friends is any more interesting to you but it was quite significant to me! That, and Rich told me to write another post. Is this satisfactory, o great blog critic? :)
Isn't XML clever?
Posted by Ben Hymers | Filed under cities-in-the-sky
One of the things I've been doing recently is transitioning from an inheritance-based to a component-based game object system. I started the project with full knowledge that component-based game object systems are better, but intentionally didn't implement one since I thought it would be unnecessary for such a small game. It turns out that I was wrong, and since it's something I'm very interested in and have thought about a lot, and since something similar was going on at work, I thought I'd give it a go.
Originally I had specific classes (Building, SmallHouse, Person) that handle everything about themselves (like graphics, physics, game logic) and do all their processing in a big 'update' method. I've factored out and moved around this code through several stages, keeping it building and running along the way, as it's dangerous to just rip it out and start again. Now I'm at a stage where these classes have been replaced by a GameObject class, which owns a collection of Components, whose subclasses like PhysicsComponent and GraphicsComponent are registered with and updated by PhysicsSystem and GraphicsSystem respectively. GameObjects can be created by name from a GameObjectFactory, and ...
Why CITS got git
Posted by Ben Hymers | Filed under development
Subversion is good, don't get me wrong, git is just better! In a nutshell, git is a fast distributed version control system, which supports a much more flexible style of development than Subversion. The two features that prompted me to switch were its distributed nature and its support for branching.
The distributed part is interesting; instead of checking out "the latest version" then checking in your changes, you make a complete clone of the repository (including history), do whatever you want with it, then merge your changes to wherever, you want, however you want. The main reason this is interesting to me (and the main thing that prompted me to use git) is that it means I can work completely 'offline', in that I can view full history, make commits, branch and so on without having access to the server. My server is actually an ordinary desktop PC that dual boots into Windows, so sometimes it's not available, and being able to still work properly when it's not on is brilliant. Using Subversion, I would end up building up large changelists whilst waiting to be able to commit, which is a bad thing. Additionally I wouldn't ...
Migrating from Subversion to git
Posted by Ben Hymers | Filed under development
One of the things I've been busy with is migrating Cities in the Sky's source control from Subversion to git. I'll go over the reasons in full in a later post, but in a nutshell, git supports my workflow better than Subversion since it is distributed and supports fast branching and merging.
Now, there are some good guides dotted around the net which deal with migrating from Subversion to git, and with setting up a git server in a secure and maintainable manner, but I found them lacking a little in friendliness and details. There are also a lot of blog posts that more or less copy those guides and add in nothing of their own, sometimes to cheaply draw visitors to their sites, sometimes "in case I forget where the original is", and sometimes just for the hell of it. Rather than add that little bit more redundancy to the Internet, I thought I'd write up a friendly explanation about just what these guides are doing, along with some extra advice I discovered to be useful.
Installing git and git-svn
So let's get started! The first step is creating a git repository from your ...
Random bits and bobs
Posted by Ben Hymers | Filed under cities-in-the-sky
Just a small update this time; I noticed the lighting was a bit odd in that the surface of the island seemed to be shaded uniformly and the underside was a bit too light, so I tweaked that.
Also I noticed looking at the past few screenshots that the island is the same each time, when it's meant to be random! That's a shame since I spent quite a while making a nice island generator. So I reinstated that code and now it's generating random islands again every time.
You may also have noticed that I'm now using Flickr to host screenshots (well done you). I chose Flickr because Picasa seems to reduce the quality of its thumbnails massively, which is really annoying and makes CITS look even worse than it should do. Also Flickr's image previews happen to be exactly the same width as the text on this page which pleases me :)
Still, one tiny update in over a month? I'd be a bit miffed if I were you. Trust me though, I've been doing all sorts of other interesting things (that don't deserve screenshots) which I'll post about very ...
Happy little chaps and demolition
Posted by Ben Hymers | Filed under cities-in-the-sky
As I said in my last post, the next thing I wanted to get done was to fix up the physics on the raisable buildings by rejiggling the code for the Building class. I've now added 'Debris' which is spawned by each 'Building' when it decides it's time to fall off the island. Currently all the buildings just spawn a piece of debris that looks exactly like the building itself, though in the raisable building's case this means one piece per floor. Since the physics can be a tad unstable at times, this can result in interesting-looking explosions such as that pictured in this screenshot!
You may also notice there are some bright orange buildings there. If you don't notice them you're not looking very hard. They're just replacements I made for the 'tudor house' mesh that I borrowed from Ogre right at the start of this project - it was unnecessarily highly detailed, a bit ugly, and not mine. These new buildings have only one of those problems.
I also replaced the graphics of the people - they're now little chaps made out of several cuboids (what an evolutionary leap!). They're even textured ...
Skyscrapers
Posted by Ben Hymers | Filed under cities-in-the-sky
Tonight I added those raisable buildings I was talking about. This involved a lot more work than you'd think! Mostly this was because it's quite a radical change from the way things are done currently. Each building is made up of several meshes now - a ground floor, a roof, and several middle floors, whereas before there was the assumption that there was a 1:1:1 mapping between building, physics object and mesh.
You may also notice that I've thrown some random rotations of buildings into the mix. This pretty much came for free when I was adding in all the other stuff, so I'm happy since it makes things look a whole load more interesting! Similarly, it'll now be easy for me to add things like stilts/foundations to make sure buildings don't hover like they can now, or to add scaffolding temporarily just after construction, or to change the appearance of buildings entirely (make them more futuristic as the game progresses or the buildings are developed enough). All graphical niceties that I'll get to in time!
Unfortunately I've broken the physics on those buildings since they can no longer just ...
Still bringing home the bacon
Posted by Ben Hymers | Filed under life
Well, if you didn't know already you'll know after reading this or this - Rare announced last month that it would be doing some 'restructuring', which is a friendly term for sacking a bunch of people. The whole process has been farcical at best, and has demoralised everyone thoroughly, but the powers that be have now let some people go. Thankfully I'm not one of them (which is fortunate since my redundancy payout would be pennies, and the Midlands isn't exactly bursting with game development studios that would welcome me with open arms), but it's been difficult seeing some of the people I work with depart, especially those that weren't planning on walking out anyway. I hope they land on their feet, and something better finds them.
So there you go, a brief 'behind the scenes' glimpse at the sham of a mockery of a sham that is the games industry.
Surprise!
Posted by Ben Hymers | Filed under cities-in-the-sky
Hah, I bet you didn't think I'd wait this long before posting those interesting things, did you? Did you?
What I've done is had a good ol' rethink of the way the gameplay is going to work. Up until now, the idea has been that individual buildings fall from the sky and get attached to the island when they hit it. If you build on top of an old building, you destroy both the old and the new. Your score was going to be decided on a measure of each building's quality (depending on where on the island it was placed, and which other buildings were around and so on), multiplied by the number of people, to get a rough measure of the total 'happiness' of your population.
The problem with this is that you'd quickly run out of space and end up being forced to destroy all your old buildings. There would come a time when your island is full, and your task would change from building a nice city to coaxing the physics system into not wrecking everything each time you place a building. Development would be linear, and capped, and I don ...
About bloody time!
Posted by Ben Hymers | Filed under cities-in-the-sky
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.
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 ...
Newer Older

