I added z-levels to the island so I could add caves and towers and eventually large trees. But it was really slow and I wasn't too happy with the direction it was moving things. The performance was worse, the code became bloated, and it didn't add anything fun or neat or new. So I'm going to revert this week's work and save z-levels for later.
I may get rid of elevation all together - I don't know. I'm not sure what it would add gameplay wise and this is starting to turn more into a simulation than a game. Sims are fine but I want a fun roguelike game, not a SimEarth wannabe or a lame Dwarf Fortress.
I think I'll focus on making it a playable game now. You know, add ways to suffer die.
Monday, December 29, 2014
Sunday, December 21, 2014
Randomized plants on the island
The island now has some random plant life!
During worldgen a few dozen plant species are generated. Each species has an ideal elevation, precipitation, terrain type, and a few other stats. The world is then populated based on how well each species is adapted to each location.
Each species also gets a few traits chosen at random. Here's a few examples:
During worldgen a few dozen plant species are generated. Each species has an ideal elevation, precipitation, terrain type, and a few other stats. The world is then populated based on how well each species is adapted to each location.
Map view of the dominant flora of the island. |
Each species also gets a few traits chosen at random. Here's a few examples:
- Desert - they get a bonus for living in areas with low precipitation.
- Red - changes the color a bit.
- Stone - they get a bonus for living on stone.
- Succulent - eventually, consuming them will give you more water.
- Tangled - eventually, walking through them will have a chance of restricting your movement.
- Thorny - eventually, walking through them will cause a small amount of damage.
Every turn some plants die and some plants are born based on weather, luck, and competition for space with other species.
Part of surviving on the island will be finding what plants are useful. Which are safe to eat, which can be used to make poisons, which can be used to make rope or cloth, which should be avoided, etc.
There's no trees yet though. I'm not sure how I want trees to work so I'm saving that for later.
Sunday, December 14, 2014
Time, weather, and geography on the island
I implemented time, some seasonal weather, and a small bit of geology this week.
Time and seasons. Time on the island is pretty straightforward. One turn equals one minute. 1440 minutes in a day, one day per season, and 12 seasons a year for a total of 17,280 turns per year.
One thing I haven't decided is how to implement night time. I could slowly redden and darken the tiles as the sun sets, shrink the view distance, or maybe do something else. Any ideas?
Climate and weather. Most weather on the island is a mix of calculations and simulation. Idealized temperature, cloudiness, and precipitation is calculated by adding sine waves for seasonal variation.
Throw in a bit of randomness and minor feedback from the island height map and you get some interesting things. For example, the ideal temperature is the sum of a daily cycle, yearly cycle, and a short, medium, and long term cycle. The real temperature also includes elevation, cloud cover, and the previous temperature. Current precipitation is affected by random seasonal variation, local geography, temperature, and where the clouds currently are.
This is all simulated at the map level, which is now a 60x60 grid, and rain and snow are animated on the screen when walking around.
I implemented an auto-turn feature too. It's pretty neat to go the map and watch time go by at about 10 to 15 minutes per second. You can see clouds form and move and drop rain and dissipate. Cold rainy winters, brief dry spells, and warm summer days. It's always neat to try tweaking a variable or interaction and watch it actually work.
I'll skip the implementation details but share some funny bugs from when I was trying different ideas:
Geology. The land generation has been tweaked quite a bit. Also, there's a few different types of land that are somewhat determined by climate. No lakes or rivers yet though.
Thinking of all the different ways to model weather has ben fun despite all the dead ends I ran into but I'm really looking to this upcoming week and adding some randomized plant life.
Time and seasons. Time on the island is pretty straightforward. One turn equals one minute. 1440 minutes in a day, one day per season, and 12 seasons a year for a total of 17,280 turns per year.
One thing I haven't decided is how to implement night time. I could slowly redden and darken the tiles as the sun sets, shrink the view distance, or maybe do something else. Any ideas?
Climate and weather. Most weather on the island is a mix of calculations and simulation. Idealized temperature, cloudiness, and precipitation is calculated by adding sine waves for seasonal variation.
Sine waves added together. |
Throw in a bit of randomness and minor feedback from the island height map and you get some interesting things. For example, the ideal temperature is the sum of a daily cycle, yearly cycle, and a short, medium, and long term cycle. The real temperature also includes elevation, cloud cover, and the previous temperature. Current precipitation is affected by random seasonal variation, local geography, temperature, and where the clouds currently are.
This is all simulated at the map level, which is now a 60x60 grid, and rain and snow are animated on the screen when walking around.
Elevation view of an island. |
Precipitation view of an island. |
I implemented an auto-turn feature too. It's pretty neat to go the map and watch time go by at about 10 to 15 minutes per second. You can see clouds form and move and drop rain and dissipate. Cold rainy winters, brief dry spells, and warm summer days. It's always neat to try tweaking a variable or interaction and watch it actually work.
Walking through the hills during the most extreme downpour I saw. |
- I tried making the temperature, clouds, and precipitation flow like in a fluid simulator. Nothing fancy, just a super simplified Navier Stokes thing that never quite worked. The island was soon covered in a freezing uniform cloud that was always snowing. Except the tops of the highest mountains, they were a comfortable temperature.
- I tried implementing clouds as particles that would be deflected by high elevations. The first attempt caused them to bounce off mountains like beach balls and scatter everywhere. I was able to tweak it so that didn't happen and added wind that would nudge them back to their original direction but it wasn't very interesting.
- I tried making temperature affect cloud formation and have clouds affect temperature. I soon had areas with 2000000% cloudiness and over 1000 degree heat.
Geology. The land generation has been tweaked quite a bit. Also, there's a few different types of land that are somewhat determined by climate. No lakes or rivers yet though.
A transition between dirt to the southwest and grass to the northeast. The grassy area probably gets more rainfall. |
Thinking of all the different ways to model weather has ben fun despite all the dead ends I ran into but I'm really looking to this upcoming week and adding some randomized plant life.
Sunday, December 7, 2014
Beginnings of worldgen (with pics) and spinoff projects
I got some basic worldgen done this week. Just creating a bare island and walking around on it but that's not bad for one week starting from scratch with a language I'm still learning.
Building the island's elevation uses a blend of a few different techniques:
First, create a heightmap by throwing down a bunch of sorta-centered blobs with a random height and radius. A percentage of the blobs will have negative height and reduce the elevation. Keep throwing blobs until you have enough land. I think this has interesting and island-like coastlines with and good variation of height. It can be weirdly mesmerizing too.
Using the first heightmap, create a second heightmap based on the distance from the water. I think this looks neat on it's own and when there's jagged coastlines it reminds me of what real mountain ranges look like from above.
Using the first heightmap again, create a third heightmap based on simplex noise. Water has zero height and everything else is a noise lookup.
Once you have all three heightmaps, multiply each by a different weight and add them together form a final height map. By changing the multipliers for each, you can adjust the overall look to get the best of each map with few downsides.
Finally, I want the highest parts to really stand out above everything else so I do one last thing: cube each height (that is, set each height to height * height * height). This effectively pushes the lowest parts down and increases the contrast for the higher elevations.
That looks okay. I'm sure it will change more.
Each tile on the map represents "chunk" of 30x30 tiles for now. As you walk around, nearby chunks are instantiated as needed based on the overall map. It's blocky and not very exciting though.
I think I can do something like a midpoint displacement algorithm to make it less blocky. Adding up-slopes and down-slopes at elevation boundaries and hiding the interior of the higher elevation should help make it look better too. That should keep me busy for a week.
Edit: It took about three hours. The midpoint displacement wasn't working how I thought it would so I lerp the midpoints and add a bit of noise instead.
Doing all that was almost 350 lines of Clojure so I moved some functionality into separate open source libraries.
super-simple-window: Java Swing windows can have a ton of callbacks and settings that need to be done in a specific order and I always forget how to do it right. This is one function that creates a JFrame with a Canvas that uses all the settings and callbacks you supply: title, width, height, on-render, on-key-press, etc. Even makes a timer if you supply an on-timer callback.
render-terminal: Render terminal-like data to a Java Swing Graphics object. Call render with a map of points to character data. Does a bunch of caching to keep things fast. Supports 9x16, 10x10, and a 12x12 font so far but it's easy to extend.
Building the island's elevation uses a blend of a few different techniques:
First, create a heightmap by throwing down a bunch of sorta-centered blobs with a random height and radius. A percentage of the blobs will have negative height and reduce the elevation. Keep throwing blobs until you have enough land. I think this has interesting and island-like coastlines with and good variation of height. It can be weirdly mesmerizing too.
Using the first heightmap, create a second heightmap based on the distance from the water. I think this looks neat on it's own and when there's jagged coastlines it reminds me of what real mountain ranges look like from above.
Using the first heightmap again, create a third heightmap based on simplex noise. Water has zero height and everything else is a noise lookup.
Once you have all three heightmaps, multiply each by a different weight and add them together form a final height map. By changing the multipliers for each, you can adjust the overall look to get the best of each map with few downsides.
Finally, I want the highest parts to really stand out above everything else so I do one last thing: cube each height (that is, set each height to height * height * height). This effectively pushes the lowest parts down and increases the contrast for the higher elevations.
That looks okay. I'm sure it will change more.
An in-game map. |
Much higher elevation to the west, much lower elevation to the east. One level higher to the south and one level lower to the south east. |
I think I can do something like a midpoint displacement algorithm to make it less blocky. Adding up-slopes and down-slopes at elevation boundaries and hiding the interior of the higher elevation should help make it look better too. That should keep me busy for a week.
Edit: It took about three hours. The midpoint displacement wasn't working how I thought it would so I lerp the midpoints and add a bit of noise instead.
Doing all that was almost 350 lines of Clojure so I moved some functionality into separate open source libraries.
super-simple-window: Java Swing windows can have a ton of callbacks and settings that need to be done in a specific order and I always forget how to do it right. This is one function that creates a JFrame with a Canvas that uses all the settings and callbacks you supply: title, width, height, on-render, on-key-press, etc. Even makes a timer if you supply an on-timer callback.
render-terminal: Render terminal-like data to a Java Swing Graphics object. Call render with a map of points to character data. Does a bunch of caching to keep things fast. Supports 9x16, 10x10, and a 12x12 font so far but it's easy to extend.
Monday, December 1, 2014
Announcing an unnamed ambitious roguelike
I've had a few ideas bumping around in my head for long enough that I decided to make a real roguelike. A big roguelike. A wilderness survival, city building, and dungeon crawling roguelike.
Wilderness survival. Largely influenced by Robinson Crusoe by Daniel Defoe, The Mysterious Island by Jules Verne, and the potion identification aspects of other roguelikes. You begin alone on an island with randomly generated regions, plants, and animals. You have to find or build shelter, find safe drinking water, find plants and animals that are safe to eat, and explore the dangerous island.
City building. Largely inspired by the The Sims games, the tougher Dwarf Fortress locations, the Dungeon Keeper games, and various history books such as The Outline Of History by H. G. Wells, A Short History of Nearly Everything by Bill Bryson, and the Foundation Series by Isaac Asimov. Eventually you find other people on the island and form a small town. You have a lot of influence but everyone goes about their business of farming, crafting, building, trading, exploring, adventuring, having families, and slowly unlocking new discoveries. But what happens when your town grows large and diverse enough for powerful families, ideologies, and factions to form?
Dungeon crawling. Largely inspired by Sil, Brogue, DCSS, Nethack and other roguelikes. The island has many caves, ruins, dungeons, and fortresses. Use cool items, abilities, and allies to explore and plunder them. Of course, other adventurers are trying to do the same and some dungeons may send their inhabitants out to raid the overworld.
I know thats just a bunch of words with no details or actual gameplay yet, but I'm excited to start a new project and can't wait to get something playable. I made a new git repo today and I hope to have the first playable version out sometime this month.
Wilderness survival. Largely influenced by Robinson Crusoe by Daniel Defoe, The Mysterious Island by Jules Verne, and the potion identification aspects of other roguelikes. You begin alone on an island with randomly generated regions, plants, and animals. You have to find or build shelter, find safe drinking water, find plants and animals that are safe to eat, and explore the dangerous island.
City building. Largely inspired by the The Sims games, the tougher Dwarf Fortress locations, the Dungeon Keeper games, and various history books such as The Outline Of History by H. G. Wells, A Short History of Nearly Everything by Bill Bryson, and the Foundation Series by Isaac Asimov. Eventually you find other people on the island and form a small town. You have a lot of influence but everyone goes about their business of farming, crafting, building, trading, exploring, adventuring, having families, and slowly unlocking new discoveries. But what happens when your town grows large and diverse enough for powerful families, ideologies, and factions to form?
Dungeon crawling. Largely inspired by Sil, Brogue, DCSS, Nethack and other roguelikes. The island has many caves, ruins, dungeons, and fortresses. Use cool items, abilities, and allies to explore and plunder them. Of course, other adventurers are trying to do the same and some dungeons may send their inhabitants out to raid the overworld.
I know thats just a bunch of words with no details or actual gameplay yet, but I'm excited to start a new project and can't wait to get something playable. I made a new git repo today and I hope to have the first playable version out sometime this month.
Subscribe to:
Posts (Atom)