Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3 ... 7

Author Topic: A Creative Programming Project: Merchants Quest  (Read 18448 times)

Killjoy

  • Bay Watcher
    • View Profile
A Creative Programming Project: Merchants Quest
« on: December 24, 2012, 08:51:43 pm »

Hello there fellow bay12ers.

I am Killjoy, I am pretty new on these forums, but nevertheless I want to share my latest personal programming sideproject with you all! This thread will be the development/update thread. I plan to add development posts where I show the process of developing specific game features.
I honestly have no great plan for how I want to go about doing this, nor do I have any plan about what I want the end product to look like. Perhaps I will figure something out along the way. For now I just want to have a game about trading in a extremely hostile and random world.
Please note that English is not my native language, so no need to berate me for making mistakes.

The premise
The game is pretty simple at its core.
You play a merchant, stuck in a procedurally generated fantasy world. Your goal is to trade, establish trade routes and create industry.
Simple huh?

Technology
The game will be written in Java, as the development will double as some Java development experience.
I am by no means a Java expert.. My foundation is c/c++, and at work I work with python.

Update log
Day_1: Below
Day_2: post
Day_3: post
Day_4: post
Day_5: post
Day_6: post
Day_7: post
Day_8: post
Day_9: post

Day_1
Let us start by making a window. It is not much, but it is a start.
Spoiler (click to show/hide)

An empty window is pretty boring, and hardly anything gamelike. Perhaps I should start by making a terrain. I decided on a pretty retro style, by iterating through each point on the terrain drawing a pixel directly above the terrain point. This way I can just use the terrain offset to create a cheap and retro looking graphics style.
Spoiler (click to show/hide)

Okay, if you think this looks like a square, then you are right. I have not added any height variation yet, but lets try tot add some random perlin noise to the 'terrain'.
Spoiler (click to show/hide)

Personally I think this looks extremely boring, this is technically three dimensional, so lets add some rotation.
Spoiler (click to show/hide)

Great, now I can spin the whole thing around. This will help exploring the terrain later. I think it's time to stresstest the whole thing, so I increased the mapsize to 1024x1024
Spoiler (click to show/hide)

Okay, the terrain lacks detail. You cannot even see it is three dimensional, as it just looks like a green blob. The terrain should change color depending on what height it has for now, I should just try with some simple color scheme.
Spoiler (click to show/hide)

It still looks a bit bland. So perhaps adding water will give that much needed definition to the terrain.
Spoiler (click to show/hide)

Water did make it much more interesting to look at, I found a pretty cool cove. But the terrain itself still lacks detail. I thought long and hard about this, and decided I should try using something called normal mapping. The details are not really important, but basically, things facing the "sun" should be more illuminated than things not facing the sun. Perhaps that will give me the much needed detail.
Spoiler (click to show/hide)

Okay, that did the trick! The terrain looks pretty cool now. I doubt I will want to work on it more. Now that I have a simple game world, I should throw some random cities(okay, just points, with names) around the map and see how it looks.
Spoiler (click to show/hide)

This looks pretty neat. The city Nyvy has taken the cool bay/cove like feature I found earlier, and it looks like the city of Rumsa is guarding the bay and city of Xulrullug. All the city names are basically generated from a short list of consonants and vowels, in the future I might want to add some more sophisticated name generation.

Anyway, that is all I managed to make today. Anyway, feel free to leave a post, I would like some suggestions to how the gameplay itself will play out.
My next task will be to actually add some city rendering, and perhaps add calculate some trade routes between cities!
« Last Edit: January 15, 2013, 05:12:19 pm by Killjoy »
Logged
Merchants Quest me programming a trading game with roguelike elements.

freeformschooler

  • Bay Watcher
    • View Profile
Re: Programming Creative Project: Merchants Quest
« Reply #1 on: December 24, 2012, 09:36:37 pm »

That is some good looking terrain. Reminds me of old generated game maps like in the Civ series. I'll be watching this.
Logged

GreatWyrmGold

  • Bay Watcher
  • Sane, by the local standards.
    • View Profile
