Procedural RPG OT: every action has consequences

Started by Legend, Apr 20, 2019, 09:02 PM

previous topic - next topic

0 Members and 1 Guest are viewing this topic.

Legend

Here are the skills.

Durability
Brawn
Dexterity
Fortitude
Perception
Persuasion

Durability is tracked for everything while the rest of the skills are only tracked for alive things.

Brawn is physical strength. Invest in this to carry more and hit harder.

Dexterity is physical control. Invest in this to hit better, hit faster, and stay hidden.

Fortitude is endurance and will power. Invest in this to stop hunger, pain, and persuasion from getting in the way.

Perception is intelligence and awareness. Invest in this to notice more things, know more about those things, and avoid being manipulated.

Persuasion is charm and diplomacy. Invest in this to be liked by default and convince others to do what you ask.

Legend






Humans vs bear. Who will win?


Legend

Now I'm working on implementing wells and environments.




I'm sticking to the forum RPG mostly. Ocean, large rivers, lakes, deserts, mountains, and forests. These stats are needed both to restrict movement and modify movement. A ship for example will just never be able to go on land.



Tiles can be salt water, fresh water, or land. Land tiles can be flat, low mountains, or high mountains. Land tiles can be no vegetation, light vegetation, or forest. Temperature can be hot, mild, or cold.

Forests are unique however because they can change during a game. Overfishing wasn't a thing in medieval times but deforestation definitely was.

The "travel map" thus has salt water, fresh water, dead flat land, dead low mountains, dead high mountains, normal flat land, normal low mountains, normal high mountains, forest flat land, forest low mountains, and forest high mountains. Temperature uses a different lower resolution map since the details are less important.



For now I'm using a 512*512 tiling. Temperature will be 128*128 tiling and only be used to influence environments (no survival elements related to being too hot/cold or having a dry environment increase thirst). Every tile uses one byte to describe the tile and a second byte to give the tile a formation id. This way a river can be treated like a single item instead of a strand of pixels. Lower res tilings are used to define regions and multiple formations. Outside of the background sim, this combination allows places to have cool procedural names.





Legend



Made a few changes.

512x512 map with just salt water, fresh water, flat land, mountains, and forest. These are the states that directly affect things and are really visible when playing.

Additional 128x128 float arrays are used for biomass, treemass, temperature, and humidity. It's actually really important to simulate overfishing and what not since otherwise sharks would have hundreds of babies and rule the world  :P

Legend


Brighter pixels mean more plant life. Everything is being blown to the north west.

Legend






Videos of my biomass simulation with different settings. It's really cool watching life spread around. Also made me realise that my "migration" system had an unintended side effect. Life moves faster in water than on land which resulted in coasts being dead zones.

Legend



Procedural world generation. I wasted too much time trying to replicate real world physics (made a cool plate tectonics simulator though  :P ) only to realise this type of detail negatively hurts the rpg. Just like how real random numbers are hardly ever used in video games, real world simulation can often produce undesired results.

Instead I'm now going with a controlled system. This way I have parameters that can control the procedural generation and players will always have a decent world.

Legend



More or less here is the finished result for the coasts. I am really surprised just how well this turned out considering my method was a shot in the dark. Using the same random numbers, here is the result if just one continent is used.



Then 2 continents.


Then 3.


Original 4.


Then 5.


Then 6.


Then 7.


Then 8.


The shapes of each continent are completely altered as additional land masses affect the procedural generation, but you can still see that they kinda stick to the same locations (colors are random).

My approach is to place "seeds" that then expand and grow out into the world. Every seed leads to its own continent, although the seeds commonly end up impacting each other. To demonstrate what types of shapes this approach produces, here are worlds with a single seed/continent placed in the exact center. Nothing is changed except the random numbers used behind the scenes.















Here are more examples of worlds with multiple seeds/continents.












All of these samples were random and show both the good and bad of this approach. The method works by randomly picking ~100 locations to be sampling points. It then goes through every continent and picks a random point on that continent to expand from. The closest sampling point is then transitioned to that continent if it is close enough. This is repeated hundreds of times. Then ~10,000 new locations are randomly sampled and the process repeats. This time the points need to be even closer to be transitioned to the continent. This whole thing is repeated over and over and over again with exponentially more sampling points until the image has enough detail. Here are the results at each sampling stage.
















The big negative is all the holes/lakes inside of land masses. I can improve this by changing how I convert the vector points to an image but I think I'll mostly rely on just using a "paint bucket" image effect to mostly make the land solid. The coastlines are the parts that I'm really interested in. I also plan to do additional processing to smooth some of the coasts and add mountains, major rivers, and island chains. The images above are a billion times better than perlin noise but there is still a lot I can do to improve them. Here is a photoshopped example of the land with most of the lakes removed.


Legend

May 13, 2019, 06:16 AM Last Edit: May 13, 2019, 06:35 AM by Legend


Mountains and rivers. Mountains look bad but are mostly fine since they just indicate "this pixel is mountainous."

Rivers look bad because they are bad. I need them to actually look like rivers.

EDT:



Well it's kinda better...

the-pi-guy

*God grabs a ruler*
"These rivers should be perfectly straight!"

Legend

*God grabs a ruler*
"These rivers should be perfectly straight!"
I was generating the rivers by randomly placing dots and flowing them downhill using a basic heightmap. I improved the heightmap and tried adding random noise to create good river bends but it didn't work.




New approach is to use this improved method but not draw the river as I'm tracing it to the sea. Instead I use this info to just get start points and end points.

I then use a 2D version of Cube Royale's lightning to fill in the pixels between the two end points.

I really love how the rivers generally flow into bays and sections of the sea that push inward. That's a cool effect caused by my simple heightmaps which I did not expect. The things I need to do now are improve the thickness of rivers (sometimes pixels are skipped even) and cut off rivers that cross each other.

Legend



Wind generation. Basically a 1 to 1 simulation of how wind works on Earth. Air pressure and the coriolis effect are the driving elements.



Humidity/rainfall map. Uses wind generation to simulate 262 thousand gusts of wind. They pick up humidity over oceans, drop off humidity on land, and are affected by altitude, temperature, and speed.


I think I am going to throw this work away.


The humidity map looks really cool but it is too chaotic and uncontrollable. Essentially I'm having the same issues as my original plate tectonics approach. Instead of simulating the physical processes of Earth, I need to program the end results. The above map is mostly desert and just doesn't feel right.



This different map also shows some of the problems.

My new solution will probably be pixel based. Just do operations on the grid instead of doing them with a approximation based system. This will save a lot of time so I might recalculate climates for winter and summer. (or I'll fake it using interpolation, depends on if I want trees/forests to impact climate simulation).




On the gameplay side of things, I think I've figured out a kinda cool thing for multiplayer. The forum RPG worked great with traveling from city to city since we could just ignore it until we arrived automatically. This wouldn't work though in a non browser game. Players need to be able to play it actively instead of passively.

In singleplayer, the player is free to fast forward the world whenever they please. In multiplayer, every player needs to have the same game speed. It's impossible from a game perspective to let one player fast forward while others play at regular speed. Weird time bubbles would break the background simulation so that just really really isn't an option.

The simple solution would be to just increase travel speeds for players. That however makes the map small. A player on the opposite edge of the world could show up in your city in only a few minutes.


The crazy solution is parallel dimensions.

Players are blessed by gods and have some supernatural abilities, so why use that for this too? Say a player spends an hour doing stuff in a city. They have shopped, had conversations, done a quest or two, whatever. Theoretically there would be a parallel world where the player decided to skip the city and walk to the next one over.

The player who spent time in the city can jump to the other reality where they are now at the neighbor city. Instant fast travel. They could do some things in that city, and then jump back over to a reality where they never left the first city.

This might sound like a needlessly complex way to describe a standard video game mechanic, but it has some important differences.

The parallel world must have diverged from the current reality within the past hour. Players cannot fast travel to the other side of the map, they can only fast travel within their local region.

Players can fast travel an unlimited amount of times with no cool down, but they can never reach destinations sooner by using fast travel. If it takes 10 hours to cross the world, it would still take 10 hours to cross the world. The only difference is that the player can spend time in a location without it increasing their travel time.

TLDR: fast travel within the local region.

Legend



Good enough for me.

This is the map with moisture and temperature visualized. Deserts and ice.


I'll use next week as a vacation and when I get back, I'll start working on the actual front end instead of just the simulator. Every pixel in the 512*512 map is about 2 miles wide and still needs additional details when zoomed in. For example a single green pixel surrounded by water needs to become a propper island.

Legend

Tile types: salt water, fresh water, flat land, forest, mountain, and frozen water. 6

A tile system would take a lot of work.

An overlap system could save time.

Say we have:
OM
MO

M=mountain
O=other

The mountains would always be drawn the same way regardless of what other is, as long as it is not mountain.

Mountains, forests, flat land, frozen water, fresh water, salt water. If drawn in that order, a lot of time could be saved. Only 16x6 corners would be needed.

Scratch that.

Legend



Quick mockup of turning the lower res grid into a higher res map. My target detail is about one pixel per 100 feet.

Go Up