Showing posts with label forge. Show all posts
Showing posts with label forge. Show all posts

Saturday, March 3, 2012

Project Forge: World Generation and Town Seeding

Over the past few weeks, I have shifted design focus away from engine components and more onto the procedural generation components of the Forge. I have yet to make the decision on whether or not to use a graphics engine for Forge, or to use something lower-level like openGL.

Anyways the first procedural component I pumped out was a terrain generator. Right now it's nothing special and is just a placeholder until I can iron out all of the details. For the purpose of debugging and working on other features I'm using a 4km by 4km map, however in the future that will probably scale up to something much bigger like 16km by 16km, as long as memory restrictions allow. The placeholder terrain generator actually doesn't look all that bad, and because of how it works, some natural artifacts show up that may pass off as rivers at a later stage in development.
The brighter the blue color, the higher the pixel is from sea-level.

The next item on the itinerary was resource and town seeding. Each town would be seeded on areas of very high natural resource concentration, something I expected would normally happen for towns in real life. Several different resource maps were generated, each of which with their own unique density and spread. This is supposed to mirror how in real life, certain resources like fertile ground may be pervasive for many miles, however resources such as precious metals may only have deposits a few meters wide. Since the NPCs founding towns aren't supposed to be omniscient, they will only recognize areas as having a specific resource if the concentration of that resource passes a specific threshold. For example, an NPC would only recognize an area as having iron deposits because the concentration of iron in the local area is so dense that rocks of hematite or magnetite are found on the surface.
Example of a resource map for Iron. Areas of solid blue are where  traces of the metal are visible on the surface.
The average of these resource maps is taken, and a threshold is applied to the new cumulative map, symbolizing areas where potential settlers would recognize that there are plenty of local resources.
Each blue pockets represents an area with an unusually high resource concentration
For each of these high-density resource pockets, a town is founded. The next step was to connect these towns with roads, a process which turned to be much more painful than I had expected and added over 1000 lines of code to the project. 3 weeks and several cans of coffee later, I found the best solution for generating roads to be the use of Dijkstra's algorithm with a set of cost constraints based on how hard it is to travel through a certain area.
Red dots represent towns, green lines are roads.
Blue background is the cost map, with ligther blue having a higher cost.
For the pathfinding cost map, I did a threshold where if a pixel was deemed to be neigh-impossible to travel through (mountains, swamps, rivers,  etc), then the road would avoid traveling through it at all costs. However in some situations these areas must be crossed because there is no way around, in which case there will have to be bridges, massive elevators (I can dream), or stonework roads required to pass through. In the future it may be possible for NPCs to create their own roads after the initial batch in order to supplement the current system, but speculating that far down the development like probably isn't that good of an idea. 

That's it for this update. Next up in the queue is NPC generation and simulation, which is starting to look like a very interesting component to develop.

-zalzane

Sunday, January 29, 2012

Project Forge Development

I suppose I'll start the blog with a post about a video game I've been working on: Project Forge. I want to see Forge become a relatively-believable, procedurally generated adventure game. It will likely be 1st or 3rd person point of view in a statically sized 3D world.

In terms of procedurally generated content, I want to have the game generate unique towns, cities, and entire civilizations for the player to interact with. Ideally these civilizations would function just like real civilizations, NPCs would have relationships with one another, they would go to work, go home, eat, sleep, wake up late, get fired, get knocked up, have kids, and all sorts of other fun stuff. I want to place a lot of emphasis on the realism factor of these civilizations so that they will grow, expand, and become unique entities all on their own.

In terms of gameplay, I'm not entirely sure of a direction to take. The idea that I play around with the most is having ruins scattered across each world for the player to explore and plunder, however I fear that such gameplay may become repetitive or boring after the first few exploration expeditions, an issue that crops up in a lot of other open-world adventure games like those in the Elder Scrolls series. The solution to this issue may take a lot of time to figure out, which is why I'm going to be working on the procedural civilizations/content before I start in on gameplay.

I'll try to work on Forge as much as I can in my spare time, but between college and work I cannot guarantee progress or blog updates on regular intervals. However on the bright side, I have already been working on the game on and off for the past few weeks, and have made a bit of progress in getting all of the 3D knick knacks working.

Here's a recent image I took of my inability to debug whatever the hell opengl uses to shade primitives. Kinda looks cool combined with the heightmap mesh forming some kind of pseudo-valley of darkness or something.