Re: Programming Creative Project: Merchants Quest
« Reply #2 on: December 24, 2012, 10:29:33 pm »

The software as it is now could be useful as a quick map generator. Not bad for a day.
Of course, no game yet.

I'd be interested to see where this goes. How will the cities develop? Will history be simulated? Will there be at least aesthetic differences between cities, based on terrain, neighbors, etc? How much are varying biomes and such simulated?
Logged
Sig
Are you a GM with players who haven't posted? TheDelinquent Players Help will have Bay12 give you an action!
[GreatWyrmGold] gets a little crown. May it forever be his mark of Cain; let no one argue pointless subjects with him lest they receive the same.

Killjoy

  • Bay Watcher
    • View Profile
Re: Programming Creative Project: Merchants Quest
« Reply #3 on: December 25, 2012, 05:43:07 am »

That is some good looking terrain. Reminds me of old generated game maps like in the Civ series. I'll be watching this.
That was the idea! :)

I'd be interested to see where this goes. How will the cities develop? Will history be simulated? Will there be at least aesthetic differences between cities, based on terrain, neighbors, etc? How much are varying biomes and such simulated?
I am doing a little more work on the world now, as I need it before starting doing any history.
Cities will develop based on proximity to natural resources. Just now the cities are just points on the map, but I had in mind to actually render them. I still don't really know how much I will go into those details.
Biomes will be placed mostly using some random noise. But things like elevation, temperature and humidity will affect whether or not they are actually placed.
Logged
Merchants Quest me programming a trading game with roguelike elements.

GreatWyrmGold

  • Bay Watcher
  • Sane, by the local standards.
    • View Profile
Re: Programming Creative Project: Merchants Quest
« Reply #4 on: December 25, 2012, 10:38:45 am »

I'm glad my expectations weren't too high. Keep up the good work and Merry Christmas!
Logged
Sig
Are you a GM with players who haven't posted? TheDelinquent Players Help will have Bay12 give you an action!
[GreatWyrmGold] gets a little crown. May it forever be his mark of Cain; let no one argue pointless subjects with him lest they receive the same.

Killjoy

  • Bay Watcher
    • View Profile
Re: Programming Creative Project: Merchants Quest
« Reply #5 on: December 26, 2012, 09:38:14 am »

Day_2
Making the world come alive
Yesterday I sadly did not get to work much on the project. It is that time of the year where there are a lot of "Yule" feasts, yes I am scandinavian.

I spent quite a lot of time thinking how exactly I wanted to go about making the world. I did not want the biomes and resources not to be hardcoded, but rather easily modifiable. So, I decided that all biome data should be in XML form, and the game would then place them in game based on this data. An example biome XML file below:
Spoiler (click to show/hide)
I want resources to be able to require specific biomes. For an example a hypothetical "sand" resource could require almost any biome. The means that both Plains and Desert should be able to contain a "sand" resource. I should this by making an <inheirits> tag. By doing this the "sand" resource could require the "base" biome. Biomes should also be able to do more advanced things like modify the output of a resource. So our "sand" resource could have another property called "outputModifier", which would modify output based on some factor, if the biome it resides on is a specific biome and not just one that acts like BASE.

Either way, after making these sample biome files, and learning how to load them. I knew I should start working on making more advanced world generation. First step? Making a temperature gradient. So I took my terrain back to basics:
Spoiler (click to show/hide)

In real life temperature varies based on latitude. The reason for this can be explained by trigonometry, in my simplified world it can approximate it using the sine function, so we get a nice latitude based gradient:
(Red, means warm, black means cold)
Spoiler (click to show/hide)
This approximation is not really accurate, it assumes that the planets rotation axis is orthogonal to the orbital plane. In real life the earth is tilted. This means that the regions that gets the most sun exposure is only equator, but also the areas around equator:
Spoiler (click to show/hide)

