| Sunday, November 27, 2005 |
 Optimizations |
Posted - 11/27/2005 6:19:41 PM | Just a small update. I've more or less completed the optimizations this week end. I still have a few things to do, but that can wait. The framerate was around 75 fps at surface altitude, 2 weeks ago. It is now around 120 fps, a 60% improvement.
I'm now going to work on improving the quality (nasty texture seams), and adding detail textures.
| |
| Friday, November 25, 2005 |
 Star name generator |
Posted - 11/25/2005 11:01:13 AM | I haven't posted any update since a few days, but as usual it doesn't mean that i've been inactive. I've been optimizing the code (it's not completely finished, but it's progressing well), but today, as a distraction, i coded a procedural name generator for the star systems. There will be billions of systems in the universe, i cannot assign manually a name to each of them, so i needed an algorithm to do that automatically.
There has been a few trials in this domain, for example Elite/Frontier was (as far as i understand) using a set of tables for syllables, and randomly appending them together. Well, it was a bit more complex than that, but not much.
I wanted to test an idea that i had in mind for quite a while: generating "realistically" sounding names.
For that, i took a list of existing names: the minor planets list. It contains more than 10,000 names.
The algorithm analyzes this list to build a syllables table. The first step is called syllabification. For each word, it tries to split it into a set of syllables, according to some rules. As i haven't been able to find an algorithm to do that, i made my own. It uses a few simple rules based on the occurences of consonants and vowels, respectively c and v. x means "anything" and the dash symbol is used to separate the syllables. The rules i used are:
xvcvx => xvcv-x
xcvccx => xcv-ccx
xcvvcx => xcv-vcx
xvccvx => xvc-cvx
xcvcvx => xcv-cvx
xvvcvx => xvv-cvx
xvcccx => xvc-ccx
Application to a few examples:
Mikula => Mi-ku-la
Lucidor => Lu-ci-dor
Friederike => Fri-ede-ri-ke
Flammario => Fla-mma-rio
Minanomachi => Mi-na-no-ma-chi
Of course, it doesn't work perfectly and some words are not split at the correct position, so i'll have to improve the rules a bit. This is typically the kind of things that could take weeks to fine tune, and i do not want to waste my time on that now.
Weird syllables are discarded (1-character, more than 3 characters, or no-vowels syllables).
Once that step is done, a table is built. It stores:
- for each syllable, the probability to have that syllable starting or ending the word
- for each syllable, a table with the list of potentially following syllables, all with their own "following" probability.
The name generator is pretty simple:
- it chooses a syllable pseudo-randomly given a seed, and according to the starting syllables probabilities;
- it chooses the next syllable given the previous syllable and its "following" probablities
- once the word is generated, if the last syllable is not a terminator, discard the whole name and retry.
As a result, some syllables have a high probability of following each other, and some combinations are not possible. Strange words should be avoided.
Here are a few examples of randomly generated names:
zizzarco, griesha, pomoko, butsuma, tsunelle, koukama, korolunon, josondivaik, eryanda, rochenqian, lanagy, almamelnius ...
It's not completely finished yet though: i also have to generate composite words, and words with special symbols.
| |
| Monday, November 14, 2005 |
 4E4 thoughts |
