oreilly.comSafari Books Online.Conferences.


Building Freeciv: An Open Source Strategy Game
Pages: 1, 2

Introducing Artificial Players

Networking matters aside, there was also work to do on the gameplay itself. While designing the multiplayer feature, Unold came away with the opinion that strategy games like Civilization do not fare well under this format: "Imagine five people playing a game of Freeciv. After 30 minutes, one of the players is crushed. The game is probably going to continue for another 3-4 hours, with no way for the unlucky player to re-join."

Unold and his fellow Freeciv creators tried to find a way to keep players in the game by designing artificial players that would start the game along with the real players, but whose control could be taken over by a real player who had been crushed. "It worked, but wasn't really quite satisfying for anyone," Unold said.

Screen shot.
Figure 1. A wide view of players' positions in Freeciv.

The result of this fix, instead, became a test of one's patience. The crushed players who take over AI players are expected to continue putting up as good a fight as possible, and it takes much longer for the winning player to finish the game. This is an issue which was not fully resolved to Unold's satisfaction before he left the project. "We all hate to lose, especially if losing means a long painful process," he says. "In general, multiplayer takes too long to play."

Simultaneous Moves

Another multiplayer issue stems from the fact that players makes their moves simultaneously. A battle unit in Freeciv has both an attack strength and a defense strength. During a multiplayer game, when two opposing units are placed close to each other at the end of a round, the game turns into an action game at the beginning of the next round, since each player wants to either attack or run away as quickly as possible. The only good solution to prevent this would be to disallow simultaneous movements. This, however, says Unold, "would turn the game into a boring waiting game."

Luckily, this quirk turned out to be not necessarily a bad thing. Gregersen, who is now a 30-year-old programmer in Aarhus, Denmark, points out: "The design of our multiplayer model (everyone can move simultanously) created a new variant of Civilization. Even though it has basically the same rules as Civilization II, hardcore Freeciv players play it as if it's a real-time action game like Age of Empires."

Wish List: Better AI, More Art

Under its present administrators, improving Freeciv's AI is the top priority, particularly the client-side AI and server AI. This may entail writing completely new AI code. The issue with the AI is not that it does not work; many good Freeciv players find that the AI is fairly challenging. The problem is being able to modify it.

"The AI code is badly documented, both overall and in the individual functions," says Kristensen. "It makes it hard to make improvements to it. It also makes it hard to make changes to the codebase as a whole if those changes touch the AI."

Other areas in need of improvement are artistic. Jeff Mallatt, a 42-year-old engineer from Arlington, Massachusetts, who formerly maintained Freeciv, points out that the project's greatest weakness is that, while it attracts plenty of programmers, hardly any artists, musicians or technical writers have contributed.

He gives an example which illustrates this problem, and explains the notable absence of sound in the game: "A functioning sound system has been implemented -- in fact, at least two have been implemented -- but not ever finished. The reason: no sounds! The system is worthless without sounds. And no matter how much we beg for sound (or artwork or user documentation) contributions, we rarely get anything. I don't mean to make it sound like Freeciv is in desperate need of more contributors. Contributors of any resource are welcome. It's just that some areas are under-represented."

Screen shot.
Figure 2. A closer view of players' positions. More sound and better art are on the wish list.

It being one of the more successful projects in the open source community, one would think after being in such active development for so long that Freeciv might rival its commercially-sold counterparts in quality and features. It does not, and similar strategy titles like Civilization II and Alpha Centauri clearly have slicker user interfaces, smarter AI, and generally better gameplay overall.

So what then has been Freeciv's enduring appeal among the hundreds who have contributed to its development over the course of six years? Maybe, as Unold suggests, it goes back to the idea of building elaborate stuff, a theme which code-tweaking and the premise of games like Civilization share:

"Playing Civilization is like playing with Lego bricks. Build a civilization from the ground up, taking care of little issues like building roads, irrigating, city planning, etc. It's so geeky and we love it."

Howard Wen is a freelance writer who has contributed frequently to O'Reilly Network and written for,, and Wired, among others.

Return to the Linux DevCenter.

Linux Online Certification

Linux/Unix System Administration Certificate Series
Linux/Unix System Administration Certificate Series — This course series targets both beginning and intermediate Linux/Unix users who want to acquire advanced system administration skills, and to back those skills up with a Certificate from the University of Illinois Office of Continuing Education.

Enroll today!

Linux Resources
  • Linux Online
  • The Linux FAQ
  • Linux Kernel Archives
  • Kernel Traffic

  • Sponsored by: