3d – how can i separate a network function so i can run it each frame?. c++ game development

full disclosure: i am not a very experienced C++ developer so i think i am asking something basic.

i have this snippet of code that start my client:

{
    printf("nconnecting client (insecure)n");

    double time = 100.0;
    const double deltaTime = 0.01f;
    ClientServerConfig config;

    uint64_t clientId = 0;
    random_bytes((uint8_t*)&clientId, 8);
    printf("client id is %.16" PRIx64 "n", clientId);

    ClientServerConfig config;

    Client client(GetDefaultAllocator(), Address("0.0.0.0"), config, adapter, time);
    Address serverAddress("127.0.0.1", ServerPort);

    if (argc == 2)
    {
        Address commandLineAddress(argv);
        if (commandLineAddress.IsValid())
        {
            if (commandLineAddress.GetPort() == 0)
                commandLineAddress.SetPort(ServerPort);
            serverAddress = commandLineAddress;
        }
    }

    uint8_t privateKey(KeyBytes);
    memset(privateKey, 0, KeyBytes);

    client.InsecureConnect(privateKey, clientId, serverAddress);

    char addressString(256);
    client.GetAddress().ToString(addressString, sizeof(addressString));
    printf("client address is %sn", addressString);

    const double deltaTime = 0.01f;

    signal(SIGINT, interrupt_handler);

    while (!quit)
    {
        
        client.SendPackets();

        client.ReceivePackets();

        if (client.IsDisconnected())
            break;

        time += deltaTime;

        client.AdvanceTime(time);

        if (client.ConnectionFailed())
            break;

        yojimbo_sleep(deltaTime);
    }

    client.Disconnect();

    return 0;
}

but i need this part to be a separate function:

    while (!quit)
{
    
    client.SendPackets();

    client.ReceivePackets();

    if (client.IsDisconnected())
        break;

    time += deltaTime;

    client.AdvanceTime(time);

    if (client.ConnectionFailed())
        break;

    yojimbo_sleep(deltaTime);
}

because this is the actual function that keeps the client connected to the server.

my question is, how can i separate the main function that creates the actual client, and save it as a global value?

as you can see snippet 2 needs client but i cannot just copy or create client because i get the following errors:enter image description here
enter image description here

and here is how the class is made:
enter image description here

the thing is i need the separate the function so i can run it each frame but i don’t know how i can save client as a global value.

thanks in advance.

pathfinder 1e – Is letting a player use a Large or larger race a bad idea from the game balance point of view?

I’ve played in games with it allowed; it’s not that big a deal.

Being Large is a considerable advantage for warriors, because reach is so potent. If it is available, anyone going in for melee combat is going to be very, very interested in that race. Many other races will simply not be able to realistically contribute as much for many types of warrior.

But that’s not really all that different from how things were to begin with. There are almost no races in Pathfinder with as much to offer as humans for, well, most everything. That includes warrior-ing. A bonus feat is a huge deal for almost everyone; only fighters gain so many bonus feats that the human bonus feat looks lackluster. And there are other rather-strong races to consider, such as strix. Strix are often banned precisely because flight is that good and so many people want it. Humans, of course, are almost-never banned.

So your Large race is going to be joining the ranks of those races that really stand out as being among the best of the best. On some level, all of your fighters are going to be this race, or strix, or they’re going to simply be worse off than they could be. Your non-fighter warrior-types might consider human another option. There may be a few others, but the point is that a lot of races are just going to be worse. They already are, but adding a new option may highlight that fact in uncomfortable ways.

In the end, though, your Large warrior is still, quite simply, not as powerful as a spellcaster, so there are distinct limits on how far one can go in claiming that this would be “overpowered.”

game design – Why has the Final Fantasy series largely changed for the worst (or JRPs/RPGs in general)?

