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

Democracy 3 and rendering crisp text in directx

Democracy 3 is a text heavy game. Text and stats, and graphs. So it’s pretty important it is all legible. I’ve spent the best part of two days monkeying around with my text rendering code, which is part of my library (all written by yours truly), trying to get better results. My aim is obviously easy readability. here is some text from the current (Democracy 2) game: (excuse the bitmap format but obviously I don’t want to add artifacts here…)

oldtext

And here is the current implementation in Democracy 3 (different color scheme too).

newtext

I think the second example is marginally better, but frankly that’s just a better color scheme and bigger text. the actual *quality* of the text is certainly nothing special. What I want, clearly is something as good as the text I see windows drawing in webpages and text documents outside of games. Unfortunately, that isn’t as easy as it sounds.

Most LCD monitors are set up to use cleartype, information on wikipedia. This is a cunning system that effectively increases the screen resolution by using colored ‘sub-pixels’, You can see the effect by taking a screen grab of this page (for example) and then zooming in really close. You will notice this text isn’t really black, or indeed one color. Some sort of cool display/monitor-driver cleverness handles this when it displays text. The trouble is, you can’t just ‘enable’ that for a game drawn the way I do things, where each character is effectively a tiny sprite. It just can’t be done.

Now there ARE some clever solutions to get amazing text, I know valve have some clever system, but this all involves implementation of a bunch of third party code and shaders. That isn’t a big deal *as such*, but it means that I have to cannibalize my extensive current GUI library and font loading and text-wrapping/aligning/processing stuff to work with all new systems. This would be a ton of work, and increase the spaghettiness of my library, something I am keen not to do.

I have tried just doubling my bitmap font size and using mip-maps to scale it down, but if anything that looks worse, so I’m trying to keep to my current system, which uses a 1:1 pixel to texel mapping with point filters engaged to get exactly what I see in my font bitmap file.I have a horrible feeling that swapping to black text on white screens is just going to look far worse than white text on black, at least from a  text-crispness POV.

There is of course, also the issue of opportunity cost. Is more time spent on this a good idea when I could spend that time elsewhere in the GUI, or for that matter, the simulation or game balance. Democracy 2 never earned me anyone bemoaning it’s crappy text, maybe the new text is good enough? Developers – What system do you use for text-rendering in games?

edit: maybe this black version looks better?

blacktext

More Democracy 3 simulation fun and games

The core mechanic of Democracy 3 is going to take a lot of careful explaining in tutorials and tooltips and help windows. Essentially, it’s pretty simple, in that you implement policies, and you can adjust the intensity of a policy using a slider. So with a policy like income tax, the slider adjust the rate of tax from low to high. A series of bars show you the effect this policy has on everything, such as voter happiness, GDP, and so on. Sounds simple so far right? This is where it gets complex because there are three additional factors, which are implementation times, effectiveness and inertia. I’ll explain each one:

Implementation times is the amount of game time it takes to introduce a new policy. For a new tax rate, it’s instant, but for a space program, it might be five years. The policy effect fades in over those five years. So for example, if you set the slider to maximum, and the effect on GDP is +10% at maximum, then one year after introducing the policy, all the effects are still only at 20% of their maximums, and the GDP boost is thus 2%. Implementation rate is also the rate at which you can adjust a policy. Again, with tax rates it’s instant, with big infrastructure projects, you might move the slider from 0.5 to 1.0, but it will gradually make it’s way there over time, and the effects will scale accordingly.

Effectiveness is a general multiplier for all of the effects of a policy, and this is based on the minister in charge of that department. He can be bad, reducing its effectiveness, or good, which boosts it. Over time, all ministers get more experienced, so their effectiveness will go up.

Inertia indicates the extent to which policy effects lag behind implementation. For example free school meals increase total population health, but it’s a very slow effect, over time as school children grow up, and maintain those healthy eating habits. So the effect may have an ‘inertia’ of ten years (Should be longer, but for gameplay reasons…). This means that even though the policy is fully implemented, it’s full effects aren’t being felt yet, and also, when the policy is cancelled, the effects may linger on afterwards, slowly declining.

Combined together (and this is just part of it), it’s uber-complex and subtle. It means that at any one time a single policy may be becoming more effective as it gets more implemented, and more so as it’s minister learns the ropes, whilst at the same time be drifting towards lower values as the effects of a policy change since it was introduced take effect, and at the same time as all this, the various effects it has may all have different rates of ‘inertia’ and thus be shifting in different directions :D

Fortunately I’ve learned a lot of stuff about GUI design from earlier games. I’m sure it will be fine :D

 

New Blog Design!

Well it should be immediately obvious to anybody reading this, that I finally got a proper design for my blog sorted out. It’s been a long time coming, and the blog gets more and more popular over the years, so I thought it was about time I invested in having a theme properly designed and implemented. I admit that I am way too busy with other stuff these days to learn the finer points of CSS and HTML, let alone javascript and flash. it makes much more sense to do what I’m good at, and use the profits from being more productive to hire someone else. That’s just good old fashioned division of labour. If I ever go the extra mile and employ people to write my blog too, you know I’ve sold out. (yes…some people DO so that…)

Quite a few indie devs write blogs these days, and I find a lot of them very interesting and readable. it surprises me that the big companies can’t see through the legal paranoia and allow their lead designers and coders to keep a regular blog. I’d love to read a blog by the lead coder or designer at Maxis. I don’t mean a once-a-month update that has been vetted by three different marketing departments and lawyers, but a real blog, with regular updates on what it’s like to do that kind of stuff.

Anyway I digress… I will have lots of very technical explanations of the inner workings of Democracy 3 coming up. if I ever start suggesting I’ll code Democracy 4, just tell me to have a lie down, and remember how involved this one was…

Noisy guitar interlude

I have been doing uninteresting adminy stuff today. Hardly any exciting code. I may just have found a core simulation bug however. More interesting news to come…

In the meantime here is a man in his early forties remembering how much guitar strings hurt when you don’t play any more.