Game Design, Programming and running a one-man games business…

Optimizing dilemma of the day

Below is an image from Gratuitous Space Battles 2‘s ship design screen. On the left is my problem. That’s a load of ship components you can add to a hull, rotate, change size, color etc. All very cool. The problem is that you might choose to have BIG versions of some of them, as main structure bits, so the source graphics have to be big, normally 256sq for sub-components.

blog

Ok, so that’s cool, but the problem is, when I load in those icons I’m loading in a DDS file that is 256 square, which means about 170k in the format I’m using. If I have 300 of them (rough guess) then that’s 51MB of file access, which is bad but not catastrophic, but it does mean 300 distinct file accesses, which is slow, even after I’ve rewritten the DDS loader to be massively faster. As a result, when you click on ‘edit appearance’, there *might* be a slight delay, which is intolerably awful for someone like me with zero patience. And I have a FAST PC, I want this to be fast and smooth on low-spec.

So as I see it the options are:

1) Only load visible ones, then load the others as you scroll (could be irritating for scrolling)

2) Load in placeholders, and spin off the file accessing portion of the texture load into a separate thread, then when they are all there, interleave the texture creation with the display frames of the main thread (DX9 so only main thread may do DX stuff). This seems ultra complex and hacky.

3) Save out small preview images for each item, and load those instead. Less memory, but a bunch of useless duplicate files AND still 300 file accesses.

4) Stick em all in a single big pak file and see if that’s quicker. This is easy, but I find it messy during development as I’m always adding/removing/editing files in those folders, so I need a hybrid debug/release system.

I think I might have to go with 4…

I know file access is slow but….

As a programmer, you learn fairly early on that file access is very slow. The slowest place to get data is the hard disk, we all know that. Ok, maybe tape storage. But it always amazes me just *how slow* it can be. I don’t mean the stuff like reading a texture file from disk, you expect that to be tiresome, but just file-system operations stuff. I guess I’ve always assumed that because modern hard drives have cache chips on them, and we also have a LOT of RAM available to page stuff, that querying the NTFS (or whatever file system you have)  file table should be fairly quick.

In other words, seeing if a file exists, or enumerating files in a folder shouldn’t take an age, if I’m not actually going to load in the contents. Doesn’t windows know enough about optimizing to page chunks of the FAT into RAM?

Maybe it can’t, or it doesn’t work that way, but I have discovered, to my mild surprise that if you don’t want to use compressed or locked pak files (I like an open file structure to encourage investigative modders), it actually makes enormous sense from a performance POV for you to scan your whole game folders file structure into disk and manage your own file-cache for stuff like enumerating filenames later on.

Why would I not know what files to access already? Well GSB2 writes a lot of files at runtime, and it also handles some objects having companion lightmap files, or sometimes not. The simplest and most flexible system is for it to check for companion files at runtime on startup, and then field any FileExists() calls internally. It’s faster. And I mean its 10x as fast, we aren’t talking 1% speedups here. Things are now getting to the point where I just assume all O/S code is sluggish bloatware and write my own versions whenever possible. I might eventually have to do some trickery involving multi-threaded file-loading, or loading in only specific mip-maps from files at specific points.

I do actually REALLY enjoy this kind of thing, which is a pain because I should be fixing bugs, implementing features and generally trying to keep GSB2 on schedule. Not to mention some new D3 DLC and the TOP SECRET THING. Oh and SMTG.

It’s a good thing I already have a holiday booked this year, as I’d never book one now if I’d waited this far :D

Can I quote you on that?

“Cliff is awesome, but a bit arrogant, Would talk to again 4.5/5”

I’m shamelessly fishing for reviews. Not actually for ME, as I already have enough of an inflated ego to drown out any potential reviewed downsides. Nope, I’m after reviews for Democracy 3, from people who bought it. Just one-sentence reviews (or maybe 2) with peoples names and rough locations (Ohio! for example).

You know the kind of thing

I’m going to collect some and put them on the Democracy 3 page. They have to be genuine obviously, because I have ethics, like a vulcan. So if you bought the game direct from me, that would be awesome, because I can then look up your order and confirm it’s real. Maybe I’m being too paranoid there, I just don’t want people to think I’m being dishonest, which I’m not. Obviously there are tons of great steam reviews, but those are probably copyrighted or whatever.

Anyway, if you did like the game, pls email cliff AT positech dot co dot uk, with your review, and that would be fab :D

Gratuitous Space Battles 2 Ship Customizer! Oh yes…

Behold the latest video. I think you will like this one. Plus, this is with my spangly new (pricey) microphone. can you tell the difference? Not sure I can, but let me know if it’s any better!

I’m sure people will have some questions. If you don’t see this is a big cool new feature that totally changes GSB, then watch it again :D It’s going to be awesome fun seeing what people can do, especially given how crazy people went with mods for GSB1 and that was without any ability to change graphics within the game. Let me know what you think…

Marketing games in 2014…hmmmmm.

I’m always a bit paranoid about being out of date. I don’t want to be the guy who is putting the finishing touches to his betamax product line just before he hears about VHS. I don’t care so much about coding tech, as I think the costs ofg switching tech to the latest version outweigh the benefits. Especially if you do whatever Microsoft say is cool, which changes every year. Is silverlight still a thing? hell…I remember when VRML was the tech of the FUTURE.

But like it or not, the internet changes, gamers change, and we have to roll with it. Subscription MMO’s are dead. F2P is the default now. That’s a BIG change. iOS games went from being non-existent, to gold-rush, to a great way to lose money in just a few years. Internet ads have gone through so many fads it’s hard to keep up!

So where do we find ourselves? I’d guess we find ourselves in 2014 with these priorities:

  • Video content is king
  • Social media is king
  • Buying your way to attention is getting very expensive
  • Huge centralization of online community control.

I am not a youtube user, on the whole. I watch the odd trailer and technical video, but I never watch let’s plays. I am too impatient for that. I don’t want to hear someone talk about the main menu screen for 5 minutes, I might only *play* a game for 5 minutes. And when I’m relaxing, I’m in a room with a TV on, so I prefer text only. But like it or not, video is huge. As a result, I spent a lot more now on producing video content than I did before. I have an actual video camera (a cheap one, but at least a proper one) and a decent microphone, ready for test-driving tomorrow. I’m going to try and release more and more video content.

Social media is a big thing, but tbh I don’t mind. My twitter account seems weirdly popular, and this blog is even more popular. This has never been a strategy, it’s just me being me, so that worked out quite nicely. I’ve made a bit less use of facebook, reddit etc, because I just have so little time, but I can see they are important.

Simply sitting in a dark room without either of those and just buying advertising space is getting harder. Ad-costs are high. A lot of billion-dollar companies are throwing cash at each other in a mud-fight, and us indies can’t afford to get in the middle. Some of the CPC ads can still be worth doing, but CPM is going up and up. Anyone who thinks $5-10 CPM is ‘a good deal’ is smoking something. It absolutely isn’t, unless you are selling accident insurance.

There are very few places now to be heard. A lot of those big gamer sites you enjoy are owned by parent organizations who own three or four or more of them. Big media companies like buying other media companies. I think starting a new site these days is very very hard. You struggle so much to get the slightest attention. Right now there are probably just about enough media outlets for indie PC gaming to keep up a sense of competition, but if things consolidate more I’d start to worry that we are back to 2 or 3 companies deciding your fate as an indie games business.

Interesting times…