Jump to content

  • Log In with Google      Sign In   
  • Create Account

hplus0603

Member Since 03 Jun 2003
Online Last Active Today, 09:59 AM

#5294747 World loop/engine design with apache MINA

Posted by hplus0603 on 02 June 2016 - 10:48 PM

I'm guessing the clientside fps would need to be factored in but I doubt it will ever drop below 60.

 

You should separate your graphics and your physics simulation rates.

 

are you referring to how the server will "hold" a command until the 50ms mark and then send the update packet and therefore it has been seen?

 

Yes, and the same for commands client-to-server (typically.)

 

Also, clients will send input commands to the server, and the server will then repeat those out to all other clients, so the other clients can simulate the original clients actions.

 

You will also need some amount of de-jitter buffer, where commands are queued for a particular tick, that may be in the future or past of where you are now. When the command is for the "past" it means the packet arrived "too late" and you need to increase your estimate of latency / jitter. When commands arrive for "way" into the future, it means your estimate is wrong the other way.




#5294683 VPS Connect Issue

Posted by hplus0603 on 02 June 2016 - 12:32 PM

What does Wireshark say about the packets that you send/receive when trying to connect?




#5294682 World loop/engine design with apache MINA

Posted by hplus0603 on 02 June 2016 - 12:31 PM

Typically, there will be one (fixed) tick rate for physics simulation, and the either a separate, fixed, tick rate for networking, or some kind of adaptive network send rate.

 

So, yes, different rates for "simulation" versus "networking" is common. Typically, you will time-stamp each event that goes into a packet with the tick number for it. (Which may be "when it happened in the past" or "when it should happen in the future.")

 

Note that collision, pickups, and other gameplay events should happen at the physics tick rate. The network tick rate is simply there to batch up multiple small updates into one bigger packet, to cut down on packet header overhead. This will have the effect of adding some effective latency to the "round trip time" from "command" to "everybody has seen this command," but it's generally worth it. 50 ms network updates versus 17 ms physics ticks only add an extra 33 ms of effective round trip time, and saves 66% of network packet header overhead!




#5294572 World loop/engine design with apache MINA

Posted by hplus0603 on 01 June 2016 - 09:40 PM

FPS games need the server to run at 60 Hz like the client.
Turn based games do not.
You have to make a decision about how correct you want your game to be.
If by-the-tick movement is important to you, then make the server simulate the game and correct clients that diverge.
If only "important" events (like battles, pick-ups, etc) matter to you, then don't worry about the precise location of clients, and only make the server the arbiter of important events.
There's no "right" or "wrong" here -- it's up to what you think is important to your game. (With an eye towards cost -- servers for FPS games are more costly than servers for importance-only games.)


#5294375 Can i Use MyCloud WD as an Online Game Server for Androids and iOS Systems ?

Posted by hplus0603 on 31 May 2016 - 04:06 PM

That being said, you can put together a Raspberry Pi 3 plus a MicroSD card, plus some USB stick storage, plus a cell phone charger for power, for about $50.
Or pay a little extra and get a complete kit.
It comes with WiFi and Wired Ethernet. You can also plug in a display and keyboard into it, temporarily, while setting it up, and then manage it through SSH.
It's a vastly better server platform than the MyCloud device. Faster, too, and with more memory. However, it's still not a GOOD long-term server platform, but it's the best you can get for $50 :-)

Btw: If your hard drives are USB compatible, you can also use a Raspberry Pi as a home storage server.


#5294225 Are there any services for reducing network delay/latency?

Posted by hplus0603 on 30 May 2016 - 02:20 PM

I think it is fair to assume that a company which operates datacentres in diverse locales will have negotiated reasonably optimal peering agreements.


The problem is that "optimal" for an ISP is different from "optimal" for a game player.
An ISP largely worries about cost first, and simple metrics like hop count and loss second.
A game player largely worries about latency, with loss being a secondary metric.
Thus, it is possible that "better" routes through the Internet exists for a gamer, than what he/she will get by default from their ISP.

How much better, and what level of investment it takes to deliver on that promise, is the crux of the question :-)


#5294184 Server design problems

Posted by hplus0603 on 30 May 2016 - 11:17 AM

- Event manager needs to know about combat manager so that it can call the function which handles skill cast when the target is within range.


This is where interfaces come into play. Event Manager doesn't need to know about "combat manager" specifically; it needs to know about "all the possible event receivers identified by name."

So, each event receiver tells the event manager what their name is. I don't know what language you're using, but all the languages support some kind of interfaces through some kind of polymorphism.

So, in C++, it might look like:
 
class IEventHandler {
public:
    virtual void OnEvent(PlayerId sender, EventId type, DataBuffer const &data) = 0;
};

void EventManager::RegisterHandler(std::string const &name, IEventHandler *handler) {
    handlers_[name] = handler;
}

