Advertisement

Creating dynamic maps/levels - strategy

Started by February 10, 2003 04:20 PM
16 comments, last by Dauntless 21 years, 11 months ago
I thought I should create a seperate topic on this issue. I''m worried about an aspect of my game design that my seriously hinder computer system resources. Namely, my game requires HUGE maps. Imagine for a second playing Shogun or Medieval where you have a strategic map of your country, but instead of shuttling your troops into a province and then having a pre-defined terrain type for that entire province.....you instead pick and chose exactly where you want to fight. Perhaps one part of the province is densely wooded and since you mostly have infantry and you know your enemy mostly has armor, you want to travel through there to fight. A huge part of strategy is forcing one person to fight on your terms. That means to a great deal when you want to fight, and where you want to fight. The static maps that are in RTS games are incredibly limiting in my view point. They try to map the entire battlefield and thereby force the player to fight there because that''s what the artists and level designers created for the player to fight in. In essence, players are fighting in arenas that just happen to have lots of natural terrain in them. My game must be more dynamic and freewilled than that. Players get to chose where they fight. But I can''t just have level designers and artists map every square meter of the game world. My only thought was to have generic terrain features on the strategic map describing perhaps the density of woods, elevation ranges and terrain types, and if both players fight at a certain spot on the strategic map, the terrain gets generated dynamically for the tactical map based on the description of the world. This means I''ll have to have some sort of database that describes the world by regions and then through some sort of algorithm, generate the actual tactical map according to the database information. The major disadvantage to this, and one I can''t forsee getting arund, is the incredible load time it will take to go from strategy to tactical gaming. I''m not just loading a map....I''m creating one. If anyone has any other ideas, please drop some suggestions.
The world has achieved brilliance without wisdom, power without conscience. Ours is a world of nuclear giants and ethical infants. We know more about war than we know about peace, more about killing than we know about living. We have grasped the mystery of the atom and rejected the Sermon on the Mount." - General Omar Bradley
You might be able to use a system similar to that used in games like Elite. In that system you have a pseudorandom number generator (PRNG) that takes two numbers as input and generates a single, apparently random number from that. But the number is not random, because it will always generate the same output for a given input. Then when you want to generate some details of a part of the terrain, you enter the map coordinates into the PRNG and use the output to create the local terrain details in accordance with a kind of level-of-detail scheme.

Check out this article for a better description of the technique.
You are not the one beautiful and unique snowflake who, unlike the rest of us, doesn't have to go through the tedious and difficult process of science in order to establish the truth. You're as foolable as anyone else. And since you have taken no precautions to avoid fooling yourself, the self-evident fact that countless millions of humans before you have also fooled themselves leads me to the parsimonious belief that you have too.--Daniel Rutter
Advertisement
I''m using a system that divides each landscape triangle into four triangles, using fractal landscape generation for the 3 new points... seeded by the sum of the length of the vectors making up each of the 3 lines that get split... and it SEEMS to work properly.

At least my 3d engine drew what I had envisioned when I did 5 iterations

I start with 8 triangles, and 5 iterations took my C# code less than a second to generate (Athlon 900)... so it works pretty fast.
Nypyren-
When you do the fractal generation, is it totally random? I can''t have a totally random generator because the tactical map is based off properties of the strategic map. In other words, the strategic map sets certain variable data which are used as parameters for the algorithm to create the terrain features.

Cities by themselves (at least major ones) will actually me entire maps unto themselves. If you''ve played Close Combat: A bridge too far, you know what I mean. So if you decide to attack an area that is close to a river, then the terrain features on the tactical map must include the river, and draw it in a way that makes sense factoring in the direction the forces are coming in from (i.e., if you are crossing a river, then it doesn''t make sense for the map to be drawn such that the river runs parallel to the direction your forces are traveling).
The world has achieved brilliance without wisdom, power without conscience. Ours is a world of nuclear giants and ethical infants. We know more about war than we know about peace, more about killing than we know about living. We have grasped the mystery of the atom and rejected the Sermon on the Mount." - General Omar Bradley
Couldn''t you combine the two approaches? Do fractal generation, but use a pseudo-RNG instead of a true RNG?

(or keep track of the initial seeds -- the RNGs I''ve seen in most compilers are not at all random, which is why there''s lots of code like randomize(time()+pid())...)

Then it would be easy to move data between strategic and tactical maps. Alternatively, if you can keep the strategic map in memory...
If you''re prepared to accept it, tile-sets are one way to go - have a pre-generated set of tiles for various terrain types, and just mix and match randomly (early XCOM games did this reasonably successfully).

Alternatively, you could try and constantly generate likely battlefields in the background of the strategic side - this means anticipating where battles will be fought - how possible this is would depend on how the strategic side works...

