Pagina's

Wednesday, 27 November 2019

Slowly back to health

Alright, that took way too long. I caught a nasty illness two weeks ago and while I'm still not 100% fine, I'm on my way to work again.

I have tried to put some time in the game while I had my well feeling moments, usually in the evenings. I did not make very much progress, but some things are starting to look more interesting as I switched focus from the tedious procedural world generation to actual gameplay. What did I do?

First and most importantly, I created a player object that could walk around in the 3D world. It can still walk on water and run straight through most trees and it can drop off the edges of the world, so there's stuff to do left, but it's good enough for now.  The player will directly interact with your tribesmen and objects in the world, but he can't really do much do something.

That's what the characters will be for. Later this week, I'll start try 873 making a character model in Blender and hook it to a character script that'll control its behaviour.  I had some training with Blender so that note theres a huge difference in looks of different tree types which I will have to get back to later. 



That's progress, isn't it? The bottom tree it's kind of the style I'm looking for. Low poly but kind of appealing. 

The player object can now walk around in the world and 'see' the different kinds of trees.  They are named in the UI and when the player gets close enough and presses E, some other non-functional UI fires to tell we're interacting with the thing. That'll be built upon later too.

For now, that's kind of it. I'm finishing this blog now. Hopefully my first day back at the office won't break me down again, because I learned to appreciate health actually. Wish me luck!

Tuesday, 12 November 2019

Beyond the waves of the sea

Good morning again. Yesterday was one of those days where I did make a little progress building the world, but most of the effort went in conceptual improvements. Not do much actual code. 

Firstly, what did I make? Well, this.



What you're looking at is the beginnings of some ragged mountain range. For testing purposes, I have these coloured textures that indicate height on the level. Brown posts are the higher regions. In the brown part, there's a bunch of spikes popping up. These are random points that I rose to a level where they're easy to see. They are going to be the basis for more ragged mountains. Those are the peaks.  I'll write more about that once it gets under way.

Secondly, the ideas. I found out a problem in my wrapping system. When the left tile its not nearly the same height as three rightmost one, there is a lot of space to cover to make the right one connect. This can give weird results:


The leftmost tile is a sea tile and this tile on the picture is highlands. To connect, the needs to be a steep drop which does not look right. For that reason, I'm changing the wrapping system. If you look away the world map (of earth) there's two points pg interest here: the sea East of Iceland and the Bering Straight between Siberia and Alaska. From there, there's a pretty simple line of ocean going from the north pole to the south pole.

What I'm going to do is stimulate something like that. The world I'm generating will be surrounded by low regions on the east and west side. That'll be oceans. I think this will fix the problem described above without making it look unnatural. I might even put water around there poles to, but probably with extra generated land masses or ice sheets. Have not decided yet.

I do know how to make the surrounding ocean. That'll be by mixing the height map with a noise that has low values around the edges and high ones in the center. I'm not sure about the algorithm yes, but it should be feasible and I've seen this before. I'll probably make that first because it's not very difficult.

I'm also going off for a long weekend from Friday to Monday, so there probably won't be much work then.  Maybe a blog when I have one of these Eureka moments, but don't count on it. You'll never know, but the laptop stays home,  except if you're a thief. I'm taking my laptop (which I always refer to as"slow" and "crappy") totally with me.


Sunday, 10 November 2019

The world is round

Good morning again. Weekend's over so I'm in the bus to work again. This weekend was quite busy, but I did have some time to work on Holocene. As may buy now be known, we're procedurally generating the world and for three nth time I restarted the project to set it up better and now I finally get the idea I start to understand how it's supposed to be structured. So even if it seems like I'm not making progress, I do.

First, I've been thinking about the structure of the world building script and the order of operations.  We'll start with the broad outline of the world that we'll have.  I use small plane objects to set it up. This broad outline right now had one simple Perlin noise, but it'll probably have four. My aim will be to have big low regions that'll be the oceans and big higher regions that'll be the continents. These continents will have features of their own.

Once this is done, I'll see if I need more pronounced mountains. If I do, let there be mountains. I think I'll use mid point displacement to generate them.  When that's done, I'll focus on the rivers again. The aim will be to erode the mountainside so that there will be room to drop rivers there.