bool EventManager::DispatchEventFromTo(PlayerId sender, std::string const &name, EventId type, DataBuffer const &data) {
    auto handler(handlers_[name]);
    if (handler == handlers_.end()) {
        return false;
    }
    handler->OnEvent(sender, type, data);
    return true;
}


class CombatManager : public IEventHandler {
public:
    /* other stuff goes here */

    void OnEvent(PlayerId sender, EventId type, DataBuffer const &data) override;
};

void CombatManager::SetEventManager(EventManager *mgr) {
    mgr->RegisterHandler("CombatManager", this);
}

void CombatManager::OnEvent(PlayerId sender, EventId type, DataBuffer const &data) {
    /* handling events go here, typically using some table that maps "type" to functions */
}

Obviously there are a lot of assumptions here, like the various types you actually use, and that managers are identified by strings. Another option is to set aside different event type value ranges for different managers, or use a registry negotiated at connection, or a number of different options with different strengths/weaknesses.

The main point here: Using abstract interfaces, dependency graphs can be made acyclic.

For what it's worth: The next step up in software organization is to define each of your services ("managers") in terms of interfaces as well, and use a registry of those interfaces. That will allow you to select a "Fake Network Manager" implementation when you want to run on a single machine, and a "Fake File System Manager" when you want to run unit tests fast.


#5294050 Server difference regarding input

Posted by hplus0603 on 29 May 2016 - 09:53 AM

Because the data is already old, does it mean that server-side game loop needs to always read/process the packets from the past based on some maximum tick it allows players to be behind?

sYou have three options:

1) Play it as soon as possible on the server. This is simple, but introduces game play artifacts because of jitter. It also will let the simulation on the client diverge from the server, so continual corrections are needed.

2) Rewind the server simulation and apply the command, with some maximum allowed amount of rewind (to avoid too much cheating.) This is the "Source" / "Counter-Strike" model. This reduces lag when players are not interacting, but causes corrections when players interfere with each other.

3) Make the client schedule the event for the future -- the client actually says "play this on step 12" when sending the command. Similarly, the client then also locally delays the command until that time step. This lets you do 100% deterministic lock-step simulation, but introduces a client-side command lag.


#5293991 What is the top factor for MMO engines limiting world size?

Posted by hplus0603 on 28 May 2016 - 08:28 PM

I would love to see you succeed in that vision, I really do!


#5293979 Server difference regarding input

Posted by hplus0603 on 28 May 2016 - 04:59 PM

Do you need to mark the packets with step numbers even if you are using TCP..?


In general, yes, you'll want to do that.

If you don't, then you have to delay everybody's game if one client's stream gets delayed.
And TCP stream delays are worse than UDP delays, because even if the next packet makes it, the TCP stack will wait for the re-transmit of the previous packet before giving you any more data.


#5293942 How would you scale single-threaded server?

Posted by hplus0603 on 28 May 2016 - 10:54 AM

Take a look at how irc networks work.


I agree that it's an interesting systems design example, and looking at how it grew from the first implementation in the 80s is another interesting case study.
But IRC is not a good architecture for games, for the same reason you said: latency is not a goal there.

It's worth looking into how others solved problems, even outside of the games industry


This is also a reasonable statement, but with some caveats. A lot of companies and individuals in other industries have over the years come in, and thought "we're the best in our industry at doing X, and games seem like they do a lot of X, so our solution will totally rule games!"
That seldom ends well. Doesn't matter if it's physical simulation, networking, visualization, stock trading, media serving, or whatever -- the evolutionary pressures in the game industry are very different from the evolutionary pressures in most other industries.


#5293829 Cloudhosting a C# Console Application utilizing UDP

Posted by hplus0603 on 27 May 2016 - 11:29 AM

The hosting difference between TCP and UDP isn't that big.
The main question is whether the latency/jitter performance of the virtualized host is sufficient for your use case.
There are many cases where it will be just fine (especially if you "reserve" something that's a "full" computer.)


#5293712 How to abort a file transfer immediately?

Posted by hplus0603 on 26 May 2016 - 08:57 PM

same question


Same answer!


#5293711 How would you scale single-threaded server?

Posted by hplus0603 on 26 May 2016 - 08:53 PM

how would you scale single-threaded server?


You run one process per core on the hosting server, and send different users to different processes.
Typically, each process will listen on a different port, and you'll use some kind of registry/discovery to manage it all.


#5293703 MySQL server vs Microsoft sql server

Posted by hplus0603 on 26 May 2016 - 07:34 PM

Benchmarks for different databases are available online, and the throughput really depends on your specific workload.

That being said, if you can live with the schema constraints of SimpleDB, or BigTable, then you can scale order of magnitude larger than you can with a single-instance database.




PARTNERS