Archive for March, 2007

Oops! Dodgy Random Numbers with Deltatime

Monday, March 26th, 2007

OK, I just found that I had a random numbers bug in my current code (and, shock horror, in my last 2 released titles (possibly more)). Basically it’s pretty simple and easy to overlook. Let’s say that you want a 20% chance of something occuring per logic cycle so you write some code like this:

If rand(1,100) <= 20 then do something Well that's fine if you call that code a set number of times per frame, say 200. But what if you call it loads of times, because perhaps VSync is off? Well you'll end up with that action occuring way more times than it's supposed to! Of course I use delta time to make sure that my game objects and counters etc don't speed up and go crazy if VSync is off, or if the player goes into windowed mode which may run at any Hz. So basically I need to apply the same principle to the random chance by multiplying the chance by Delta i.e. If rand(1,100) <= 20*Delta then do something This solves the problem. Most of the time delta is 1, but when the framerate is high, delta is often 0 (or close to it) and therefore the random chance is not inflated in such cases. Another thing to watch our for is this: If rand(1,100) > 20*Delta then do something

This looks like chance occurs 80% of the time right? WRONG! If Delta is 0 then 20*0 = 0 so the chance would occur 100% of the time if VSync was off – big bug! So be careful 🙂

Tidied up my Desktop

Monday, March 26th, 2007

Yes, I’ve been procrastinating! However, I feel that it was useful because I tidied up my PC desktop.

Unlike lots of desktops that I often see, I didn’t have any “rubbish” i.e. files that need to be deleted and “new folders” and duplicate icons etc. Also my desktop was carefully planned out into various zones for apps that I use such as logs, current folders, games I’m currently playing etc. However, there was only a small are of useable desktop left! Furthermore, having all these icons often distracted me from my mission at hand i.e. programming a game.

So I did a “boxing up” approach. I’ve still got icons for apps that I use EVERY DAY, and I’ve left shortcuts to drives and folders that I use EVERY DAY, but I’ve boxed the rest of the stuff up into folders like “current” which contains reasonably frequently used stuff, “playing”, “less used”, and “logs” – I’m a bit of a log fanatic but they don’t all need to be on my desktop!

It feels so much better, loads of space and I know where to look if I need something. I’ll just have to retrain myself to the alphabetical ordering of the contents of the new folders as normally I arrange my icons in an importance order.

So I totally recommend that you consider doing this too. It only took me 10 minutes. Note that I already have a tidy desk and office – it goes without saying that this is important too. Don’t give me the “I’m a creative person so I have lots of clutter round” line, that’s bull – I’m creative too and I do my creation in my brain, often when I’m not even in the office. Or how about “It may be messy but I know where everything is”, well so do I, and I bet I can find things quicker than you can 🙂 An untidy office just shows lack or organisational discipline which could be present into other areas of your professional and home life too…

Indie game ramblings

Sunday, March 25th, 2007

Someone on the Blitz forum has posted an essay about indie games entitled Making, Selling, and Thinking Indie Games. draft 1. It’s interesting that they should choose to do this because, as far as I can tell, they don’t actually have any direct experience of making and selling Indie games, although clearly they have been “thinking” Indie games. I don’t particularly agree with many points in the article but I shan’t drag it though the mud. Go and have a read and see what you think.

I made a post that I thought was worth repeating here:

[Casual gamers] are the people that like off-line games like crosswords, wordsearch, jigsaw puzzles, sudoku etc who have money and who don’t pirate games and who don’t want to play violent games. They are well off, have computers and like playing buying and playing games. They won’t buy some Indie developer’s amazing shooter or physics inspired thing that all the coders think are cool, they’ll buy a well polished addictive puzzle game perhaps with a cliche theme.

Really there’s a problem with definitions. Indie may mean people making freeware shooters, or retro-remakes, or weird experimental games or casual games that are invariably clones. Guess which sort sells the most? Should that be your only critera for makeing a game? Of course not – it depends on who you are and WHY you are making a game. Are you making it for fun as a hobby? If so, great do what you feel like – do it for art. Are you making a game for a job? Yes, aha, well try to combine your art with sensible market research and business sense so that you can continue in your job for many years. Pretty obvious really…

I’ll add something else to that post by talking about “retro gamers”:

These are a group of (mainly) men who were once young, but are now in their 30s who played games on 8-bit and 16-bit home computers, early consoles, and in amusement arcades back in the 80s and early 90s. Many of them dabbled with programming too (yes I am describing myself). This market is very interested in either retro-games which look and feel old or retro games that have been modernised graphically and in other ways. *Some* of them will buy games like this, but many will just seek out similar free games and play those or else pirate games instead. Meanwhile they probably also play mainstream AAA PC and console titles too.

So this market doesn’t really actually spend much money on retro games despite being interesting in them. Furthermore this market is *shrinking* as people in it find new interests, have families etc. Unless new people can be brought into the market, it’s not hugely viable.

However, the casual game market is growing every day by a huge amount – so in terms of getting into an expanding market, casual games makes sense. Unfortunately, there is huge (and expanding) competition in the casual games market, so you have to get a lot of things right to make any money. BUT the same could be said for the retro games market; not that’s it’s expanding but that there are a huge number of competitors including tons of free games (and emulator ROMs!) – so to make some money in this niche market is also quite tricky…

Of course, if you are not in it for the money (maybe it’s just a hobby and not your full-time job) then sure, the retro game scene is probably good fun to get into – but don’t underestimate the sheer amount of hours that it takes to make a good quality game in *any* genre.