From what many remembered as open-world, explorable, side-quest, challenging battles and tactics of many similar RPGS/JPRGs of the 90s to the 2000s even, it now largely seems like the genre — especially referencing to FF series since they are among the “top dogs” of it — have diminished. I get the impression that lots of what made the old games good is lost:

  • What was once more explorable of a main navigation element seems to have become more centered, linear, and/or restrictive. You can have nicer walking animations and prettier backgrounds, but the same “tunnel” like forward direction — or more aimless all-way walking potential in huge open areas replaces that special emphasis on simple old rooms (often smaller) with less to give graphically but more to give in a travel, explorative or more sensible approach than just “hunting” or “running around and grinding.” If you make a large area you should at least give different elements to it than just “lots of space.” If you scale up you need more of that “something” to scale up too — otherwise it’s more empty.

  • The old free-to-explore open-worlds/world maps, airship/flying ship/etc. mechanics (even re-visit mechanics) are almost always chopped down or implemented much less attractively (think how it started with FFX and then onwards — i.e. you can “explore” fast but it’s really largely watered down stuff/processes in doing such). The whole “open world” aspect to the classics is largely reduced to large areas/fields but no longer a blend of different terrains, sub-areas, sections or just the general nature/element of traveling/entering/exiting different areas rather than storyline/linear rules imposed on all areas/paths.

  • The battle system is definitely a hot topic, as some will tell you the new mechanics add some new flesh to the table while others feel the older system worked best and it’s been “slaughtered” merely at the attempt of “spicing up” something that people already liked for the most part/settled in with over time. The thing is — if the battle system is to be made “better” so to speak — it should try and maintain the same elements of what the skeleton of original battle systems were based on. As an example old turn-based games kept the same skeleton even when becoming “active time” battles where it’s every turn to grab for themselves the quickest. The idea was that you can maintain the same “skeletal base” of the mechanics and only tweak them better — but lots of newer stuff almost always tries to go completely a new path that strays away from this with new experimentation, impositions, rules, and/or unneeded “extra steps” at times too. Basically it’s like the game’s old and functioning system has been put less concern to while trying to “splice” its old DNA under the impression that you can supposedly better an old thing by going in a completely a new “frankenstein” direction rather than just sprucing up the initial base in a more specific/oriented/targeted manner that fulfills its initial life blood/base than trying

  • Always an extreme. Nowadays it seems games of this series are either too linear or not linear at all — there’s no longer a good balance between the two. For example one game may have so much explorable, massiveness to specific areas that you would be to get lost/tired/grinding excessively/etc. in one area to then go to the next one and rinse and repeat. On the other hand you can go super linear (think FFXIII for example) where everything is just “new area -> go straight -> battle -> story -> repeat” and such. What made the classics arguably more “wow” is the fact that the game — when it needs to — switches from storyline/linearity to open/some explorableness (to pique the natural exploring instinct) while going back to restriction when danger arose (defensive mechanism/protective inhibition) — because both of these angles match human behavior/etc. it suits gameplay. But if you make it either too open or too linear you force one side too long and it doesn’t align naturally with the cycle of human operability/engagement well enough to have proper “ups” and “downs.”

  • More “complex” systems or angles regarding leveling/power ups/etc. In old games it’s often fairly simple and straightforward to a large degree on how something more direct leads to a more expandable nature of said system to grow and keep delivering. What has replaced easy but expandable seems to be complex and rigid — more learning curves but less direction to go once you “have it.” Slowly I think the series has gone this way, possibly starting with FFXIII/around that era. You make something simple that expands as needed become complex that really doesn’t give much over time. Something like junctioning in FF8 starts simple but can scale up to cool stuff as the game goes on, especially with the addition of GFs to character stats and so on. In a game like FFXIII for example you can liken the “powering system” to weak remnants of FFX and FFXII in ways of both combat means and stat growth.

  • Games/scenes (probably applies to others outside this genre/series/etc. though) are now largely presented as cinematics/films with bits of gameplay as the only crux to break apart that concept of whether it’s innately a movie with gameplay or gameplay with cinematics (like older games of the series where “movies” in, say, the FMV form/class were much less emphasized as part of the overall game). “Cutscenes” in old FFs were mostly seamless or passive — now they are expected to emphasize more (due to the graphics) and “fill” a part of the game/impression as such rather than just be more of a seamless flow with only particular moments having more “weight” to them. In old FFs, how much of the story is lost removing the dialogue/locked moment/cutscenes? Now compare that to how much would be lost in modern games. If there is more to “lose” from the cutscenes overall then maybe they are relied on too much to shape the impression or experience of the game.

  • Game News & Rumors – GamerMob.com

    Hi all,

    Looking for feedback/reviews of my website GamerMob.com https://gamermob.com/

    c# – Game Rooms Server Architecture – ENet CSharp

    My team and I are working on an upcoming online fighting game using ENet-CSharp (A C# ENet implementation created by nxrighthere), and we’re currently designing the architecture of the server. We would be very glad to hear your suggestions concerning a couple of issues we have been struggling with.

    Our current plan is to host a dedicated server for the game, which will handle the logic and game loop of each game instance, and the MonoGame clients will simply deliver the user’s commands to the server, and present the updated game state received from it. However, we are not sure how to correctly use ENet with our division of independent game rooms.

    Let’s say, I have 100 concurrent users connected to the server, and 10 independent game rooms, consisting of 10 players each. At first, we thought that we should have a single ENet Host which will handle all of them, and a single independent ENet thread that will simply receive packets from all ends, alerting the corresponding game room to handle it within its game logic. However, it seems a bit unsafe to have one I/O thread shared by multiple different and parallel instances of the game, so our plan is as such:

    • For each game room (10 players for that matter), a unique ENet Host will be created, and 2 independent threads will run – one for the game loop, and one for the ENet event polling.
    • The ENet thread will call the Service method with a small timeout, expecting to poll one “Receive” event at each iteration, and will queue the commands received from the players.
    • The game loop, at the start of each iteration, will dequeue the commands that have been collected since the last iteration, apply them within the game logic, and so on.

    Would you guys say this is a good solution to go by?

    A question that rose with that:
    Correct me if I’m wrong, but as far as I understand, the send rate of the outcoming packets corresponds to the rate of calls to either the “Service” or the “Flush” methods. How can I ensure that at the end of each game loop, the new game state will be broadcasted immediately to the clients? Calling the “Flush” method at the end of each iteration seems logically appropriate, but unsafe at the same time (since it will be called outside the ENet dedicated thread).

    Any piece of advice would be more than welcome. Thanks in advance!

    game component – Unity: Animations not playing where they are suppose to be

    Hello to all those Unity Developers out there, I am having a big issue with my game, what I am trying to do is to make a cutscene but when I change camera it just goes in a completely different spot. there are no scripting errors and the only thing that I have on the camera(blender model) is an animator component that plays the animation when the DCT(Drone, Camera, Thing) flys into the room. Should I try to not equip the camera with the DCT model or should I remove the animator component?

    LibGDX Lights and Shadows for my 2D TiledMap Game (like Terraria/Starbound)

    Im currently working on my Terraria-Clone. After I have finished generating the world, I would like to add light and shadow to my game. For example, it would be light in the Upperworld during the day, but dark at night. In the Underworld (Mines/Caves) it is dark as well, but there are supposed to be blocks like torches, which radiate a light aura. At the moment I don’t have anything yet, because I don’t know how to start with this topic. That is why I am here now. Does anyone have any suggestions what I could do?

    Here a Picture of my Game:
    enter image description here

    How I want it to look:
    enter image description here

    I hope you can help me.
    Have a great day!

    java – In a top down game, once I have detected collision, how do I prevent it?

    I’m making a top-down game in Java. I watched some videos, and this is the code I currently use when the player is colliding with an object:

    x += -velX
    y += -velY
    

    When I apply force to a wall, the player dips into it, and can’t move along the wall.
    Does anyone have a better method?

    Desenvolvimento de um simples Clicker Game

    Estou com uma jogo browser-based na cabeça mas não consigo executá-lo.
    Basicamente eu preciso de um botâo que, ao ser apertado, mude alguma coisa no site e depois o botão fica desativado por 30 segundos.
    Exemplo: Polir Cristal > Clique > O botão Polir Cristal está desatvado por 30 segundos
    Plantes Semente > Você só poderá regar a semente daqui a 30 minutos..
    Até que o cristal se transformasse em um dragão e ao alimentar ele com frutas e continuar polindo o cristal, novas habilidades aparecem.
    Vou deixar em baixo uma pequena prévia do código do jogo.

    <!DOCTYPE html>
    <html>
    <head>
    <title>.:SEED/CRYSTAL (DRAOG):.</title>
    </head>
    <body>
    <center>
    <h2>SEED/CRYSTAL</h2>
    
    <p>Draog</p>
    
    <p id="flavourText">The golden crystal shines roughly bright</p>
    
    
    
    <img id="myImage" src="https://i.imgur.com/SkURRci.png" style="width:100px"><br/>
    <button onclick="document.getElementById('myImage').src='draogRM.png'; document.getElementById("flavourText").innerHTML = "The crystal lost its light";">polish crystal</button>
    <button onclick="document.getElementById('myImage').src='draog.png'; document.getElementById("flavourText").innerHTML = "The golden crystal shines roughly bright";">water seed</button>
    </center>
    </body>
    </html>

    Se alguém puder me ajudar, ficarei eternamente grato!

    game design – Magicka like combat (in Naruto’s universe)

    I hope this question is ok on this forum. While daydreaming about a new game that I’d try to make and fail, I imagined first person perspective game on mouse and keyboard in a forest setting in Naruto’s world while having the ability to cast jutsu’s with Magicka’s spell casting system, like clicking buttons to do hand signs and depending on the hand signs you would ____ <- insert any crazy thing you’d like here like walk on water/walls, shoot a fire ball, teleport, etc.

    Even though it seems cumbersome, Magicka’s spell casting system would, I imagine, work as a good balance between being overpowered and actually having to spend some time preparing your next attack/defence/utility jutsu.

    Back on topic: what are some games other than Magicka that managed to liberate the number of powers you hold in your controller/keyboard&mouse by making you create your own powers, but also make it a bit more complicated and maybe more interesting to cast your powers by making you make them in real time?

    Again, I understand this is a more design type question. If you deem it doesn’t belong on this forum, please tell me where I can post this question.