I like this temperature distribution more.
Temperature is also based on elevation, sun exposure, and humidity. Let's start with elevation and sun exposure. These are easy enough to calculate, and gives us this temperature distribution:
(Blue very cold! Green temperate. Red tropical)
Spoiler (click to show/hide)
I like the temperature gradient a lot. I doubt I will work much more on it for now, I will perhaps factor in humidity when I implement it.

Time to try out the biomes now! (I will ignore humidity for now and figure out a way to calculate it later, I imagine I will have to do some simple cloud/weather simulation, so it can wait for the next update)
Spoiler (click to show/hide)

Success! The biomes work! I want to add some more advanced biome functionality, but it should be fine for now.
Next step, work on humidity, more biome options and resources.

If you have any suggestions or questions, please feel free to post them! :)
Logged
Merchants Quest me programming a trading game with roguelike elements.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: Programming Creative Project: Merchants Quest
« Reply #6 on: December 26, 2012, 10:26:09 am »

I'm wodering how you have that mad productivity. :<
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Killjoy

  • Bay Watcher
    • View Profile
Re: Programming Creative Project: Merchants Quest
« Reply #7 on: December 26, 2012, 10:57:47 am »

I'm wodering how you have that mad productivity. :<
I have nothing better to do right now, also the project is going well so I am enjoying it. :)
Logged
Merchants Quest me programming a trading game with roguelike elements.

JWNoctis

  • Bay Watcher
  • Definitely still alive
    • View Profile
Re: Programming Creative Project: Merchants Quest
« Reply #8 on: December 26, 2012, 11:57:03 am »

Definitely looks interesting, posting to watch.

And by the way, what do you mean by "extremely hostile"? Does that mean dangerous creatures, roving brigands, xenophobic civilization, unstable politic and economy, extreme climate, or a combination of these and more?

Anyway, that's really some progress for just two days! Keep it coming!
Logged
[LANGUAGE_2:ENGLISH:HOPELESSLY_BROKEN]
Adept Lurker

Araph

  • Bay Watcher
    • View Profile
Re: Programming Creative Project: Merchants Quest
« Reply #9 on: December 26, 2012, 01:56:54 pm »

So, you've made a terrain generator, complete with biomes, temperatures, and resources.

And you did it in two days.

I'm wondering how you have that mad productivity. :<

My current theory is that he's actually a time-traveler. He's been looping through the past two days to get farther along without us knowing.

But seriously, awesome job so far! I'll definitely be following this thread.
Logged

Killjoy

  • Bay Watcher
    • View Profile
Re: Programming Creative Project: Merchants Quest
« Reply #10 on: December 26, 2012, 02:35:33 pm »

And by the way, what do you mean by "extremely hostile"? Does that mean dangerous creatures, roving brigands, xenophobic civilization, unstable politic and economy, extreme climate, or a combination of these and more?
All of the above, or some of them, I don't know yet. What I do know is, I want loosing your merchant to be frequent.
I was thinking that perhaps you should not be playing a single merchant, but rather a family. You always play the head of the family, kinda like Crusader Kings.

My current theory is that he's actually a time-traveler. He's been looping through the past two days to get farther along without us knowing.
But seriously, awesome job so far! I'll definitely be following this thread.

Hehe, no, I just have a lot of free time =)
Thanks! I am working on doing some simple cloud simulation right now, so I can make proper humidity gradients, and have more interesting biome placement. Resources are not implemented yet. They go in after biomes.
Logged
Merchants Quest me programming a trading game with roguelike elements.

thobal

  • Bay Watcher
    • View Profile
Re: Programming Creative Project: Merchants Quest
« Reply #11 on: December 27, 2012, 01:50:17 pm »

Well hell, this is how fast normal people work? I may as well give up now.
Logged
Signature goes here.

Killjoy

  • Bay Watcher
    • View Profile
Re: Programming Creative Project: Merchants Quest
« Reply #12 on: December 27, 2012, 01:52:04 pm »

Day_3
Making it rain
In my biome definitions I added humidity as one of the factors. I wanted humidity to only depend on rainfall in my simplistic world, but how does one calculate rainfall?
I originally did not plan on spending a lot of time on calculating rainfall. But I ended up making it way more advanced than originally anticipated.

