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.

Tuesday, June 7, 2016

One down, thousands to go

So I finished creating the GUI based on Samuli's concept art and I can now start working on the gameplay... not.

I found a memory leak in the terrain generation that's resulting either in garbage collector not clearing or it's something I've done, I'm guessing both, so I have to trace it which means refactoring the terrain generation, although this prevents me from continuing the gameplay, but good news is that I can modify the terrain so I can create the actual size I was planning.

I was also planning in adding the cube unwrap which I've talked for so long now, but it dawned on me that the normals in the mesh would suffer, rendering a cube properly would need all 20 verticies otherwise I would need to rotate the angle of the normals and I have no idea what that would look like...

Tuesday, May 31, 2016

Rendering problems

So I had noticed in the beginning that there were problems with the GUI rendering transparent textures, the textures were missing either pixels or were rendered in the wrong order.

I used a transparent cutout shader to display the textures "properly", but there were problems of course, specifically because I used alpha testing to render the opaque pixels from the texture while writing to the depth buffer. In the next pass of the shader I turned depth buffering off and prevented any pixels from the depth buffer from being written again, after that I had turned alpha blending on and it wrote the transparent pixels. It all seemed fine and dandy but it did cut some of the more transparent pixels off.

I removed the first pass and now I only have the second pass in the shader (the shader is close to an unlit transparent but with vertex coloring) and it seems to render fine, expect for the sorting of the triangles in the mesh, which I had to add in to my mesh rendering. The only problem with it was with the rendering order with other gameobjects, they were either always shown on top of the GUI or the GUI renderers din't show over the others renderers even if they were closer to the camera. 

This was really weird and I looked everywhere for this problem, I though that the problem was in the mesh as the unity's cube mesh would render correctly with the same shader and this puzzled the hell out of me. Finally I found the answer and it was in the material, more precisely in the renderQueue member of the material. The renderQueue was set to 1 every time a texture is changed by script in the material (maybe by modifying other members in the material as well), the number in the renderQueue is the same tag as the shader's Queue tag which are:
  1. Background, 1000
  2. Geometry, 2000
  3. AlphaTest, 2450
  4. Transparent, 3000
  5. Overlay, 4000
The renderQueue tag is set automatically if the material is modified by unity, but if it is modified by script it will set it to 1 which is nothing and it would result in a very chaotic rendering order, by setting the renderQueue to 3000 would result in a correct rendering order with other gameobjects.

Monday, May 23, 2016

Moving on

I finally finished the new GUI framework which took ages to complete, but now I can finally have an easier and less frustrating time creating the GUI for this project. I've also tried to make the framework as user-friendly as possible while being flexible and able to do complex GUI's.

I've also began creating the GUI for the game using the textures and concept art I received from Samuli, when it's done I can continue working on the gameplay for the game, specially the character's skills.

I'm also eager to change the chunk size to 16 * 16 * 16 from 16 * 16 * 8 as well as adding the cube unwrapping so I can reduce the vertex count.