Maybe unclear when I write it like this, but there point is that I want to have a playing field where I can drop a river on a mountain and it'll naturally find its way to the sea. Last time I tried that, rivers would get stuck in dips along the mountainside. Now I'll try to carve a path so that the dips have an exit.

When I finish the rivers, I'll add a heat map and a moisture map and that'll bring biomes. Any biome had certain vegetation types and animals. When I drop them in, this should be it.



Right. That's the end aim. Right now I have this. This it's a 4 by 4 grid of tiles with a Perlin noise on the 3 left columns and a special row to the right. This row is a special kind of Perlin noise, because it mixes two. It connects to the one top the left, but it also connects to the left most to its right, in other words: the world is round. I decided not to do this to the top tiles, so it'll be a cylindrical world, rather than a round one, but I'm pretty pleased with this. You have no idea how long this took.

Anyway,  i think I'm starting right. Next task will be to make the work larger and more natural by adding more Perlin waves. Hopefully that connecting time column will look better by then. We'll see Howe long this all will take. I also have a job and a wife and I know this is all going to be a big task, but it's begun!

Tuesday, 5 November 2019

Still grinding

Good morning. Yesterday I found out that I still don't have what it takes to pull off a good procedural world generation. That's ok, because I can still learn and I already started following yet another massively large course on it. The idea is that in time all puzzle pieces will come together and I get a system that actually works and gets us a good and believable world. In the end, the world is one of the main elements for Holocene. I need it to be good. No concessions allowed.

I told you rivers don't flow the way I like. I think that is mainly because of the noise I'm using for the landscape. There are hills around where rivers can form. At first, I tried having them just spawn somewhere and then flow to the lowest neighbouring area until it hits the sea. Well, that meant that rivers went to a low point and start going around a bit until it surrounded itself and had nowhere to go.

Well, that's ok if that happens sometimes, but certainly not if it happens to 90% of all rivers. Now how can I fix that? I think that's a difficult question, because it's hard to see such a thing coming without making huge analyses.  A river should in principle look for the low point and go there and it's good if it goes meandering down a bit, but at some point the river makes a sort of U-turn and closes in on itself. That often spells misery.

What I think I should be doing scares me a bit, because I think I need to procedurally create river beddings and leech the water flow in afterwards. It would give me power to force a way to the sea.  I still need to have it find a way to avoid the weird u-turns, but maybe it works. What I really need is a way to make sure that from any point on the map, water regions are mostly reachable by only going down. Again, it's ok if it is not 100%, but over half the rivers should flow to the sea or a lake. That's what I'm going for.

Sunday, 3 November 2019

The river just stops somewhere

Good morning everyone. I'm in the bus to work again.  This weekend was quite productive while in the end, I only got a little progress. The problem was that my game totally broke and I hadn't made the effort to back it up yet, which was stupid. On the other hand, there were things not working correctly which I were trying to fix and which I could not, so it's ok. I'm not beyond that point anyway.

I'm still working on the procedural level generation for Holocene and I'm using a Zenva Academy course to guide it. I'm not just following it, but have it guide my progress and do the refactoring that it's screaming about while I'm writing the code. Instead of linking noise generation scripts without attributes to every single object, I'm using static ones for that kind of purpose, because a larger level might turn a slow and laggy level if I'm not careful.

Right now, I have a grid of tiles which in turn are grids of vertices and blocks. Any vertex had a height and that stands for the height of a given place in the world. It also had a heat and moisture value which make for a biome value together. Right now, any biome can have one kind of tree. I'm going to change that later. There's no reason why tropical rainforest can only have one kind of tree. 

Last thing I added was rivers. While I was following the course, I kind of knew this was not going to work correctly:


The river gets a random origin point somewhere above a certain height threshold. On the right on there picture. Then, for every step of the way, it finds its lowest neighbouring vertex and goes there until it reaches the sea. Here is the problem. The way to the sea is hardly ever a simple downhill path. There are bumps on the way.  It the real world, rivers overcome those bumps over time, but here they don't. This makes that the river will just stop in a valley, zig zag around a bit and look weird like in the picture.

