Saturday, November 6, 2010

Got my texture on

Seems the texture wasn't working because the video memory was full. Rebooting cleared it right up. I added a placeholder for the lighting.

Clearly, I need to work on the memory cleanup next.

Friday, November 5, 2010

Many many cubes

Finally got the Cyclopean Engine's renderer fast enough for usage. Now I need to get the texture working.

When I was playing Minecraft the other day, I realized the potential for this kind of engine. It would be a bit stupid if Minecraft and Infiniminer were the only games to ever use it, or if everyone had to write their own. (It is trickier than one would think.) So, I decided to make my own engine, which will be free to use and probably open source (eventually), and my own game with that engine.

The name Cyclopean Engine refers to cyclopean architecture, which is when a building is constructed from huge stone blocks, usually made to fit neatly together. The game will probably be called Cyclopean Adventures, and will have some Lovecraft-style horror in it if I can manage that.

While most of the game world will be strictly Cartesian and/or Euclidean, I programmed it with see-through portals in mind, so it will be possible to have areas linked in impossible ways by invisible portals you might not notice, deviating from Cartesian and Euclidean concepts of space. For instance, a mysterious house might be larger on the inside than the outside, and breaking though a certain wall could lead you to a different universe.

I could even make one side of the portal larger than the other, so that objects can change size when passing through, although building stuff will make even less sense then.

By the way, the zone which is rendered consists of 262144 cubes, but it only renders the possibly-visible surfaces, which is why it is fast. If one were to fill the zone with a checkerboard pattern of translucent cubes, it could become very slow indeed.

Thursday, September 30, 2010

Staring at the sun

The new faster renderer is working now. I have also created new textures that use pre-multiplied alpha. Behold the beauty of the sun!

Monday, September 27, 2010

Leaving the Home World

Galactic Throne's map generator now generates an empire for the player and automatically centers on Earth, the Human Empire's capital planet.

It also now keeps the empires' knowledge of the galaxy separate from the actual galaxy data, allowing the player and AIs to have incomplete knowledge. We might know a star's color simply because it is visible from Earth, but we need to explore it to determine what kind of planet there is. Some stars will not be visible from Earth, due to astronomical dust clouds for instance, and will need to be discovered with space craft or seen from another planet.

I have switched over to pre-multiplied alpha in the renderer, but the textures are not ready for that, so no screen shot today. I have also made a plan to speed up the renderer. It runs very well on slower graphics cards, while ironically going slow on my very fast PC. I think this happens because it sends a separate polygon batch for each star. I have decided to render everything with little square images and pre-multiplied alpha, so I can send them as a single batch of quads.

Thursday, September 16, 2010

Nation Builder - Now with ramps!

I have made extensive modifications to the texture generator. It can now create images for ramps and also contains multiple procedural shape generators.

Unfortunately, the ramps still look a bit cliff-like. A have some ideas that I can still try out, though.

The generator used to create the 'rock' texture that I use in the image above is based on a variant of the fault-lines method, but adapted to be tiling and three-dimensional.

I also have a 'sand' texture, using the same algorithm, and 'glass' and 'crystaline' textures generated with an algorithm based on Voronoi methods.

The next task is to create a mouse cursor and to allow the user to interact with the terrain. This will allow me to enable the user to designate digging areas and similar orders.

Friday, June 11, 2010

Dancing Triangles

A screenshot from Dreadnaught (codename). The triangles now respond to the keyboard and half of the physics is in. The triangles fly around nicely, but they cannot collide yet.

Of course, eventually they won't be triangles, but rather textured quads with lighting. And there will be particles and special effects. And a story. And moddability! Stuff will explode!!!

Monday, May 31, 2010

Secret Progress

The secret project, codename Dreadnaught, is proceeding rapidly.

The menu is working; including the switch to the combat test.
The combat screen is rendering, but without textures or lighting.

I am now working on movement, acceleration, rotation and collisions.

I will post screenshots and an explanation of the game when I have more to show.

Wednesday, May 26, 2010

It's quiet. Too quiet.

Yes, I haven't posted anything since early April. The reasons are many, but unimportant.

The last few weeks I have been working on a much simpler game, in secret.

I got a big breakthrough in my work on OpenGL GUI components by reading an article or two about premultiplied alpha in textures.

The name 'premultiplied alpha' originally caused me to think 'Why would you want that?' When I discovered what it really meant, it became clear that I was thinking inside the box. Inside this box the name makes sense, but the concept seems useless. Here is the way out of the box:

Premultiplied alpha is actually a method to separate light that an object adds to the image from light removed by that object from the image. For instance, an opaque green object on a red background adds green light and removes the light from behind it, while a green flame would add green light without taking away any, and a transparent black object adds no light but takes away a portion of the background light. So now you can have all of these on the same texture, rendered simultaneously. Before, you would need to render them in separate passes and with different blending modes, easily doubling the amount of processing done.

Some more advantages are that textures with premultiplied alpha work well for stretching/shrinking the texture, for anisotropic filtering, and for DXT compression.

How it works is, the red, green and blue components of the texture only contains the amount of light added by the texture, and the alpha only contains the proportion of the background light to remove. So, for a non-glowing transparent object, it would be exactly like the normal texture, except that the added light is premultiplied by the alpha, and from there the name.

To render my GUI correctly, I no longer need to align the GUI elements' texels to the pixels, and it also does not matter if they stretch a bit, so I could greatly simplify the code. I have working buttons and images now.

I can now also scale in-game objects arbitrarily, and lighting is simpler than ever. I might not even need any shader programs at all this time.

Keyboard setup is working well, but I need to update my text renderer to use premultiplied alpha and fit in with the GUI components before I can make it possible to set it up from within the game.

Thursday, April 1, 2010

New Dwarf Fortress is Out!

The release that we have been waiting for, for 18 months, is here!

Go get it!

Thursday, March 25, 2010

Creating a galaxy

I am working on a new map generator, and would like to hear any ideas that you might have. (Just post them in the comments.)

The goals:

  • Where you start should influence your strategy.
  • Map features should cause interesting strategic situations.
  • The map should be visually interesting.

The tools:

  • Objects in space (e.g. stars, derelicts)
  • ‘Terrain’ types (e.g. nebulae)

Current ideas:

  • Younger stars near the centre, older stars on the rim.
  • At least three types of nebulae: dark, reflective and luminescent.
  • Stars inside or beyond dark or reflective nebulae are invisible over long range.
  • The galaxy has a number of arms depending on its size.
  • The gaps between the arms are large enough to be hard to cross.
  • Nebulae cover the core and the gaps between the arms.
  • There are cracks in the arms, creating choke points.
  • Wormholes occur, as shortcuts and choke points.
  • There are different kinds of ancient alien remains:
    • Ancient Wreck – Free tech
    • Ancient Ship – Free ship which can be scrapped for tech
    • Ancient Ruin – (Guarded?) A planet with a significant research bonus
    • Ghost Colony – (Guarded) Free colony with infrastructure and artefacts
    • Ancient Factory – (Guarded) Free factory space station
    • Ancient Refuge – (Guarded!) A planet inhabited by an ancient race
  • If I add ‘exotics’ as a resource type, the sources will be black holes, cosmic strings, etc.

Depending on how the ‘huge galaxy’ idea goes, I might even add the option to have multiple smaller galaxies instead.

Eventually, there will also be technologies to allow civilizations to modify the galaxy in various ways.

Friday, March 12, 2010

Space Font

I finished the new font that I want to use in the game. Although, I do think I see some tweaking to do before it's perfect. I used InkScape to create the font, and I rather enjoyed it.

Wednesday, March 10, 2010

Countless millions of stars

I have been thinking of the problems with the 'huge galaxy' idea. To make this work, I decided it would be necessary for the game to support thousands or even a million stars. Of course most computers these days will not handle the amount of AI in such a galaxy well, but it could still be useful for an MMO version, or at least to future-proof the game.

My star name generator could previously only generate about 6000 names before reporting errors, if I recall correctly. This is a problem when there are a million stars.

The new generator can generate three kinds of names.

For the first ten attempts, it chooses randomly between a name sounding like a Bayer designation (e.g. Alpha Centauri) or a traditional name (e.g. Rigel). The Bayer-like name is created by choosing from a list of prefixes and of suffixes and combining the two (13200 possible combinations), while the traditional names are just chosen randomly from a list of 352.

If it does not find an unused name in these first ten attempts, it generates a random name that sounds like a traditional name.

