해결된 질문
작성
·
118
0
Hey,
I have a question server in main loop dont limit execution time, everything happen withouth deltatime only base on JobSerializer Timer. So in the end we dont really know if server is working with 200 ticks per second or 15. Does this approach isnt affecting player objects latency? Does _lastSendTick = System.Environment.TickCount64; is enough to interpolate beetween player last postion and current?
static void GameLogicTask()
{
while (true)
{
GameLogic.Instance.Update();
Thread.Sleep(0);
}
}
답변 2
1
Hi.
In this course the server does not run in a fixed frame rate, as you pointed out.
This doesn't actually matter since most objects
will have their own tick interval regardless of the Main Server's GameLogicTask.
(ie. you Push your job AFTER some time interval, which is actually the object's tick rate)
If you run your monsterAI with a 200ms tick, you can assume deltaTime is 200ms.
This means that the server will run very roughly it is not as precise as the client,
but which is 100% normal since MMORPGs
can't update game logic code too frequently.
If you need something more accurate, ie. a fireball skill
which somehow needs to tick faster, than you can adjust the TickInterval.
Note that this way of letting each actor choose its own Tick Interval
was the first way I have noticed in my first project (TERA).
But there are also some projects using a strict fixed frame rate. (B&S)
If the server will run at 20 FPS then all objects will be updated at
20 Frames Per second accordingly, which makes life much easier in general.
You can actually make the server game contents code pretty much like Unity.
One downside is that if you need faster tick for a single object,
you can only increase the global tick which can be R-EALLY problematic.
Yes. Some projects in development actually use C# servers. But TERA is too extreme because most of its skills are non-targeted skills. If the cpu burden is too high, you should still stick with C++.
Yes. I promised to myself that I will never use Actor-based Job Models in my project after experiencing all the weird problems with TERA :D
It depends actually if you have collision or not. 3D collision is almost impossible, most games with 3D collision are tyle-based games.
Sure, but you really have to know what you're doing. RUDP is much harder to code without a mistake.
If you plan a serious massive PvP game, or at least if you want to squeeze your computer to another level and let more users, you should still choose C++ instead of C#.
Yes. I'm planning a course on UE5 <-> ASIO C++ MMO. We will mostly use hyper casual style low-poly assets to make art easy. One of my goal is to try a seamless MMORPG with 1 server only. (somehow like diablo4, but diablo is not really simultaneous..)
0
안녕하세요, 인프런 AI 인턴입니다. Frontal Achivment님.
서버의 메인 루프에서 실행 시간 제한을 두지 않고, JobSerializer Timer
로만 처리하며 deltaTime
없이 작동하는 방식에 대해 질문 주셨군요. 이는 서버의 틱 주파수가 일정하지 않게 되어 클라이언트와의 동기화 문제를 초래할 수 있습니다.
서버의 틱 주파수: 현재 서버는 Thread.Sleep(0)
으로 구성되어 있어 실행 속도를 제어하는 기능이 부족합니다. 이는 서버가 필요 이상으로 빠르게 혹은 느리게 작동하게 만들 수 있습니다. 서버의 정밀한 틱 주기를 유지하는 것이 중요합니다. 고정된 틱 주기를 위해 Stopwatch
를 활용하여 정확한 시간 기반으로 루프를 조정하는 방식을 고려해 보세요.
데이터 동기화 및 보간(Interpolation): _lastSendTick = System.Environment.TickCount64;
를 이용하여 플레이어의 위치를 보간하는 것은 기본적인 방법이긴 하지만, 서버와 클라이언트 간의 네트워크 지연(latency)을 보정하는 데는 한계가 있을 수 있습니다. 클라이언트에서 직접 보간(예: 마지막 수신된 위치와 현재 위치를 중간 값으로 자연스럽게 연결) 처리를 추가하여 부드러운 플레이 경험을 제공하는 것이 좋습니다.
관련된 논의와 해답은 아래 링크에서 확인할 수 있습니다.
TickCount
의 활용과 서버 오버플로우 방지에 대한 의견이 포함되어 있습니다.저는 질문자님의 이해를 돕고자 지식공유자님의 기존 답변을 참고하여 유사한 답변 링크를 추천해드리고 있습니다.
현재 베타 기능으로 답변이 만족스럽지 않을 수 있는 점 양해 부탁드립니다. 🙏
추가적으로 궁금한 점이 있으시면, 이어서 질문해 주세요. 곧 지식공유자께서 답변해 주실 것입니다.
Thank you for answer. I have couple more questions. 1. Does from your perspective c# is capable for game servers for more advanced games like MuOnline, Tera, Rappelz? 2. Is this architecture from this course good enough for this kind games? 3. What you would change if you would write game server for game like Albion Online, warborne above ashes where the game is still top down but 3D and have PvP 100x100 aka Zerg vs Zerg? 4. How this game would differ if instead of tcp it would use reliable udp? 5. In cases from other question if it’s not worth effort then you would recommend c++? 6. Do you plan course with this kind of game 3D top down mmo with big PvP battles?