networking – How does a server receive every player input with a server-authoritative structure?

I’ve been having a lot of trouble understanding networking in fast-paced games. A server has a fixed tickrate, and the server receives input from clients at a fixed rate as well. Let’s assume that a client is running at 300fps but is sending 64 updates to the server a second.

Clearly, the client did not send data about every frame, which means that certain inputs were not sent to the server. However, in every networked first-person shooter, the server still seems to pick up every input.

enter image description here

In this image, a client presses W at a certain frame, but that frame’s data is not sent to the server.

A possible solution would be to send the server updates equal to framerate. But if a client is playing at a high framerate, they could be sending too much data for the server to handle.

So how does a server receive every input from clients?

deployment – Decoupled Drupal – Security: files structure

I am running a Drupal 8.9.2 site as a content repository accessed via an Angular 8 app. So there is one administrator who uses the Drupal interface to write content / upload files eccc…. and anonymous users view that content via the Angular app.

I have set up some views with REST Export display and have been able to pull the content in my Angular app running both backend and frontend on localhost, but when I deployed to the server problems have arisen…

all my calls fail or get canceled, this was the configuration on localhost: the Drupal website was in a folder in XAMPP/htdocs/example the views rest endpoints were like: http://localhost/example/web/api/content the Angular app was in a folder on the desktop and was served at http://localhost:4200/home
now I put all the files for both backend and frontend on the root folder on the server, I also have commented this line ErrorDocument 404 /index.php in the htaccess file found in the web folder so that non existent urls are managed by the Angular app.

So the question is: What is the correct files structure in order to have the frontend at example.com/home and my Drupal site at example.com/web/admin/eccc….. (if it is possible, otherwise please suggest a better option).

logging – How do you structure your logs to make them searchable?

What information do you include in your application logs and how do you structure it to maximise searchability and reporting? I typically forward my logs to AWS CloudWatch and search them there so performing complex, JSON queries or full-text searches is fairly straightforward.

I know structured, key-value pair formats like JSON are ideal but when I really struggle is in knowing what general information to include in them to make them easier to search and classify. Do you tag them, for instance, to know where in your codebase/system they originated from for debugging purposes? E.g. whether the error, info, warn, etc. was created in a DAL component or service layer or maybe the controller? Something I sometimes do is append a dot-separated event key to my logs that tells me what layer in my code they came from (database, API, business logic…), the domain area and maybe the action. Example (using Nodejs pino format):

// Example 1
log.info({ event: 'database.user.delete', username }, 'User successfully deleted');
// Example 2
log.warn({ event: 'controller.user.find', username }, 'User not found');

How do you structure your logs?

opengl – Data structure for collecting entities for instanced rendering

My game, a citybuilder, has many simple entities that rendered via glDrawArraysInstanced. A large city has over 600,000 entities, but most of those entities are one of a few hundred meshes. Every frame, I need a way to collect all those entities so that every entity with the same mesh, texture, and shader pass can be rendered with one draw call. Since my game thread is separate from my render thread, I currently use a data structure, which I call the draw buffer, to collect a plan for what order to draw things in.

This data structure has become a real problem. It’s essentially a three dimensional chain of pointers to dynamic arrays, with the first dimension being shader pass, the second mesh, and the third texture. Every frame, the game goes through all entities (which are not in any particular order), filters out the ones that aren’t in the view frustum, and inserts that mesh’s data into the data structure. The draw buffer takes up a lot of memory and is highly fragmented.

I feel like this isn’t the right approach, but I’m not sure what the right approach is. I’m trying to figure out if there is a way to do it without storing what I plan to do, but I do think that can be done without multiple passes on the entity list. Maybe I can keep a master version of the data structure without view frustum culling and compute view frustum culling somewhere else. Then I wouldn’t have to rebuild the data structure every frame. Instead I would have to update the data structure every time something is added or removed — fortunately entities never change shader pass, texture or mesh, so entities will always stay in the same place in the master data structure.

I hope this makes sense to someone because it barely makes sense to me. The question is, can I solve this problem with a better data structure, or should I consider a different approach entirely? Thanks for any advice you guys have.

console – C# Better structure in my code & any other critiques

Any advice on how to make this code; cleaner, more effective, just overall better!

Program creates a ‘post’ in the console. The post has a:

  1. message
  2. create on date
  3. score for ‘upvotes’ and ‘downvotes’

Users are able to upvote or downvote the post using upvote or downvote with a simple trim and to lower applied to the string.