Examples of Bayer-like names:
Octa Aurigae
Zeta Crucis
Aleph Polli
Wau Lacertae
San Cancri
Rubix Vidi
Nona Jordani
Octa Velorum
Omicron Boötis
Rosa Lupi
Chi Sagittarii
Heta Sceptra
Orochi Cygni
Trio Hippopotami
Kappa Gruis
Blu Indi
Ichi Sculptoris
Aleph Roburem

Examples of traditional names:

Examples of random names:

Monday, March 8, 2010

Hello, world!

The new text renderer is working. I think I need a better font, though. I also need to refine the renderer a bit, to make it easier to use.

Friday, March 5, 2010

The Fortekri

For the initial version of Galactic Throne, I need at least two species. I have chosen the Humans and the Fortekri. Eventually I will add more species, and I might even split some species into multiple cultures.

The Fortekri is an ancient species of intelligent social insects, divided into specialized castes. Their nature is such that they all care deeply for one another, and the things that they like doing most are also what makes them most useful. The workers like to work, the soldiers like to guard and to fight, the drones like to organize and invent, and the queens judge the drones according to their merits, choosing their breeding partners carefully.

The high queen is the mother of the queens, and the queens are the mothers of the princesses. Only the high queen may bring forth more queens. And only she and the queens may bring forth more drones. The princesses only bring forth workers and soldiers. The drones are always competing for the higher ranking queens, so that the best drones' genes may benefit the empire the most.

Drones without breeding rights are called taskmasters, and work directly with the workers or soldiers. A drone who is chosen by a princess is called a prince and organizes a group of taskmasters, or a group of princes. A drone who is chosen by a queen is called a king and organizes an entire industry, or an entire planet. The high king organizes the empire, and is of course chosen by the high queen.

Economically, they are very socialist. Everyone of all castes serve the empire, and the empire serves everyone. If there is enough food for everyone, everyone will have enough food. If not, then everyone suffers equally. This decreases the loss of population under harsh circumstances, allowing greater flexibility in which planets to colonize. Fortekri art is somewhat utilitarian, focusing on architecture and engraved signage.

Militarily they are also 'one for all and all for one'. The scent of their haemolymph agitates them, and, in large quantities, can drive them into a frenzy. This means that, when their soldiers' morale gets too low, they go berserk rather than routing, and they will always fight to the last man. This is not always the optimum strategy, so a part of a military drone's responsibilities is to make sure this does not happen unless needed. Their feelings toward each other (and thus, the empire) also make them very resolute fighters, entirely willing to sacrifice their lives for the greater good. If fighting occurs inside a Fortekri colony, the scent might also agitate the workers into forming a militia (armed with high-powered tools and military surplus equipment), but drones can order them to evacuate instead.

The main drawback of the Fortekri is that science and philosophy are only studied by the drones and only to improve the situation directly. Therefore their technology improves only in small steps, and not as quickly as most other species. Their civilization is well in excess of a hundred thousand years old, but only due to recent population pressure did they invent space flight and subsequent technologies.

Tuesday, March 2, 2010

Qoppa Polli

I wanted to test the text renderer, which is definitely an essential part of the game, so I created a star name generator. The names are supposed to be generic, but when you colonize a planet you will be prompted to rename, and it will make a suggestion based on your species.

There are currently 6142 names that it can generate. Here are some examples:

Noir Coronae
Theta Diplodoci
Ni Terrae
Aqua Vici
Ni Ophidiae
Dio Orientis
Aghan Serpentis
Pansa Veni
Gimel Polli
Omega Gemini
Mu Planae
Kappa Loligo
Disigma Incubi
Kappa Animae
Phagun Angelae
Omega Planae
Aleph Succubae
Omega Genii
Aqua Avis
Psi Cloolu

Most of these will not fool an amateur astronomer, but they are a bit more creative than they would be otherwise. And there are some surprises for the observant and knowledgeable.

The text renderer, however, was not working well. Even after debugging one could hardly read the text. It was using a method by which the computer draws the symbols with polygons. When drawing such thin lines as was required by the smaller font sizes, the rasterizer missed the polygons entirely, leaving out the lines. I will create a bitmap based text renderer for my next attempt, which should work very nicely.

Monday, March 1, 2010

Galactic Throne

Last year some time I started work on a turn-based space strategy game with tactical battles, a là Master of Orion. There are several reasons why I should work on Galactic Throne, rather than on Nation Builder (working title):
  • Less graphics programming means more game programming.
  • It can already scroll, zoom and detect what I click on.
  • It is much less ambitious.
  • I am more certain on what I want to achieve with it.
