Pagina's

Showing posts with label Stone age. Show all posts
Showing posts with label Stone age. Show all posts

Wednesday, 5 February 2020

Goal Oriented Action Planning

Good morning everyone. It's been about a month, I've been quiet on the blog.  I got myself a new laptop to work on the game sy the times I'd usually write these posts in the bus. As I'll be going to a concert with my wife after work, I left the laptop at home and here I am!

What have I been up to for the last couple of weeks? It's all mainly been about goal oriented action planning (GOAP) AI for the characters in Holocene. This means that the world is a world of states and tasks, but not really in a state machine way. A character has a simple state machine attached, but all it can do is be idle, go somewhere, and perform an action.

Where to go and what to do is dependent on the goals weer formulate.  For instance, the character is hungry. This gives him a goal: eat. Quite simple. So he eats and he's happy. But what happens when the guy does not have food? Well, he needs to eat,  so how do we make that possible?

Any job a character can have consists of the action (removing the food from the inventory and unticking him being hungry) and an effect (he's not hungry), but also some preconditions  (he had food). The action will only run if the character actually had food. 

The thing with GOAP is that once the goal of eating its picked, the character will try to find a sequence of actions leading to having eaten. Via some A* pathfinding algorithm from a tutorial, which I do not yet fully understand,  the character will find a road from the current situation to one where the preconditions for eating are met. We're picking up the apple over there, and we're not attacking the enemy or making fire or building river dykes. Because those won't lead to eating.

The GOAP system makes for flexibility because all you do it formulate small building blocks for behaviour and a system to build sequences of tasks based on very simple nodes. The thing is always that stuff like this isn't as easy as it seems. For instance, right now I'm having trouble making the character understand when a building he's building is finished. I find it hard to debug this system and the fact I don't really understand the underlying pathfinding does not help, but I know what to study and I'll be ok in the end, because I expect it'll all be so much easier once I get it.

Thursday, 9 January 2020

Sequencing the states

Good afternoon. Yes you heard that right. It's even almost evening and I'm in the bus back home from work. I was just thinking about the state machine that I'm running in Holocene and there's a problem.

The problem is not unfixable by any means, but it'll make my job a lot more difficult because I am bound to create a gigantic AI class if I continue what I'm doing now.  Shop what am I doing really? Well, I'm using a state class that has actions defined for entering and exiting the state and for executing whatever the state needs for every frame. All these methods are written in the CharacterAI class.

The idea is that once something is happening, like the character finds out he's hungry, the decision class will look if there's apples to eat and if there are, trigger Moving state with an apple as target. That's all fine and that works, but...

Walking to an apple is not really the same as eating it and moving to any target does not satisfy hunger feelings, so I have to make it more complex. Once the character arrives at the apple, he'll have to interact with it.  Pick it up, maybe prepare it and consume it.  That means we need more information on what to do next. That is going to clog the system quickly.

Now here's my idea: I'm going to use the Unity animator controller and add behaviour scripts to any of the states, keeping them very modular. Moving does just the walking until it's at the destination, picking up just picks things up, eating only destroys the object and sees if that does any good to the character. All these states can me called by a simple trigger that takes a string or an int.

Back in the AI script, all I have to keep track of its a stack of triggers. The states will let the AI know they're finished and the AI will know what to do next. In the eating example, the character will run a "hunger" method and that'll populate a stack with the state for finding it there it's food nearby, plotting the road, going there, picking the food up, seeing if it needs preparing, doing that, eating the food and going back to seeing what to do next.

I'm sure this is easier said than done, but I think this is what I'm going to do.  This way I keep the code separate and unrelated and that often means less bugs and easier to manage.

Wednesday, 8 January 2020

Agabouga likes apples

Good morning again. I have a little update on the development of what I started to call Holocene again. I'm focusing on the game mechanics and specifically the satisfying of needs by characters. As I might have said before, characters need food, water, sleep, warmth and probably something social.

These five are instances of a Need class. Needs have a current value, a maximum value and some priority stuff. A character will be able to find out which need needs to be fulfilled and find targets for that accordingly.

I have this system working now, but I'm going to refactor that, because I'm not very happy with it and I think we're making too many calculations which will be problematic when we're having more than a couple of characters.

Anyway, afters whatever happens, the character has a state machine component that gets fired to a new state when that gets triggered. The idea is that once the guy is hungry, he'll find a food source and sets that as target to go to. Then the state machine will trigger a state to pick up the source and then eat it. Or bring it somewhere.


What I have now is a system that presets the target for Agabouga to the apple and tells him to go there. The triggering of the move state is not implemented fully, but that will be. By the end we'll have characters being able to find out what they need and if that's available. The state machine will then get a sequence of states going. Move to the apple, pick it up, eat it and find out if we need anything else.

A lot of work left to do, but it's actual mechanics so I like it.

Sunday, 5 January 2020

How to be destroyed properly

Good morning and best wishes for 2020. It's been a while but not so much that I'm getting used to typing 2020 on my computer keyboard with ease. I spent the holidays with the family and the rest of the time with my wife and a bit with some courses and experimenting to get better at gamedevving. Now I think I'm back to business.

I have been up to quite a lot in these courses and experimenting lately. The aim is mostly to get more proficient in the RTS mechanics that I need for my game. I'm going to revisit the procedural world generation later, once I have kind of a game going, so I ditched that, because I was not happy about it anyway.

I also took a look at 2D grids and A* navigation, but that gets slow very quickly once the world is getting any bigger. I think I'll just stick with the 3D Navmesh system for now. I'm not sure what other elements to keep.

Now that I started a new clean sheet project, let me tell you what I did yesterday.  You remember this tree:


This is the acacia tree. It's an object of the Tree class and it can do something. It can get destroyed. Every object of the Worldobject family had hit points and once they run out, the object gets destroyed and other stuff happens. What'll happen it's that once the acacia tree is killed, it'll instantiate a list of objects around itself. Were talking logs and branches. The idea is that a felled tree will add resources like that, while trees can also be kept alive to give a little bit of resources every now and then. 

This mechanic is now partly made. I still have to make the instantiating thing and a time system to make "every now and then" mean anything.  Time will probably be one of those main mechanics. There'll be day and night and especially seasons and hence years, because there'll be aging and growing in the game. And winters should be colder than summers, which should make a difference. 

Not sure how to implement that one though, sho we'll have to find out.  For now I'm happy to be working again. 

Wednesday, 4 December 2019

Ghosts on the navmesh

Good morning. I'm on my way again. The last couple of days I have been working on my characters for Holocene. First, I was building models in Blender, which took a lot of time without being successful really. Especially weight painting is terrible, when you try to keep things low poly. Shoulders are terrible to get right. After some days of trying, I decided to halt the character modeling for a while and use my proven primitive shape model in Unity.

Now that I decided that, I set that up. I have my tiles with a navmesh surface component to them, so the agents know where they can go. When I drop my guy on though, it does not really catch it. I think that is because the navmesh is above the surface somehow, making it difficult to work with. By changing the agent's offset and applying that to the prefab, I get this unsatisfactory result when I send the agent to the player position.



Note that this is not a ghost game. Floating characters are not what I need. I went to bed frustrated yesterday because all I really want is to have the navmesh right on the surface and have the agents just attach. 

While I'm writing this blogpost,  someone on Twitter just suggested I create a navmesh myself and that is certainly a thought I'd entertained for a while. It'd instantly fix the surface thing, I just don't know how to get any decent path finding to work then. Possibly with waypoints al over the surface if that does not take too much resources.

The Twitter guy said he'd send me his scripts so I'll wait for that. I really hope it helps me set up a good system without Unity's navmesh system which is giving me trouble every step of the way. I'm really looking forward to creating the actual game mechanics, so I'm hope to get the necessary technicalities over with. If this all works out, I found myself a new hero!

Sunday, 1 December 2019

Plans plans plans

Good morning. It's Monday again and there weekend where I planned to make some progress in my game is over. What happened?

Well, Unity's been asking me to install their newest update for a couple of days, so before breakfast on Saturday, I decided to do so. I found out there is a thing in this version that I could use, so let's go for it. When I returned, there was an error message because Unity was not able to remove something. I didn't think much of it, so I just ran Unity and found out it could not start. I rebooted, same problem. 

After a bit of googling and asking around on Twitter, I found that Unity needed to be reinstalled in another folder, so I did and that worked well. That was similar lunch time.  I hooked up the scripts that I had and loaded the models that I made. Then I went for a sandwich. 

By the end of the afternoon (!) I finally got everything to work. My procedural generation requires a lot of parameters to be set in the inspector and I apparently forgot one of them that made the entire world have a "very wet" moisture rate which gave me a rainforesty world with no desserts, tundra, savanna and the like. It took so much time to find out what caused this and fix that. 

Later, I also found out I forgot to set the ground to a certain layer so that trees could find a good place to set their y-coordinate and not float over or sink into the ground.  Anyway, that was done by the end if the day. I did not feel like working on the game so I called it a day. 

Sunday, I decided to work on another tree model because I did not have a tree for the savanna region yet. Now that I found a nice trick  in Blender to make trees more easily, it did not take too long to make a nice Acacia tree. 


I'm pretty pleased with how much these tree models improve over a short period of time. I know that I'll make some more and remake some of my earlier ones and I'm happy that that should not be much of a problem. 

I also continued with the humanoid model that I've been working on lately.  I tried to rig and animate it in Mixamo but I couldn't get it to work correctly, so I decided to rig it manually in Blender. When I went to bed, this is what I had. 


It's getting near a complete rig and then I will have to add weights to different places to make sure the guy does not move weirdly in the check or the neck when lifting the arm. Last, I'll make four animations: an idle one, a walking one, one for picking up objects and one for dropping objects. Maybe I'll also make a working one at this point. Maybe later. 

Anyway, I had a lot of plans for the weekend, but most of it got into recovering what I already had, which is annoying. Yesterday evening I found out I could open my old project too all of a sudden. I could now take some of the procedural level generation parameters if I need to, do I'll not delete it yet. I also set up a source control for my project. 

Note I'm off to work. Hopefully I can get the rigging of my humanoid finished tonight. Then I can get to work getting the guys to life. 

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.

Wednesday, 23 October 2019

What we also really need

Yesterday I wrote about my new system to find out what need is most prevalent for a character and that worked by deciding which needs passed a threshold and then picking one based on a level and a priority. Well, I found out that I forgot something.

Imagine walking around in the desert and being both very hungry and very thirsty. Luckily there's some food lying around right next to you. You're going to pick that up and eat it, right? Well, that's not how our worked in Holocene. You see, you have 9.1 out of 10 hunger and a staggering 9.2 out of 10 thirst. This means that thirst is more and hunger and thirst have the same priority in deciding what to do, so you'll try to drink. There's no water, but your mind is set. So you die.

The problem of course is that the decision what need to satisfy does not entirely depend on which need is biggest, but also which needs are most easily satisfied. Like we programmers often say (and rarely do) we should mind the low hanging fruit too. In this case even quite literally. Hunger is prevalent too and easily fixed, so we should focus in that too.

Now how does this work? Well when the character triggers picking the need to satisfy, they make a list of needs that hit the threshold to be prevalent.  Then the list will be cleansed of needs that cannot be satisfied right now. From what is left, the most prevalent need is picked and action is taken. Unsatisfiable needs will trigger some warning in three UI when implemented, so that the player can check them.

In our example, the needs for food and drink are both added to the list.  Then drink its removed because there's no water. Food is there, so the eating routine starts, which involves moving to the food, picking it up and eating it.

Tuesday, 22 October 2019

What we really, really need

So. Back in the bus again. It's dark outside the windows, so why look there? I have a short update again, because yesterday I started the AI basics for Holocene. This is mostly about fleshing out the structure of needs for our characters.

There's five needs defined right now: food, water, sleep, warmth and an ill-defined social one that I did not put much thought in yet. Any character had these needs in some measure and they're what drive the behaviour of characters if you don't ask them to do anything.

The aim is that characters will try to satisfy their most important need by doing basic stuff. For instance, if the guy is hungry, he'll look for apples and eat them. Don't expect him to go on mammoth hunt because he's hungry. There'll probably be some message system to notify if the character can't immediately satisfy his needs, because you'll have a job then.

Right now, we only have a system that decides what need to focus on. A need has a priority value which it's highest for food and drink and a bit lower for warmth and sleep. Sleep had another perk, because once you get over a certain threshold, the character will go to sleep, no matter what. 

For the other needs, there's a threshold once one or more of the needs ate over it, the priority matters. The highest level need with the highest priority will get focus. This means that with a threshold at level 8 out of 10, 8.5 food need will beat 9 warmth, but will be trumped by a 8.6 water need. Like that.

The AI will then have the specific need to focus on. Depending on the distance to the sole and stuff like that, the character will make his move.

The idea behind this stuff is that the need checking system should be able to be bypassed by player actions.  So the guy needs social interactions? I don't care, there's flint rock to carve!

I'm not sure about how the autonomy of a character might sometimes override your decisions. Do we want characters to die of thirst while fighting a mammoth? Probably there's going to be some special thing in the Need class that'll make sure you get notified at least if that's about to happen.  Need to think of that some more.

Monday, 21 October 2019

Generating the Big Apple

So. Back in the bus again. It's been a couple of days. I made some progress in refactoring of the object generation for my terrain and I also now have a little apple model to have the characters interact with. This is important because the plan is to have default behaviour for the characters to try and satisfy their needs. Apples are here to satisfy the need for food. Can you believe it?

Before my refactoring, apples were actually functionally the same as rocks. They appeared on the terrain in a pseudo random way. This made for weird situations where there were apples around and not a single tree anywhere. To fix that, I moved an object generation method to the object script for the tree object. Trees spawn apples like they're supposed to. No trees, no apples. I don't know yet how I'm going to trigger the generation, but for now, yes get one chance top drop an apple and that's it.

I also decided not to repeat myself instantiating objects, so I moved all instatiation methods to a central script and run or with parameters. That took some debugging, but I think it works well now.


There was something off with this image, but the generation worked alright. All I had to do is make the model smaller in the prefab.  In the old system, spawning apples worked well because the scale was set from the script. Now there is not going to be much variation in apple size, so I'd better not do to much with it. So I fiddled a bit and this is the result:


Those characters better like these apples if they know how much work it was to get them there. 



Tuesday, 15 October 2019

They have character

So.  Back in the bus to the office. They say protesting farmers are blocking the roads, so we might be in here for some time. While I don't share their aims and reject the violence they use, they have the right to protest. For now, no right wingers blocking the road. We'll see...

Yesterday evening was quite a productive evening for Holocene. I finished the first version of the starter script. It generates a terrain, populates it with trees and rocks and places the player object at a random position on the terrain.

The player can walk around and discover. When they press the space bar, two or three white capsules appear. While they don't look like it, they'll be your first tribe members.


There will probable be some work to be done left. The characters (I'm calling them characters) are rigged to be able to move around on the terrain with certain constraints like the steepness, but they're generated within a random distance from the player in any direction. This means they could instantiate over the edge of the terrain. That could pose a problem because for now I only have one terrain and I don't want the characters to spawn in the endless void of Unity.

While I'm planning to fix that buy generating a very large or even endless terrain, another issue needs to be fixed anyway. The characters can spawn anywhere and that includes places where the steepness is so high that they can't move and even at the same place as trees, rocks, water or anything else. That'll have to be fixed and I think that should not be a problem.

With that out of the way, I also started the scripting for the characters and their well being. The idea is to have anyone have general health, things like energy, sickness and injuries and a set of needs like hunger, thirst, sleep and the like. These will all be properties of the characters that I'm thinking of how to implement.

Next there will be skills. Any character will have a skill set with skills and their amount of mastery. That'll decide what the guy can do.  I think this will be the next thing I need to lay the groundwork for.

Right now it's time for work in the office. I don't think I'm seeing many tractors blocking the highway this morning. Which is a good thing, but it means this blog is done now.

Sunday, 13 October 2019

Rolling Rocks

Good morning. It's Monday again so I'm off top the office. Time to share what I've been up to over the weekend. I said I'd be starting game mechanics and I really did, but that did not result in game mechanics but in some changes to the level generation. That is because I need rocks and other small objects to appear and these need to have some physics about them and a way to interact with them. Just the meshes of the Unity terrain are not enough for that.

What I did was create a couple of rock models in Blender and hook them up to an empty game object in Unity. The model gets a collider component and a rigid body for the physics a and the parent gets a worldobject script. Then the objects are dropped onto the terrain by the generation script.



What we see here is the generated terrain with static trees and rocks that are dropped just above the ground. Some of the rocks roll down the slope and that it's intended. Buy three end, rocks will probably not be instantiated on the higher steepnesses to avoid them from rolling down, but for testing purposes I did not change that yet. Same applies to the ground textures and tree placement. That'll be fine tuned later. 

I need to make some adjustments to the rock generation. I find the rocks to be mostly too big, so I'll find a way to have the variation in size and have some big ones, but not that many. I have some ideas to get that.  

Next, I think I need to lift the terrain up a bit. Right now, most of the time, I have terrains with huge flat parts that turn into lakes. That is because the altitude script checks for a lowest possible level and sets all lower values to that. I think I can make the terrain more interesting by raising it a bit. 

After that, I hope to finally be able to start with the real game play and add characters. Those are going to be the beef of it all. 

Wednesday, 9 October 2019

Talk about trees

Good morning. I've been quite busy working on Holocene over the last couple of days and I think I'm making progress finally. The procedural terrain generation is not finished yet, but for now I'll leave that there for a while to focus on what I'm actually really trying to do all along, the game.

I made a simple first person controller with a camera and some moving mechanics that I picked from my RPG project of half a year ago. Next I tried to hook it up to the trees and things on the terrain and that it's where it goes wrong first.

The reason for that it's actually pretty simple. Trees on a Unity terrain are not really objects in a way that one can add scripts to them and interact with them individually. At least, I have not been able to find a way to do that. For that reason, I cannot get a vision script to work. With a first person camera, I might be able to have the player look at the terrain as a whole, but that won't help to much, because we're not cutting the terrain to get wood. We're cutting trees.

To fix that, I'm rewriting past of the terrain generation script to allow for tree prefabs to be instantiate as separate objects. We'll have to find out if this approach will make things slow. If it does, I'll look for ways to not render objects that are not in view.



A tree object will have a parent object within a graphical element and one or more colliders. The scripts will be on the parent object or the collider, if there is just one thing. Once the player looks at the object, the GUI will give a message and certain functions will be unlocked.

I tested this a bit with a hand placed tree and that works alight. I'm now working on the generation script to allow for placement of the. The same will apply for rocks and the like, because those will be interacted with too. I think I'll be able to finish the script part today or in the weekend.

Right now, I'm using placeholder meshes to speed up development, but the plan is to replace them with my own creations. That'll take time and effort,but it'll make the game better, I think.

Thursday, 3 October 2019

The stone age simulator I'm making

A little update from a crowded bus home this time. When I return, my wife is probably at the gym and I'll have time to watch a couple of videos from my Udemy course on procedural terrain generation. I'm learning a lot about that, but I'd like it to be finished rather soon, because I'm aching to work on Holocene proper.

Some time ago, I wrote Holocene was about to become a different kind of game. Now that I'm not really working on its mechanics, I take my time to think about what I want to make and write it down in my little notepad. I have a couple of ideas in different phases of fleshed out-ness. This blog post its about the main idea that is slowly getting shape.

Holocene is going to be a 3D stone age simulation game where the player needs to guide a tribe of people towards stone age greatness.  There will be a lot of discovering to do, both for me, the developer, and for the game characters, because they don't know much. They know that food and drink might keep them alive, but that might be easier said than done in the game. The task of the player will be to help three characters achieve things.

This premise may sound like a standard RTS, but it'll have a first player outlook and camera position so an overview may be compromised. Next, any character will be someone specific, so we're not dealing with generic workers or warriors.  A guy is a guy and singer fits are better hunters than the guys going for three pottery craft. Others might be better in cooking. That kind of stuff.

There will be low poly mammoths

There's not too much left tip say right now, except that there's a lot of work to do in the coming time. I'm seriously considering making a YouTube development log as soon add i have my course under my belt. Whatever I do though, I'll probably take my time. Don't expect the game to be anywhere near finished any time soon.