Any feedback is good feedback. I am currently a working programmer but being self-taught the confidence is not always there..

Want to see it in action? https://repl.it/repls/RoughGhostwhiteApplet

Thanks in advance

namespace StackOverflowPost
{
    class Program
    {
        static void Main(string() args)
        {
            Console.WriteLine("Write a post!");
            string post = Console.ReadLine();
            Post newPost = new Post();
            newPost.AddPostMessage(post);
            
            bool val = true;
            while (val)
            {
                newPost.ShowPost();
                Console.WriteLine("What would you like to do now? n You can 'UpVote', 'DownVote'");
                string inputData = Console.ReadLine();
                string cleanData = inputData.Trim().ToLower();

                if (cleanData == "upvote")
                {
                    newPost.Upvote();
                }
                else if (cleanData == "downvote")
                {
                    newPost.DownVote();
                }
                else
                {
                    val = false;
                }
            }
        }

        class Post
        {
            int voteScore;
            string postMessage;
            DateTime postDate;


            public Post()
            {
                this.postDate = DateTime.Now;
            }

            public void AddPostMessage(string post)
            {
                postMessage = post;
            }

            public void Upvote()
            {
                voteScore++;
            }
            public void DownVote()
            {
                voteScore--;
            }

            public void ShowPost()
            {
                Console.WriteLine("------------------------------------");
                Console.WriteLine($"Original Post Date {postDate}");
                Console.WriteLine($"User wrote: {postMessage}");
                Console.WriteLine($"Votes: {voteScore}");
                Console.WriteLine("------------------------------------");
            }
            
        }
    }
}

encoding scheme – Is there a way to store an arbitrarily big BigInt in a bit sequence, only later to convert it into a standard BigInt structure?

I am trying to imagine a way of encoding a BigInt into a bit stream, so that it is literally just a sequence of bits. Then upon decoding this bit stream, you would generate the standard BigInt sort of data structure (array of small integers with a sign). How could you encode the BigInt as a sequence of bits, and how would you decode it? I don’t see how to properly perform the bitwise manipulations or how to encode an arbitrary number in bits larger than 32 or 64. If a language is required then I would be doing this in JavaScript.

For instance, this takes bytes and converts it into a single bit stream:

function arrayOfBytesTo32Int(map) {
  return map(0) << 24
    | map(1) << 16
    | map(2) << 8
    | map(3)
}

How would you do that same sort of thing for arbitrarily long bit sequences?

database design – How to structure a listings table

Say I have a table called listing and it has the following columns:

id | name   | description | price | created_date|
 0 | iPhone | A phone     | 1000  |   7/4/2020  |

Since I want to track when a listing is sold, I’m considering adding a sold_date column.

My concern is that this would cause a bunch of rows in the listing table to have a null in the sold_date column since every listing wouldn’t be considered sold. Would having null values be okay in this case, or should I create another table that would contain the sold_date column and references a listing?

sets – Bloom filter like data structure supporting iteration

I am wondering whether there exists a data structure similiar to a bloom filter in the sense that it is an approximate finite set representation (allows for false positives, but no false negatives) and supports:

  • constant time complexity union of two sets
  • constant time complexity insertion of an element

but also allows for efficient iteration over the approximate elements in the set, i.e. iterate over all elements that are either actually in the set or false positives with a time complexity that is linear in the number of elements in the set

python – How the basic structure of a simple messaging app works?

How the messaging apps works?
What is the Basic algorithm of it?
I tried the following method to make a messaging app.

  1. I enters message
  2. Message converts to a text file
  3. Text text file uploads to the ftp server
  4. My friend gets the text file from ftp and reads it

Is this method correct?
Do needed to use FTP server?
I found it is very slow and sometimes it gets timeout Error.
What is wrong here? Is my method wrong or the problem is the server?

8 – Forena Reports, does not appear in the Drupal menu Structure

I installed the downloaded Forena module for Drupal 8 from this link https://www.drupal.org/project/forena/releases/8.x-1.x-dev, and it installs correctly, but when I go to the menu Structure to start creating the report, the option “Forena Reports” does not appear.

How can I solve this problem?

Note: I also have the Forena UI module activated, but I was reading this :

Release notes Basic rendering of reports and document types are complete, however the GUI version of the report writer has not yet been ported. Sufficed to say, this version can be used by Drupal 8 report writers who are comfortable writing .frx files and sql elements by hand.