Talking about what I am trying to achieve, here are my goals so far:
  • It should feel real. The planets and the galaxy should feel alive. I believe that this can be achieved by giving the people in the game a will of their own, and giving them a world to interact with.
  • It should feel big. In a real galaxy there are billions of stars with billions of planets and it is billions of years old. While my game will not be that big, it should feel like it. To achieve this, I will either make the map really big, or create events and/or game play that relate the map to the rest of the galaxy. To make it feel ancient, there will be remains of ancient (but not necessarily dead) civilizations and the after-effects of long gone cataclysms.
  • It should add a bit to standard 4X game play, maybe even add another X. Usually in this type of game you are either a powerful all-conquering emperor, or a member of an alliance fighting against such empires. However you unite the galaxy, you win. I will add a third way to play; spies everywhere manipulating politics and economies, even the planets that you rule will not know that you do. An important upgrade to the game play, which will make this possible, is the separation of government and people. This also ties in with giving people a mind of their own.

Friday, February 26, 2010

Walls and floors

I was thinking of a way to do ramps and stairways. After a lot of thought I found a way, and, in the process of adding it, I also made it separate the walls and floors properly, and the walls are now more upright.

My next task will be speeding up the renderer. It is going at about 5-7 FPS at 800x600 at the moment, but I think it can go much faster.

I might also experiment with adding ramps.

Monday, February 22, 2010

Texture alignment

Though you might not see much difference, the changes that I made are important during gameplay. All the stone type boundaries were off by a half cube along all three axes.

I had to modify the terrain shader program extensively, and unfortunately doubled the amount of texture memory required. This means that, to run on computers with 64MB texture memory, the application would need to use lower resolution textures. This is not a problem though, since I believe such graphics cards would not support my shader program anyway.

Friday, February 19, 2010

Again with the rocks

I made the texturing work properly. Just look at this beautiful red sandstone.

Afterward, I added the support for multiple rock types. It is not working nearly as well as this screenshot might lead you to believe. I think I should have stuck with red sandstone, rather than this yellow type. Also, the limestone is looking very blue due to the depth cue. I should fix that.

I am still deciding between using natural stone colors, classifying stone colors, or abstract stone colors.

Thursday, February 18, 2010

Stealth ninja stone

I implemented terrain material texturing today, and created some bright orange stone with which to test it.

Rocks that rock

I made the rock more rock-like and irregular, increased the texture detail and experimented with adding color to the rock.

I also experimented with making the rocks less round, but did not meet with success. I will leave this for much later; there are more important things to focus on.

I will either add soil and sand next, or modify it to allow different kinds of rock with different colors and patterns.

Wednesday, February 17, 2010

Depth and clarity

Today I added the depth cue. It makes it easier to see what is behind what and how far behind it is.

I also managed to make the inside of the rocks black.

Tuesday, February 16, 2010

Some visual upgrades

I have made the stone a bit more matte and fixed a bug in the texture generator. The bug was causing some warping, stopping stuff from fitting nicely.

I have been experimenting with different strengths of my current procedural detail-adder, but I think I should try to create a more rock-like procedure.

Procedural detail strength = 0.15:

Procedural detail strength = 0.5:

The lower strength gives a clearer image, but the higher strength looks more rocky. I'll be going with 0.15 for now, but I will reevaluate this when I have added some depth cues and created a more rock-like procedure.

Introducing Nation Builder (working title)

Since my game, Nation Builder (working title), is starting to take shape, and I think that blogging my progress will make me more devoted, I have created this blog.

The game was originally invented by my brothers and myself and was supposed to be a city-building game with ant-people, medieval technology, trade, warfare, magic and some machines. Back then I called it Formicarium.

Meanwhile, many many years have passed, and Tarn Adams and his brother Zach envisioned their own, similar, idea, and have actually implemented it. If you haven't tried Dwarf Fortress already, I recommend that you try it at your earliest convenience.

Having played Dwarf Fortress, and learned from it, I have decided to create my own game. While it won't be Formicarium, it also won't be Dwarf Fortress 3-D. Compared to DF, my development process will be more focused on tangible-during-gameplay results, rather than nifty tiny details.

Here is a screen shot of what I have so far. This terrain is full 3-d, like Dwarf Fortress would be with graphics, but not 2.5-d like most games. This means you can dig tunnels and build bridges as part of the terrain, rather than as separate objects. (not pictured)