Monday, October 31, 2016

Terrain facelift in progress

I've been recreating the cube creator as it lacked some features and it occasionally gave unity some problems as it started reporting errors of null objects being synchronized or something along those lines, anyway the new unfinished cube creator will make the map generation so much more flexible as the new features to the biomes and the new sub-biomes will allow broader range of options to the map generator, with it I can generate much more realistic and unique terrain.


As I mentioned sub-biomes adding them will require a new map, like the temperature and humidity maps, the new map will have numbers going from 0 to 100, so depending what range the sub-biomes will have, it will affect which sub or parent biome will be selected.

I mentioned in the previous post that I optimized the generation of the heightmap, thanks to that optimization and the lake algorithm I was able to sped up the isometric image rendering which I can now use in the cube creator to view different landscapes faster.


I also finally added the 3D model of the character to the game as well as tree felling.

Me and Samuli been talking and designing quests for the game, nothing big just some examples, we want to have dynamic quests that are build from multiple different quest pieces, we've also been trying to make the quests so that there are multiple ways to complete an objective, the player can decide how he would complete said objective, we would only give a possible direction from which the player could complete the objective.

Monday, October 3, 2016

Seemingly impossible lake part 2

I ran to a problem with the lake algorithm, as I create it by using a heightmap and the problem with this was that holes in the ground will not be filled, of course I though that just creating a floor under the lake and walls at the border will fix this but there was one special case to which this "fix" did not work very well, here's a picture


As you can see there is a huge hole here and the reason for this is that above there is a cliff which makes it the highest elevation in the heightmap which in turn makes this side of the mountain not being filled, thankfully fixing this was quite simple and effective but it does not follow the wall perfectly as it will convert some blocks to water making the wall a little more linear.


Other than this problem, I've optimized the lake generation as well as the creation of heightmap.

Oh and I did try to do something about the rendering of chunks as the useless garbage allocation is insane, but the mesh creation in unity blows and I can't actually prevent useless garbage allocations, but I did make it a little faster and use less memory

Sunday, September 11, 2016

Seemingly impossible lake

I've finished adding water to the game sort of, I can generate lakes and render them but there are no "fluid simulation" happening, yet, and there are still a lot of things that I have to think through before I can officially say it's finished.

So how did I add water to the game, it was actually quite difficult as the terrain is easy to shape but adding something like liquid is harder as it can spill, overflow and so on, so what I first did was
I created a heightmap from the coarse noise map from which I searched spots where a single water could be placed without spilling, after I had done that I made a sort of a filling algorithm that would raise water to nearby neighbors until a x number of nodes were found, then I remove all nodes that have neighbors (except ones that have been found) that are lower in height than the highest node that was found, now I had possible lakes that could be formed but there was another step I had to do.
Left has water locations, middle one lakes and right is the heightmap.

Next up I created a heightmap from the finer noise map, now that I had all the lakes from previously, I go through all of the lakes and find the lowest point of each lake and I locate them in the finer noise map from which again use a filling algorithm, this algorithm is essentially a better version that I used to find the lakes. The result does not fully represent the lake that was found from the coarse map as the finer noise is modified slightly to add slight differences to the terrain.
I can't create all the lakes in one go as it takes quite a bit of resources and space from the harddrive but thanks to the coarse map I have all the potential lakes from which I can actually generate them from.

Below is a gif of a lake, not the same one as in the heightmap.

Tuesday, August 30, 2016

S-...Sleep

Well I've finished creating the template for Foraging, there is a chance to gain items from foraging and you can level it up as you are doing it, leveling foraging for now gives you a better chance to get items, later I might add different foraging types such as finding weapons/armors or other valuables beside food and resources.

I've also been programming the inventory and character GUI which has taken most of my time, currently the inventory slot functionality is mostly done, some item splitting and such features are missing as well as using items, the equipment side is not done. In the character side I've finished the needs, health and mana but still working on the skills interface.

Programming the character saving is becoming quite the tedious task, I have to split a characters information to several files, if a character is not important it's useless to save such as inventory or skills because they can be generated by a seed. Splitting the inventory and skills to different files also helps me in adding more skills and other data as I've yet to design and define them because all of the characters data is converted to bytes so I have to carefully "map" each variable in the save file.

PS: Oh and I've been cleaning for 3 days straight with little sleep while friends are playing DnD? thanks.

Monday, July 25, 2016

Slow progress

I've been sick for a week then struck a heatwave, I hate high temperatures and working without any kind of air conditioning is horrible, so I've only been working on memory usage and trying to eradicate all garbage, other than that it's been quite quiet.

Oh I have been searching for more ways to improve the terrain generation and looking for ways to add water and there has been some success although I've yet to implement any (except for one image below of random generated canyons) but it's looking promising.


Saturday, July 9, 2016

Gameplay and more terrain generation

So I've more or less finished the refactoring and I've begun adding some gameplay elements starting with foraging items from the ground and proceeding from there to some basic survival mechanics, crafting and building, after that I'm adding some neutral and hostile npcs with which the player can interact with. I'm also trying out some different terrain types to see which I should use and so on.

Samuli also has modeled some house parts for the game and I'll be adding them once I have programmed building.


PS: I'm still updating the task list at Onwards

Wednesday, June 22, 2016

Latent optimizations

So I've been refactoring the project and changing most of the integers to long so I can generate larger maps is going well, there were some hiccups here and there but it's still an ongoing process.

I also noticed some potential optimizations in the chunk rendering part which I've now added, I noticed these because I changed the cube array in the chunk to the length of 4096 from 2048 to take advantage of the previous optimizations (which I mentioned here Rivers, streams and more optimizations), the change was a double edge sword as the chunk rendering took twice the amount of time to render a chunk, fortunately I noticed that there were some potential optimizations as it sped up the rendering from 5 to 11 times faster.

I've also reduced memory usage by hundreds of megabytes depending on how many chunks are possibly visible, I only removed index an int variable and a vector3 position from the cube class as they can be easily generated if needed, as I mentioned a chunk has 4096 cubes and over 8000 chunks can be visible, the amount of memory needed for position and index is massive.