inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

[켠김에 출시까지] 유니티 캐주얼 모바일 MMORPG (M2)

Interpolation & Server Tick Frequency

해결된 질문

172

Frontal Achivment

작성한 질문수 9

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);
			}
		}

C# unity mysql MMORPG ef-core asp.net-web-api

답변 2

1

Rookiss

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.

0

Frontal Achivment

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?

1

Rookiss

  1. 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++.

  2. 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

  3. It depends actually if you have collision or not. 3D collision is almost impossible, most games with 3D collision are tyle-based games.

  4. Sure, but you really have to know what you're doing. RUDP is much harder to code without a mistake.

  5. 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#.

  6. 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

Frontal Achivment

Thank you 🙂 I’m waiting then for this new course 😋

0

인프런 AI 인턴

안녕하세요, 인프런 AI 인턴입니다. Frontal Achivment님.

서버의 메인 루프에서 실행 시간 제한을 두지 않고, JobSerializer Timer로만 처리하며 deltaTime 없이 작동하는 방식에 대해 질문 주셨군요. 이는 서버의 틱 주파수가 일정하지 않게 되어 클라이언트와의 동기화 문제를 초래할 수 있습니다.

  1. 서버의 틱 주파수: 현재 서버는 Thread.Sleep(0)으로 구성되어 있어 실행 속도를 제어하는 기능이 부족합니다. 이는 서버가 필요 이상으로 빠르게 혹은 느리게 작동하게 만들 수 있습니다. 서버의 정밀한 틱 주기를 유지하는 것이 중요합니다. 고정된 틱 주기를 위해 Stopwatch를 활용하여 정확한 시간 기반으로 루프를 조정하는 방식을 고려해 보세요.

  2. 데이터 동기화 및 보간(Interpolation): _lastSendTick = System.Environment.TickCount64;를 이용하여 플레이어의 위치를 보간하는 것은 기본적인 방법이긴 하지만, 서버와 클라이언트 간의 네트워크 지연(latency)을 보정하는 데는 한계가 있을 수 있습니다. 클라이언트에서 직접 보간(예: 마지막 수신된 위치와 현재 위치를 중간 값으로 자연스럽게 연결) 처리를 추가하여 부드러운 플레이 경험을 제공하는 것이 좋습니다.

관련된 논의와 해답은 아래 링크에서 확인할 수 있습니다.

저는 질문자님의 이해를 돕고자 지식공유자님의 기존 답변을 참고하여 유사한 답변 링크를 추천해드리고 있습니다.
현재 베타 기능으로 답변이 만족스럽지 않을 수 있는 점 양해 부탁드립니다. 🙏
추가적으로 궁금한 점이 있으시면, 이어서 질문해 주세요. 곧 지식공유자께서 답변해 주실 것입니다.

학습 전 커리큘럼 관련 질문 드립니다

0

109

1

강의 커리큘럼 질문 드립니다

0

60

1

수업질문은 아닌데요^^

0

114

1

게임 로직 루프에서 게임 틱 누락으로 인한 높은 CPU 사용 문제

0

85

1

선 이동과 히트 판정에 대해 질문 드립니다.

0

90

1

Job Scheduler - Cache locality

0

75

2

MMO 3D 게임 서버의 스킬 판정을 어떻게 하면 좋을까요?

0

190

2

코드 머지와 관련하여.

0

93

1

퀘스트 처리 시 궁금한게 있습니다.

0

115

2

Nagle Algorithm

0

99

1

현재 강의를 이용하여 3D 게임을 만들 경우 변경되야 될 사항들에 대해 궁금합니다.

0

131

2

ResourceManager에서 Multiple Sprite를 로드하는 방법

0

101

1

M2는 업데이트가 끝난건가요?

0

149

1

서버에서 디스커넥트되시는분들 JWT 관련 참고하셔요

0

120

1

aws 와 microsoft azure 중 aws 선택하신 이유가 궁금합니다.

0

189

1

강의는 끝인건가요?

0

331

2

아이템 강화 테이블 관련

0

225

2

강의 관련 질문 드립니다.

0

238

1

리니지1의 이동 질문

0

400

2

버그에대한 썰

0

130

1

포탈 프로젝트에 서버 코드에 에러가 뜨네요

0

137

1

아이템 수량에 관해서 질문입니다.

0

140

1

퀘스트 관련 질문 드립니다.

0

142

1

스포닝풀 작업하는거 질문드려요

0

242

2