SakeTami
Speiger
Speiger

patreon


New Lights Acquired

Hello Everyone.

Another 2 weeks have passed and since then I was able to acquire the missing lights for the new terrain fixes for the issues that the terrain had.

Light Issues

The Solution to the light issue was a simple 2  that had to be a 3.
Why such a simple Number difference can cause such big issues? It's a wonder that it did not do more damage.
The 2-3 number was on my Memory Alignment for the GPU Data for the Terrain Mesh. In other words I tell the GPU: this is position, this is texture, this is color, this is extra data.
The Extra data was in this case merging with the color and confuse me and the GPU a lot.

Thanks to BeastLe9enD who helped out in a lot of ways.


Rotation Issues

Sadly that was not the solution for everything. Yes the new Vertex-Rotation System worked, but the rules to decide when they should be rotated were basic to say the least.

They were not able to fix any reasonable amount of issues that I had.
So BeastLe9enD came in with a idea to make the rules more complex, which I had considered but thrown away because of the potential complexity problems in code.
His solution was fairly simple instead of doing it via code, just Map them into a list or some form of data storage. 

"Duh" Yeah I was way to deep into my complexity that I won't see simple solutions like that.
So his solution said: "Use the 8 Connection points around the point of interest to generate Number on height differences. That should lead to 256 cases." That concept was right but it was 65k cases not 256 because 2Bits per position were needed not 1. 

So after attempting to manually generating issue cases and then using a helper to map these issues. That worked a tiny bit but was way to slow for my taste. Because I had to go through 65k entries and I wanted a "fast" solution. Something you can grind through within a day.

So a Semi Automated System was implemented. I made a custom screen that would just have to press Y or N (with a B for reversing false inputs) and the game would display me all possible cases.
Of course thanks to some pre-calculations it turned out that it was not 65k cases to go through. For the simple reason that a Tile can not be above and below of a colliding Tile at the same time. So I made a Filter that would auto remove these Tiles drastically reducing the amount of cases. 

At the end after going though the cases and pressing Y & N for a couple hours (feeling like a monkey pressing buttons to get a reward) I managed to get most of the cases solved. The resulting ~2900 cases that needed rotation were printed into a TextFile and loaded when the Game is loaded. (Around 11kb of ram for a grindy fix)

This solution solved 99% of the errors. There are special cases that this solution can not handle. But since this will only affect designing an Island and never needed again I added a tool that allows manual fixing of these issue. But it will be barely needed.

But yeah that Chapter is finished and I am very happy about that.


Tile Spawner

Finally After finishing the terrain issues I started working on the Tile Spawner because I finally wanted to go into actual GameLogic Simulation part.
For that I needed my Tile Spawner but didn't want to implement the old System of how to select a Tile.
So the simple Solution to that was make a custom Window with a Selection.
That sounded Simple. It really wasn't. First of all my engine was not compatible with making Icon Rendering, neither did I have a proper FrameBuffer implementation to make screenshots of small rendered Icons and draw those on the UI.
So a new Shader had to be created which just had a flattening logic implemented.
((vertex.zLevel * 0.001) + actualZLevel)
This simple + a OrthographicMatrix made the icon rendering pretty easy.
And after a couple fixes of issues I had a 2D Icon Renderer for 3D models that supported 3D fully.

Next was to implement the Placement logic for the Tiles.
Since that was already existent I was able to reuse that, though mini patches were necessary.

The hardest part was the Tile Removal.
The idea was, you could mass remove "Non Structures", and structures would be single selectable. So improvements could be made much easier and important buildings get only removed if they are important.

The issue with that I have to do a lot of things with them.

So here is a breakdown of things that had to be done:

So since this was like a sub-todo-list within a todo-list I tackled them based on what was needed and implemented first: Detection, then Displacements, TerrainOverlay, Then the Actual Removal, then Batch Handling and at last the performance improvement because this one takes the most CPU  time over all of them.

And now a fully working tile placer was implemented. With a couple UI Changes a couple options on how placement is done that was around it.

Now compared for the other issues this sounds like it was not a lot of work while the other one sounds like we spend a entire week on it, but no it was the opposite, this took me an entire week while the rotation/light issues were solved in 1-2 days. (Loving bugs)

 
Asset System 

Well since this version I decided to drop my old Asset Loading System which was hardcoding everything. Since a couple things were inspired by "ThinMatrix" because of the OpenGL Tutorials since this is my first OpenGL project I took over a couple of features from him.
I was never happy with that System even if there were a couple good helper functions which in the grand sceme of things were not as good as my new System.

So what I did was moving my files where my assets come from into a dedicated resource area and started giving out a format to the madness. And since I am coming from a Minecraft Modding area I started implementing their System because it is not bad, it has a lot of flexibility, and allows Modding/custom texture packs right from the gate. On top of that adding resources is a lot simpler.
With a couple improvements regarding "Files getting locked once loaded", Duplication of Static Assets and features like grabbing multiple files from the same source I was able to implement the Asset System into my game which allows to replace everything except 1 thing in my game that uses assets. (Shaders/Textures/Sounds/Localization/Font)
The only thing that's not replaceable is the RotationRuleList from the RotationIssue.


Misc

Other then that I decided to do a lot of cleanup. I dropped a bunch of Systems which were useless to me now. Legacy code, Systems that were dropped, Systems that got replaced, Systems that I do not need right now and have to be rewritten anyway.

That was done in combo with the asset System because I was not happy with my current footprint of things that I do not use at all. Or duplicated code.


So yeah this was around it. These two weeks were my most productive days in design.
Because I had to invent the wheel in a couple things right from scratch.

Anyway, Thanks for reading. Speiger.

PS: This post would have gone out like 4-5 hours earlier if Patreon hadn't failed while I was writing it.

New Lights Acquired

More Creators