Advertisement Jump to content
  • Advertisement

The Great Tribes Devblog #33

Zemlaynin

796 views

 

Hello dears! And happy new year's holidays!

It's been over a month since the last development diary. I have to say that I wanted to post a diary before, but faced with a intractable problem, which spent a lot of time. But all in order.

According to the development plan, the first contact with AI was implemented:

screen001.jpg

At the bottom of the screenshot you can see messages about crossing the army control zones with another army and the city. Now we had to develop an interface element that would display the event data:

screen003.jpg

This screenshot in the upper left corner shows the implementation of UILabel with the ability to transfer text by words. An important element of the interface that is useful in the future. In the lower right corner, above the end of the course is now visible various messages, hover the mouse over them POPs up a hint (also a new interface element), with a short description of the event. By pressing the right button, the event can be closed without making any decision, and the left button can open the message.
In this case, when you click on the event button will be the first diplomatic contact in the game:

screen004.jpg

screen005.jpg

It was further implemented the first maneuvers of AI. AI walks on the map and tries to determine the boundaries of its continent. In the video at Dukat https://youtu.be/69G51u_Mq3g?t=693 that is the moment where he runs over the enemy army, which pays no attention to him, because busy with study card :)


And somewhere in this place and at this time, I was faced with a problem, a performance problem. Our Modeler has a powerful modern computer of red Assembly. But it the game is terribly slow shipping a single core processor. The reason is simple-there are a lot of cores in new processors, but in fact they are less productive in single-threaded applications. And that moment I had a render in one stream. But in fact, the reason was not so much in this. And in the process of finding problems, I decided to count how many polygons we have in the scene:

screen006.jpg

On the middle map at the maximum distance and a large cluster of palm trees - it's just scary! 15 824 756 triangles! Almost 16 million!!!

After a bit of map generation, I found a place with 16.75 million. :)

screen007.jpg

Although here is a similar place with trees gave only 8.5 million triangles:

screen008.jpg

And in the middle stage consisted of about 4 million:

screen009.jpg


In General, I was glad that my render copes with such a huge number of triangles, but their number was excessive. It was necessary to optimize the number of polygons in the models.

screen025.jpg

40% decreased Poligona trees! Differences practically are not visible.

Next, we have altered palms - Poligona on the palms was reduced in 10 times. 600 - 700 against six thousand of polygons per pack.

screen026.jpg

While there was parallel work on the models I have been trying to simplify the geometry of terrain. Here's what it looked like before optimization:

screen010.jpg

And after the first steps:

screen011.jpg

screen012.jpg

screen013.jpg

But it was all done by a simple method — all smooth tiles were replaced by two triangles instead of 882.

But there were still flat places that could be optimized, and I began to build polygons from those triangles that had the same height:

screen014.jpg

Build on them convex-concave contour (Concave Hull). With Convex Hull ω was not a problem, I already used the Graham scan (Graham scan). But the construction of Concave Hull has a problem... Information on this topic on the Internet was quite difficult to find. I had to write the implementation of algorithms from scratch. I will not lie if I say that I read a dozen different dissertations on this topic. But all the proposed algorithms gave an approximate result with some error. After a week of torment and pain, I came up with the idea of my algorithm, maybe I'll describe it someday :)
As a result of two weeks of torment, I got the desired result and was able to build Concave Hull of almost any complexity, bypassing the set with holes, just dividing them into 2 halves of the hole. Received contour and triangulated it:

screen015.jpg

screen016.jpg

Getting the output of such a result:

screen017.jpg


The fog of war has also been simplified:
screen018.jpg

And in zones where was present only fog of war it turned out only about 300 polygons:
screen019.jpg

But in the end I was upset with the result and tell you that these two weeks I spent in the shuffle... The algorithm developed by me gave a significant increase in performance when rendering, as the number of polygons on average was reduced by 60 — 70%. But the generation of the map began to occur 10 times slower.... the algorithm was time-consuming and difficult.

3 days I lost in ATOM RPG removing stress:) Even at work did not go. Thank God we have at this time the thermometer went off scale at the border -44 - -46 degrees Celsius. And I gave my melancholy for an excuse not to start the car.

And before the new year holidays, enough to play, but the truth is not passed the game, I gave a new lightweight version of the algorithm, which was suitable only for my conditions of tiles. Data calculations for optimization were not noticeable against the background of map generation and the number of polygons decreased by an average of 40-50%.
But there are artifacts when rendering water, I had to rewrite all the algorithms associated with water.
Here is the result:

screen027.jpg

Anatoly meanwhile made unit of nomads:

screen020.jpg

While he lies resting :)

While working on optimization, I came up with the idea of how to change our mountains.

screen021.jpg


Mountains have become more embossed, it is noticeable without texture, as the texture is now not suitable for them:

screen022.jpg

On the grid, so in General the differences are obvious:

screen023.jpg

It remains the case for small — need a new texture of the mountains.

The next step was to rewrite the resource loader and map generator. Along the way, remaking the start menu for all these things:

screen024.jpg


screen028.jpg

 

Now loading of resources goes in parallel and then map generation begins.