Which reminds me: how''s the website coming? I for one would like to see your current status across the board without having to trawl through the forums to find out.
Advertisement
rmsgrey-
I'm working on it, but it's taking me a bit longer than I thought...I guess I had more stuff to talk about than I originally thought It doesn't help that I've been thinking of doing it in XML, then transforming it to XHTML via XSLT....and considering that I know little about XML and next to nothing about XSLT, it's not helping. But I figured that going the extra-mile in making it XML based would make it VERY easy to build a search engine for my website. Also, it doesn't help that I'm pretty much making the switch to Linux 100% (well, maybe 90%, I still need it for games and DVD watching...still can't figure out how to get libcssdvd working...) and figuring out how to do stuff in Quanta and putting the pages in my Apache Web server as a test run (I'm not going to host it off of my server since I don't have a static IP address, and I don't want to do any icky IP Masquerading/NAT translations for people to surf on over).

What I'll probably do is just go XHTML for right now, and convert it to pure XML later once I figure out how XSLT transforms it to an HTML document.

Actually the site is going to be partially about the background of my game world, partially about the design docs to convert it to a computer game (and I have no idea how to do a "professional" design doc), partially about a conversion to a tabletop game, partially a homepage, and partially a page about my own thought processes into game design programming for other newbies like me.

BTW if you want a current status, I've barely begun programming anything yet. Mostly just some UML stuff really on things like Unit design, Commander classes, Order objects, and a basic game logic loop (which I'm having diffuculty with since it's a hybrid system). I figured since I'm still trying to nail down a few key concepts like creating world levels, the "War Machine" details, and AI implementation, I should hold off on doing more prelimary programming until I get it done. Also one more key thing...when I said I'm making the switch to Linux 100% I'm concentrating this game for Linux platforms right now. I'm going to abstract things as much as possible (make abstract event handlers, window classes, pipelines etc) so that a total re-write of the code for Windows won't be necessary, but it'll still take some time (I'm thinking of using Ogre for the graphics engine which is multi-platform, so that should help a bit). Maybe going Linux first will disappoint some people, but I really think the Linux game community needs to come up with more games and I'd like to see something done here. Since my game design is going to be GPL'ed, anybody can take anything from it which is why once I get started, I'll put up the source code (with GPL stipulations of course) for anyone to use.

Hopefully I'll have a rough website up by probably Friday or Saturday, and I'll update it daily from there as I go

[edited by - dauntless on February 11, 2003 11:26:48 AM]
The world has achieved brilliance without wisdom, power without conscience. Ours is a world of nuclear giants and ethical infants. We know more about war than we know about peace, more about killing than we know about living. We have grasped the mystery of the atom and rejected the Sermon on the Mount." - General Omar Bradley
I don''t have anything on topic to say, but www.w3schools.com is a good place to learn XSLT.

I guess when your game comes out, Dauntless, I''ll have to give Linux another try ^_^
---New infokeeps brain running;must gas up!
To generate random maps that follow certain statistics, you need two things: A list of how like each possible land feature (and group them so that features most likely to be next to eachother are next to eachother in the list) is in an area and a pseudorandom number generator that takes two numbers. You use the PRNG to generate 'smooth noise' (I guess it would be perlin noise, but maybe not. not sure if perlin noise is a specific algorithm or a category) where each sample is between 0 and 100.


You go through every spot on the map and use the PRNG to get a number for that spot on the terrain, and you use the table of probabilities to set what type of terrain will be drawn there. Since the noise is smooth, you get patches of one type of terrain instead of totally random spots. Types of terrain should end up groupd in at least a semi-realistic way.

Let me draw some pictures to help explain (will edit post when they are done, or maybe just post again if somebody replies)

Here's what I mean if the above isn't clear (short text with programmer art pictures =-): http://misc.psychosanity.com/random_terrain/

[edited by - Extrarius on February 11, 2003 6:30:51 PM]
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk
Extrarius-
I think I get it from your example that you listed. But I think I''m still missing something.

let''s say you have the United States drawn out on a large strategic scale map. This is broken down not just by state, but by counties as well. Let''s say that the visible portion of a tactical battlefield zoomed out to its maximum represents a 36 square kilometer area (roughly 4x4 miles). Obviously this is a very very tiny area of the overall portion of a state or even a county. So let''s say that I''m moving my troops from Orlando, Florida up to Atlanta, Ga. While I''m heading north, I stumble into some advanced recon elements just south of Gainesville. It just so happens that the Gainesville regions is one of the few "hilly" (if you call the highest point in Florida about 220'' a hill") areas with rolling terrain in Florida. I decide to head to vector my troops on this positions because I know it will lessen the advantages of armor units of the enemy.

In other words, I place move my troops around pre-combat on the strategic map, but once the battle starts it has to take the position from the strategic map I have chosen and convert it into a tactical map.

From what you described, does the top map represent the "strategic" map, and each tile represents the "tactical" map? I can see how this method would work to create randomnly generated terrain, but the terrain can not be totally random in the tactical map. It must represent at a more precise level of detail the kind of terrain that is on the strategic map. In the above example, the terrain on the strategic map is fairly hilly, and mostly open with some scattered "islands" of woods. If the terrain generator randomnly creates terrain with lots of woods and is flat, then it doesn''t faithfully represent what the Commander expected.

Somehow the strategic map has to contain data that describes it at a macro level, but the terrain generator takes this information and converts it into a playable battlefield. What''s more, if a players sends a unit past the tactical map boundaries, then the game must be able to create this on the fly.
The world has achieved brilliance without wisdom, power without conscience. Ours is a world of nuclear giants and ethical infants. We know more about war than we know about peace, more about killing than we know about living. We have grasped the mystery of the atom and rejected the Sermon on the Mount." - General Omar Bradley

This topic is closed to new replies.

Advertisement