• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By lxjk
      Hi guys,
      There are many ways to do light culling in tile-based shading. I've been playing with this idea for a while, and just want to throw it out there.
      Because tile frustums are general small compared to light radius, I tried using cone test to reduce false positives introduced by commonly used sphere-frustum test.
      On top of that, I use distance to camera rather than depth for near/far test (aka. sliced by spheres).
      This method can be naturally extended to clustered light culling as well.
      The following image shows the general ideas

       
      Performance-wise I get around 15% improvement over sphere-frustum test. You can also see how a single light performs as the following: from left to right (1) standard rendering of a point light; then tiles passed the test of (2) sphere-frustum test; (3) cone test; (4) spherical-sliced cone test
       

       
      I put the details in my blog post (https://lxjk.github.io/2018/03/25/Improve-Tile-based-Light-Culling-with-Spherical-sliced-Cone.html), GLSL source code included!
       
      Eric
    • By akshayMore
      Hello,
      I am trying to make a GeometryUtil class that has methods to draw point,line ,polygon etc. I am trying to make a method to draw circle.  
      There are many ways to draw a circle.  I have found two ways, 
      The one way:
      public static void drawBresenhamCircle(PolygonSpriteBatch batch, int centerX, int centerY, int radius, ColorRGBA color) { int x = 0, y = radius; int d = 3 - 2 * radius; while (y >= x) { drawCirclePoints(batch, centerX, centerY, x, y, color); if (d <= 0) { d = d + 4 * x + 6; } else { y--; d = d + 4 * (x - y) + 10; } x++; //drawCirclePoints(batch,centerX,centerY,x,y,color); } } private static void drawCirclePoints(PolygonSpriteBatch batch, int centerX, int centerY, int x, int y, ColorRGBA color) { drawPoint(batch, centerX + x, centerY + y, color); drawPoint(batch, centerX - x, centerY + y, color); drawPoint(batch, centerX + x, centerY - y, color); drawPoint(batch, centerX - x, centerY - y, color); drawPoint(batch, centerX + y, centerY + x, color); drawPoint(batch, centerX - y, centerY + x, color); drawPoint(batch, centerX + y, centerY - x, color); drawPoint(batch, centerX - y, centerY - x, color); } The other way:
      public static void drawCircle(PolygonSpriteBatch target, Vector2 center, float radius, int lineWidth, int segments, int tintColorR, int tintColorG, int tintColorB, int tintColorA) { Vector2[] vertices = new Vector2[segments]; double increment = Math.PI * 2.0 / segments; double theta = 0.0; for (int i = 0; i < segments; i++) { vertices[i] = new Vector2((float) Math.cos(theta) * radius + center.x, (float) Math.sin(theta) * radius + center.y); theta += increment; } drawPolygon(target, vertices, lineWidth, segments, tintColorR, tintColorG, tintColorB, tintColorA); } In the render loop:
      polygonSpriteBatch.begin(); Bitmap.drawBresenhamCircle(polygonSpriteBatch,500,300,200,ColorRGBA.Blue); Bitmap.drawCircle(polygonSpriteBatch,new Vector2(500,300),200,5,50,255,0,0,255); polygonSpriteBatch.end(); I am trying to choose one of them. So I thought that I should go with the one that does not involve heavy calculations and is efficient and faster.  It is said that the use of floating point numbers , trigonometric operations etc. slows down things a bit.  What do you think would be the best method to use?  When I compared the code by observing the time taken by the flow from start of the method to the end, it shows that the second one is faster. (I think I am doing something wrong here ).
      Please help!  
      Thank you.  
    • By CPPapprentice
      Hi Forum,
      in terms of rendering a tiled game level, lets say the level is 3840x2208 pixels using 16x16 tiles. which method is recommended;
      method 1- draw the whole level, store it in a texture-object, and only render whats in view, each frame.
      method 2- on each frame, loop trough all tiles, and only draw and render it to the window if its in view.
       
      are both of these methods valid? is there other ways? i know method 1 is memory intensive  but method 2 is processing heavy.
      thanks in advance
    • By wobes
      Hi there. I am really sorry to post this, but I would like to clarify the delta compression method. I've read Quake 3 Networking Model: http://trac.bookofhook.com/bookofhook/trac.cgi/wiki/Quake3Networking, but still have some question. First of all, I am using LiteNetLib as networking library, it works pretty well with Google.Protobuf serialization. But then I've faced with an issue when the server pushes a lot of data, let's say 10 players, and server pushes 250kb/s of data with 30hz tickrate, so I realized that I have to compress it, let's say with delta compression. As I understood, the client and server both use unreliable channel. LiteNetLib meta file says that unreliable packet can be dropped, or duplicated; while sequenced channel says that packet can be dropped but never duplicated, so I think I have to use the sequenced channel for Delta compression? And do I have to use reliable channel for acknowledgment, or I can just go with sequenced, and send the StateId with a snapshot and not separately? 
      Thank you. 
    • By kin kita
      Hello GameDev!
      This is an introduction to a new web app: Vitalkia.com. homepage - Vitalkia
       
      Making silly games and sharing them with friends and people online is something that is really special to me. When I was 13-14 I used to hang at various game forums a lot. I didn't really make any amazing games, but that didn't matter. What makes us love making games is sharing it with others and learn. Because of this, as a side project while I study, I've been making a new game creator tool. It lets you create cool games completely in your browser. This app will help you creating games!
      I've recently created a simple interactive tutorial that takes you step by step through creating a platform game:
      Platform tutorial
      This tutorial will teach you how to make a simple platform game and introduce you to the app.
      So far it's still very early in development, but it's very possible to create great looking games, here is an example.
       
       
      More info:
      The app lets you create games anywhere, anytime. Since it's cloud based, it doesn't matter which computer you use. All code and resources gets stored in your own personal web space associated with your account. Your account can be from Google or a new Vitalkia account if you want.
      You don't need to know how to code. The engine allows for direct Javascript coding but also the use of code blocks. The code blocks makes it easy to quickly create something that works.
      After you've created your game you can easily export it. It makes it directly available to everyone with an internet connection!
      There are still many things to do. For example more code blocks needs to be added, and some bug fixes, but I am looking forwards the future of the app and what people will be able to create with it!
       
       
  • Advertisement
  • Advertisement
Sign in to follow this  

Optimization Optimizing interpolation codes

Recommended Posts

Hi I have finished my multiplayer game interpolation code. It works fine. But I am looking for ways to optimize it and what could be done to improve performance. As for now I have too many temporary variables and objects inside the interpolation function which is running at 60 times per second on client side. I've read some articles that creating those temp variables and objects too many times may slow my game. 

To make things simple, I create a object literal like this in the class that defines the interpolation function

{
  timestamp:0,
  allStates: {},
  allOtherStuff: {}
}

In each interpolation I will clear the object, which means I am just creating a new empty object. Then in the interpolation function I use a for loop to push the interpolated value and other unchanged properties from previous state into object.allStates and object.allOtherStuff. Although this works perfectly but the interpolation function looks bloated. Is there anything I can do to improve this? 

Share this post


Link to post
Share on other sites
Advertisement

Do you actually have a performance problem in that code? Have you measured exactly how much time is "wasted"?

 

If you have not used a profiler, you want refactoring, not optimization.

Share this post


Link to post
Share on other sites
23 minutes ago, ApochPiQ said:

Do you actually have a performance problem in that code? Have you measured exactly how much time is "wasted"?

 

If you have not used a profiler, you want refactoring, not optimization.

Maybe it is refactoring. I have profiled my code and most time (85%) is spent on rendering stuff. I am just reading all kind of optimization techniques and some posts mentioned this might be an issue so I am looking for a nicer way to do the interpolation.

Share this post


Link to post
Share on other sites

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

Sign in to follow this  

  • Advertisement