Seeing this thing is easy, but I have not yet come up with a solution. It seems like there needs to be more planning, although that feels counterintuitive. The origin is fine, I think and the first downhill part is too, but then we need to make sure to keep some longevity. We need to make sure the river does not stop in a valley (or it should form a lake) and we need to make sure the river flies not surround itself.

I'm thinking of a system that had the rivet have a general direction to go, to a shore somewhere. I'm not sure how to make sure it does not have to be a straight line, but I'll manage. The other thing I'll probably do is have the river have a force to be able to lower vertices around it. When the river has gone down, it should be able to dash through small uphill sections by lowering that section.

I'm thinking about this some more. Hopefully, I'll have a good solution soon.

Wednesday, 30 October 2019

A big procedural overhaul

Good morning. Let's get to it.  Yesterday, while I was working at home for my day job a mechanic showed up (it was an appointment) to change some electric stuff and that means that for a while we did not have any electricity. I decided to spend the time on thinking about Holocene. This is what I came up with:


This is what it kind of looked like before yesterday and I backed up my project because...


Well, I agree. I owe you an explanation.  Well here it is. I'll try not to make this too technical. I made some design mistakes. The most important one is that I never considered a world with any size above one Unity terrain which is about 500 meters if I'm correct. I'm sure most of you know that setting up an ancient civilisation will not work on so small an area.

What I did now is plan for a system where the world can be really big. The above image is a tile. It looks like nothing worth spending time to discuss, but it'll change. In the game, we'll have a couple of these tiles rendering while we're walking around. This fits excellently with the first person camera view, because you can only see a couple of tiles at any given time, so why render all of it?

Second thing is that with Unity's terrain system,  we'd have a landscape that does not fit well with the low poly models that I have in mind, like the mammoth. I think it'll immediately look like a weird mash up of different art styles. With this regular geometric shape landscape, I think I can prevent that and keep the artistic coherence.

Lastly, and this is tied to the big world tile thing, I need rivers and seas to have this game the way I want it to be. Water its pretty easy to implement. Just have a landscape and drop a plane with a shader on a certain height et voilĂ . Problem is that that'll make for ponds and lakes, and not for seas really.

What I plan to make is a system where some of the tiles  (don't be surprised if that's over half of them, like Earth) sea tiles. I'll probably use some smooth Perlin noise to get some magnifier for the heights on that tile. Need to find out how that'll work in practice.

Rivers will be something else. I'm not sure about that either, but in my mind, I'll have something decide a random place above some height threshold and drop a river there. That river will flow down the slopes of the landscape until it hits water. Maybe it'll have to push through when it hits a depression with hills in all sides. Maybe that'll be a little lake.

Whatever I do there, I'll have to be mindful of the time it takes to generate the terrain. It's ok to have to take 20 seconds if need be and I'm sure the generation of the world will be one of the heaviest processes I'll ever have made until now, but let's bit have it take minutes unless it's absolutely necessary and let's certainly not have it take time during runtime.

Anyway. I thought I needed this blog post to explain myself and get my thoughts to paper. When I told my wife yesterday, she was not pleased by what she saw. I'm sure she is not the only one.  Besides, the Perlin noise thing for the seas, I came up with that piece of genius during the typing of this blogpost.

Monday, 28 October 2019

Whatever floats your apple

Good morning. I'm keeping this one short for an injury in my hand that kept my development time short last weekend. All I did was edit the world object script to allow for objects to float on water. It works, but with some funny stuff that I yet have to fix.


We're standing on the edge of a lake with a shore line animation moving in the bottom. On the shore are done trees and there's some red little balls on top of the water. Apple.floats is true.  Now there's a problem. The trees spawn the apples and sometimes they fall on a slope and start rolling downhill. Once they hit the water, they stop going down, but they do go forward quite quickly.

Nothing it's stopping the apple from reaching across the pond and bouncing off the edge. It's not so very visible on this gif, but that could turn really weird until the apples have so much speed that they launch through the terrain into oblivion.

Having a thing to stop them is the priority here, so I did a little experimenting with drag on the rigid body component. For now, that either stops the apples too quickly or too slowly. I probably need the drag to catch the apple in the first place and then leave it again.  The catching will take away most of the speed and the release would allow the apple to keep drifting a bit.

Another possibility is to completely catch the apple and stop it and then later add movement to it in relation to wind speed and direction. Need to think that over.