First of all, clouds are evaporated water. So, let us start by isolating all the water in the world:
Spoiler (click to show/hide)

The water periodically spawn clouds. Clouds should disperse themselves, this will help them "get around corners", which will be useful later. For now the simulation just generates "blobs" around the water sources, which is perfect for what I want.
(For the more technical minded, the spread is basically Gaussian distribution, it is almost same algorithm you use to blur images)
Spoiler (click to show/hide)

Clouds are not static objects, they follow wind currents around globe. I don't want to simulate wind currents as it would make it a bit complicated. Instead I just cheat and all two main wind currents. A global west to east wind, and random coherent "any direction" wind. This way clouds will start forming pretty cool looking paterns:
(On this screenshot it is just the "west east" wind)
Spoiler (click to show/hide)

The east to west wind should only effect the cloud perodically as well, it creates much needed variation in the cloud density:
Spoiler (click to show/hide)

As it is right now, clouds only spawn from water sources. But, as the world does not wrap around right now, it will create quite a lot of deserts in the western parts of the world. So, instead I implemented random clouds to randomly "drift" in from the western border using perlin noise:
Spoiler (click to show/hide)
(You can't really see it much, but it adds to a better looking map)

Next step is to add random wind currents. This is done by generating 3d perlin noise, and moving through the "third" dimension to simulate change. Using this noise value, a random direction vector is calculated and the cloud is moved in this direction. Since the noise is "coherent" the movement direction is also coherent. Here only clouds above 0.5 in weight are drawn. These clouds will be making the terrain "wet".
Spoiler (click to show/hide)

Time to test out some rainfall, and see which parts of the world get wet, and what parts are left dry.
(Blue = high humidity, Black = Ocean (Ignored for now), Dark green = low humidity, Light green = mountain/low humidity)
Spoiler (click to show/hide)

Now, lets put everything together:
Spoiler (click to show/hide)
Perfect, this is what I wanted when I first started the project!

Alright, time to load in some test resources and distribute it on the map.
Resources like biomes, are also loaded from a XML file. This makes it very easy to add more resources when I feel the need for it. They follow this scheme:
Spoiler (click to show/hide)

After loading the resources, and planting them on the map. The result looks like this:
Spoiler (click to show/hide)
(Sorry, it is a bit cluttered, but it is to demonstrate the distribution of resources!)
For now modifiers are not in effect, but it would be easy to hook up. It is on the TODO list in my eclipse project!

That is it for Day_3, next up I will add some more resources, and work a bit on the cities, hopefully I can implement path finding to create trade routes between cities!
Feel free to leave a comment, feedback is always appreciated. :)
Logged
Merchants Quest me programming a trading game with roguelike elements.

Neonivek

  • Bay Watcher
    • View Profile
Re: Programming Creative Project: Merchants Quest
« Reply #13 on: December 27, 2012, 05:05:03 pm »

Quote
My current theory is that he's actually a time-traveler. He's been looping through the past two days to get farther along without us knowing

I will admit, that is an interesting idea. A tough one to pull off but I could imagine what it would be.

It would basically be you trying to steer your ancient buisness to success all the way to the modern day (so you can enjoy your riches) by going back and forth. With plot twists happening as your major sources of income suddenly crashing leaving your buisness destitute (Black Pepper, Tulips, Olive Oil, and Aluminum all have had market crashes)
Logged

GreatWyrmGold

  • Bay Watcher
  • Sane, by the local standards.
    • View Profile
Re: Programming Creative Project: Merchants Quest
« Reply #14 on: December 27, 2012, 10:24:45 pm »

Would it be too much to ask you to upload the part of the code which makes the world and biomes? It looks like it's mostly complete, and it would be very useful.
Logged
Sig
Are you a GM with players who haven't posted? TheDelinquent Players Help will have Bay12 give you an action!
[GreatWyrmGold] gets a little crown. May it forever be his mark of Cain; let no one argue pointless subjects with him lest they receive the same.
Pages: [1] 2 3 ... 7