I did a great job in dividing the render into 3 streams. The whole difficulty was in synchronization. Now we have one thread responsible only for drawing, the second thread for recalculation of the visible space when moving the camera and other interactions with the map space, and the third thread is responsible for animation and communication with the server part.

And Yes, we now have a server part responsible for all events in the game and for the AI. In turn, each AI player is a separate process.

Let's summarize the work done:
 - Graphics optimization from the software side.
 - Optimization of graphics models.
 - Server part.
 - Split render into 3 streams.
 - Preload resources (textures and models).
 - Rewrote the fog of war, water and terrane shaders.
 - Reduced RAM consumption by 20-30%
 - Implemented a number of UI elements
 - Redesigned start screen with the new UI.
 - Fixed errors in normal calculations.
 - Fixed the hills.
 - New mountain.
 - Introduced normalmap for terrain.
 - New selection of units.
 - New animation units.
 - Window of diplomacy.
 - Actions AI. Study the map.
 - Actions AI. Diplomatic contact.
 - Actions AI. The conclusion of peace, friendship, or a Declaration of war.
 - Actions AI. Action units in a collision.

 - In General, a lot of work has been done to optimize and not a lot of game mechanics. I hope this month to the CE goes to plan and I'm finally going to finish the city :)


Thank you for your attention!




0 Comments


Recommended Comments

Very cool stuff.  I like these sorts of games and I'm interested to know what the game plays like that's for sure.  I really like the turn icon in the lower right corner.  I like that it represents the four seasons and that it rotates.  Very nice.

Share this comment


Link to comment

Thanks for the comment. Soon will be implemented part of the gameplay

Thanks for the comment. Soon will be implemented part of the gameplay

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Advertisement
  • What is your GameDev Story?

    In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

    (You must login to your GameDev.net account.)

  • Blog Entries

  • Similar Content

    • By Midnightas
      I have a texture atlas with two blocks:

      And I want to use this texture for my blocks. I don't want each block to use the entire texture, just a part of it, to make the world look bigger, which is why I would've used something like this for the vertex shader:
      v_uv = a_position; Unfortunately since this isn't a single texture, but an atlas, I had to improvise:
      v_uv = vec2(0.5 * a_blocktype + mod(a_position.x, 0.5), -a_position.y * 0.5); And this kinda works, except that it causes this bleeding:

      (notice how there's these spots next to each A. The same problem exists for the other block type).

      I then tried adding space between the tiles in the atlas, except now there are just black lines.

    • By babaliaris
      Hello! I'm trying to understand why my reflection code does not work and I can't think why is this happening. What I want from you is to give me hints of what might go wrong in order to check it and give you more feedback and maybe we find the problem. This is the first time I'm doing reflection.
       
      These are the steps and order of rendering my scene:
      1) First I'm creating a Frame buffer with an RGB texture as it's color buffer and a Renderer Buffer as it's depth and stencil buffer with 24_8 precision accordingly (Even though I don't use the stencil).
      2) I'm rendering the skybox cube map into the custom Frame Buffer with the depth test disabled. After that I'm enabling depth test again.
      3) I'm rendering the cube into the custom Frame Buffer and sampling from the cube map using the reflection from the viewer and the cube's fragment.
      4) I'm rendering a quad into the default frame buffer by sampling the color buffer texture from the custom frame buffer.
      Ps: I have blend enable too, but I tried to disabled it and got the same results.
      Below you can see the results:
       
      So what should I check?
      Below you can see the vertex and fragment shaders for the cube (I'm doing calculations in World space):
      Vertex Shader:
      #version 330 core layout(location = 0) in vec3 aPos; layout(location = 1) in vec3 aNormal; uniform mat4 model; uniform mat4 view; uniform mat4 proj; out vec3 normal; out vec3 fragPos; void main() { gl_Position = proj * view * model * vec4(aPos, 1.0f); normal = mat3(transpose(inverse(model))) * aNormal; fragPos = vec3(model * vec4(aPos, 1.0f)); } Fragment Shader:
      #version 330 core out vec4 aPixelColor; in vec3 normal; out vec3 fragPos; uniform samplerCube cube_map; uniform vec3 camPos; void main() { vec3 view = normalize(fragPos - camPos); vec3 refl = reflect(view, normalize(normal)); aPixelColor = vec4(texture(cube_map, refl).rgb, 1.0f); } Cube Vertices:
      float l_vertices[] = { //Positions Normals. -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, -0.5f, 0.5f, -0.5f, 0.0f, 0.0f,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f, 0.5f, 0.0f, 1.0f, 0.0f, -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f };  
    • By silikone
      Since hardware with full support for floating point textures and frame buffers is so ubiquitous today, is there a reason to shoehorn in HDR using non-float formats? The doubling in memory usage incurred by half-floats is indeed daunting, and minifloats just don't offer the desired level of precision in many cases. Still, this could mean so little on contemporary hardware that the benefits far outweigh any potential penalties, 
    • By sdidsa
      not sure if this is the right place to ask, but i have made a certain simulation with JavaFX 3D API and it's working very well so far,
      now i wanted to implement 3D shadows and i wasn't able to find any articles or help, i had to read a lot of articles about 3D shadow mapping algorithms but i wasn't able to apply anything on my JavaFX project
      i already assumed that it's impossible but if anyone of you have tried that, let me know
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!