Posted - 11/14/2005 12:33:47 PM | So, the 4E4 contest is over - congratulation to all the winners.
Once upon a time, i wanted to participate to that contest, but wisely after a few weeks, i decided it would be conflicting too much with my main project, Infinity, so i abandonned the idea.
Now that the contest is over, i can safely post the game idea i had for my 4E4 entry.
I wanted to make a kind of "intelligent" cross between Lemmings and a RTS game. The setting: a city, populated by 3 races: humans, robots and zombies. The player is controling either the robots, either the zombies (the other one being controlled by the AI) and they fight for the natural resource: humans (which are "neutral", and also controlled by the AI).
The goal is simple: the zombie player tries to infect as many humans as possible. A simple contact is enough, and a human is transformed into a zombie. They cannot do anything to robots.
The goal of the robots is simple: following the 3 laws of robotics, they have to protect the humans.. at all costs. But they cannot agress the zombies, since these are still too similar to humans. If a human is hit by a zombie in the field of view of a robot, that last one self-destructs.
The humans, well.. they just move around and panic when they see a zombie coming close.
The city is generated more or less randomly, to renew any game.
The player (whether he controls the robots or the zombies), can only give "indirect" orders to his minions (that's where the Lemmings part is coming in). For example, you can place a bait (english?) somewhere, that will attract zombies in that direction. You can suggest orders to robots, but not control exactly what they're doing.. etc..
I thought the concept was pretty neat, but there was balance issues, and i was running out of good ideas for possible "actions" for the robots or the zombies. But maybe.. for the next RvNvPvZ contest.. ?
| |
 Improvements |
Posted - 11/14/2005 5:13:51 AM | This week end, i've been working on a few optimizations.
As i suspected a huge CPU bottleneck, i added a CProfile class to my code, which works hierarchically. You call a CProfile::begin(title) function before the piece of code you want to profile, and a CProfile::end() function after. These calls can be nested. Two informations are gathered: the time (in milliseconds) elapsed between the begin() and end(), and the percentage of time spent in the block of code, compared to the total frame.
In the log it might look like this:
Frame (20 ms, 100%)
{
Setup (10 ms, 50%)
{
UpdateScene (5 ms, 25%)
DoFrustumCulling (3 ms, 15%)
SortObjects (2 ms, 10%)
}
Render (10 ms, 50%)
{
Planet1 (5 ms, 25%)
{
Atmosphere (2 ms, 10%)
Terrain (3 ms, 15%)
}
Planet2 (5 ms, 25%)
{
Atmosphere (2 ms, 10%)
Terrain (3 ms, 15%)
}
}
}
After i added a couple of begin() and end() calls in the important parts of the engine, i ran it, and without too much surprise, discovered it spent:
- around 25% of its time in updating the planet
- around 75% of its time in rendering the planet ( in that case, "rendering" means setting up the scene, sorting the objects, and sending them to the GPU ).
I also displayed the number of terrain patches at ground level: around 700. That's an interesting information, because i've got a unique texture assigned for each of these. I was testing with a resolution of 512^2.. which means it was using 700 * 512 * 512 * 3 bytes of texture memory.. that's 550 Mb ! Despite this, it was running pretty well on my ATI X800 256 Mo, which means the driver is doing its job at paging textures between video and system memory, but i still decreased the standard resolution to 256^2.
Finally, i discovered that a piece of code during the planet setup, was called twice ( while once was enough ). This saved 15% on the total framerate. On that X800, i'm now getting around 85 fps at ground level, but i'm not totally happy with that number ( especially since it'll decrease when i'll add additional effects, clouds, vegetation, the user interface, etc.. ). My goal is to reach at least 120 fps. To reach my number, my next step will be to review the materials sorting code, and especially the way the shaders and their constants are attached, since at the moment i set tens of constants ( which never change ) for each of the 700 objects, and enable/disable the same shaders.
| |
 Terrain integration, step 3 |
Posted - 11/7/2005 5:21:48 AM | 

I'm still progressing. Last week i've been doing a lot of work on the atmosphere shaders (will that stop one day?), especially the parameters at sunset. Another thing i still have to do is the transparency of the atmosphere at night, since at the moment it's fully opaque (so all you see is black, you can't see the stars).
Betelgeuze, a user on my forum, has been kind enough to make some texturing work, and i must say it's promising. He is working on some ground textures mostly for non-Earth like planets (since i've acquired a texture pack for Earth terrains). He's also working on some DEMs (digital elevation maps).
DEMs i hear you say ? "But i thought you were generating your planet procedurally".. ? And you're right, of course, but one problem with generating a procedural planet is that it's lacking "personality". So, what i plan to do is to generate a set of DEMs and to spawn them randomly on some planets, to make some places more interesting to visit. When spawning the DEMs, some parameters can be changed (for example: the type of terrain on which they are placed, can be perfectly flat, or already composed of hills or mountains; or their scale, etc.. ) which means that even if two planets use the same DEM, they will look slightly different. The DEMs themselves are pretty small, so they're covering a very small area of the planet (generally around 50 to 100 kilometers wide), but i hope that will be enough to give more style to the planets, and interesting location points to generate some cities.
This week i'm going to continue on the terrain, trying to fix the seams, and hopefully next week i should start on integrating the detail textures.
| |
| Wednesday, November 2, 2005 |
 Terrain textures |
Posted - 11/2/2005 5:43:51 PM | Thanks to everybody who sent in some suggestions for the terrain textures. I found a nice site that sells a huge terrain texture pack (> 200 textures at 1024^2) for a low price (How in the world terrain texture's pack). Hopefully these are of a good quality, and adapted to what i'm looking for. Back to more work.
| |
|
| S | M | T | W | T | F | S | | | 1 | | 3 | 4 | 5 | 6 | | 8 | 9 | 10 | 11 | 12 | 13 | | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | | 26 | | 28 | 29 | | | | |
OPTIONS
Track this Journal
ARCHIVES
October, 2009
August, 2009
July, 2009
May, 2009
April, 2009
March, 2009
February, 2009
January, 2009
November, 2008
October, 2008
July, 2008
June, 2008
May, 2008
April, 2008
March, 2008
January, 2008
December, 2007
November, 2007
October, 2007
September, 2007
August, 2007
July, 2007
June, 2007
May, 2007
April, 2007
March, 2007
February, 2007
January, 2007
December, 2006
November, 2006
October, 2006
September, 2006
August, 2006
July, 2006
June, 2006
May, 2006
April, 2006
March, 2006
February, 2006
January, 2006
December, 2005
November, 2005
October, 2005
September, 2005
August, 2005
July, 2005
June, 2005
May, 2005
April, 2005
March, 2005
February, 2005
January, 2005
December, 2004
October, 2004
September, 2004
August, 2004
|