[UE5] ๐Ÿ–ง ๋ฉ€ํ‹ฐํ”Œ๋ ˆ์ด Replication (1)

Singery00ยท2024๋…„ 8์›” 2์ผ
0

UE5 Blueprint

๋ชฉ๋ก ๋ณด๊ธฐ
22/29
post-thumbnail
post-custom-banner

๊ฐœ์š”

๐Ÿ–ง Unreal์˜ Replication ๊ฐœ๋…์„ ์•Œ์•„๋ณด๊ณ  ๋ฉ€ํ‹ฐํ”Œ๋ ˆ์ด๋ฅผ ๋งŒ๋“ค์–ด๋ณด์ž.

์ˆ˜๋งŽ์€ ๊ฒŒ์ž„ ์žฅ๋ฅด๊ฐ€ ์žˆ์ง€๋งŒ ๊ทธ ์ค‘์—์„œ๋Š” ํ˜ผ์ž์„œ๋Š” ํ”Œ๋ ˆ์ดํ•  ์ˆ˜ ์—†๊ฑฐ๋‚˜, ์—ฌ๋Ÿฟ์ด์„œ ํ•˜๋ฉด ๋” ์žฌ๋ฏธ์žˆ๋Š” ์žฅ๋ฅด๊ฐ€ ์žˆ๋‹ค.
์ด๋•Œ, ์—ฌ๋Ÿฌ ์‚ฌ๋žŒ์ด ๋ชจ์—ฌ ํ•จ๊ป˜ ํ”Œ๋ ˆ์ดํ•˜๋Š” ๊ฒƒ์„ ๋ฉ€ํ‹ฐํ”Œ๋ ˆ์ด๋ผ๊ณ  ํ•œ๋‹ค.

์ด๋ฒˆ ์‹œ๋ฆฌ์ฆˆ์—์„œ๋Š” ์ค‘์š”ํ•œ ๊ฐœ๋…์ธ Replication์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณด๊ณ 
๋ธ”๋ฃจํ”„๋ฆฐํŠธ๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ์–ธ๋ฆฌ์–ผ ์—”์ง„์—์„œ ๋ฉ€ํ‹ฐํ”Œ๋ ˆ์ด ๊ฒŒ์ž„ ์˜ˆ์ œ๋ฅผ ๊ฐ„๋‹จํ•˜๊ฒŒ ์ œ์ž‘ํ•ด๋ณด์ž.

Replication ๊ฐœ๋…
Replication ์‹œ๋ฆฌ์ฆˆ
Replication ๊ฐ„๋‹จ ์˜ˆ์ œ
Session ๊ธฐ๋ฐ˜ ๋ฉ€ํ‹ฐํ”Œ๋ ˆ์ด ์˜ˆ์ œ


๋ณธ๋ก 

์šฐ์„ , ์–ธ๋ฆฌ์–ผ ์—”์ง„์„ ๊ต์œก๋ฐ›์œผ๋ฉฐ ๋ฉ€ํ‹ฐํ”Œ๋ ˆ์ด ์‹œ์Šคํ…œ์€ ์Šค์Šค๋กœ ์ž๋ฃŒ๋ฅผ ์กฐ์‚ฌํ•˜๋ฉฐ ์•ฝ 95% ๋น„์ค‘์œผ๋กœ ๋…ํ•™์„ ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
์Šค์Šค๋กœ ๊ณต๋ถ€ํ•˜๊ณ  ์ •๋ฆฌ ํ›„ ์ œ์ž‘ํ•œ ๋‚ด์šฉ์ธ๋งŒํผ ๋ถ€์กฑํ•˜๊ณ  ํ‹€๋ฆฐ ๋‚ด์šฉ์ด ์žˆ์„ ์ˆ˜ ์žˆ์œผ๋‹ˆ ์–‘ํ•ด๋ฅผ ๋ฐ”๋ž๋‹ˆ๋‹ค.

ํ•ด๋‹น ์‹œ๋ฆฌ์ฆˆ๋Š” ์‹ค์Šต์„ ์ง„ํ–‰ํ•˜๊ธฐ ์ด์ „์— ๋ฉ€ํ‹ฐํ”Œ๋ ˆ์ด ๊ตฌ์ถ•์„ ์œ„ํ•œ ์‚ฌ์ „ ๊ฐœ๋…์„ ๋จผ์ € ์†Œ๊ฐœํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

๊ฐœ๋… ์ •๋ฆฌ๋ฅผ ์œ„ํ•ด ์ˆ˜๋งŽ์€ ์ž๋ฃŒ๋ฅผ ์กฐ์‚ฌํ–ˆ๋Š”๋ฐ, ๊ทธ ์ค‘์—์„œ ๊ฐœ๋…์— ๊ด€ํ•ด์„œ๋Š” ์•„๋ž˜ ์˜์ƒ์ด ์••๋„์ ์ด๋ผ๊ณ  ์ƒ๊ฐํ•˜์˜€์Šต๋‹ˆ๋‹ค.
ํ•ด๋‹น ์˜์ƒ์„ ๊ธฐ๋ฐ˜์œผ๋กœ ๊ฐœ๋… ์ •๋ฆฌ๋ฅผ ์šฐ์„  ์ง„ํ–‰ํ•  ๊ฒƒ์ด๊ณ , ๋ฉ€ํ‹ฐํ”Œ๋ ˆ์ด ๊ฒŒ์ž„์„ ๊ธฐํš์ค‘์ด์‹œ๋ผ๋ฉด ๋๊นŒ์ง€ ๋ณด์‹œ๋Š”๊ฑธ ์ถ”์ฒœํ•ฉ๋‹ˆ๋‹ค.

Unreal Multiplayer Replication ๊ฐœ๋… ์˜์ƒ

์ง์ ‘ ๋ฉ€ํ‹ฐํ”Œ๋ ˆ์ด ๊ฒŒ์ž„์„ ์ œ์ž‘ํ•ด๋ณด๋ฉด์„œ ์ค‘์š”ํ•œ ๊ฐœ๋… ์š”์†Œ๊ฐ€ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
์•„๋ž˜ 3๊ฐ€์ง€๋ฅผ ์ค‘์ ์ ์œผ๋กœ ์„ค๋ช…ํ•  ๊ฒƒ์ด๊ณ , ์ถ”๊ฐ€๋กœ ํ•™์Šตํ•˜์‹œ๋ฉด ์ข€ ๋” ์‰ฝ๊ฒŒ ์ดํ•ดํ•˜์‹ค ์ˆ˜ ์žˆ์„๊ฑฐ๋ผ ์ƒ๊ฐ์ด ๋“ญ๋‹ˆ๋‹ค.

  1. ์–ผ๋ฆฌ์–ผ ๊ฒŒ์ž„ ์‹œ์Šคํ…œ์ด์˜ ๋™์ž‘ ๋ฐฉ์‹ (Game Mode, Game Instance, Game State, Player State, Player Controller)
  2. ๋ฉ€ํ‹ฐํ”Œ๋ ˆ์ด๋ฅผ ์œ„ํ•œ ์„œ๋ฒ„์˜ ํŠน์ง• (Dedicated Server, Session Server)
  3. Replication์ด๋ผ๋Š” ๊ฐœ๋…๊ณผ ๋™์ž‘

๐Ÿ–ง ์–ธ๋ฆฌ์–ผ ๋ฉ€ํ‹ฐํ”Œ๋ ˆ์ด

๋ฉ€ํ‹ฐํ”Œ๋ ˆ์ด(Multi Player)๋ž€?

๋ฉ€ํ‹ฐํ”Œ๋ ˆ์ด(Multi Player)๋Š” 2๋ช… ์ด์ƒ์˜ ์œ ์ €๊ฐ€ ๋™์ผํ•œ ๊ฒŒ์ž„ ํ™˜๊ฒฝ์—์„œ ํ”Œ๋ ˆ์ดํ•˜๋Š” ๊ฒƒ์„ ๋œปํ•ฉ๋‹ˆ๋‹ค.

๊ทธ๋ฆฌ๊ณ  ์–ธ๋ฆฌ์–ผ ์—”์ง„์—์„œ๋Š” ๋ฉ€ํ‹ฐํ”Œ๋ ˆ์ด(Multi Player)๋ฅผ ์œ„ํ•œ ๋„คํŠธ์›Œํ‚น ์‹œ์Šคํ…œ์ด ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค.


Net Mode

์œ„ ์˜์ƒ์—์„œ๋Š” 3๊ฐ€์ง€์˜ ๊ธฐ์ค€์œผ๋กœ 4๊ฐœ์˜ Net Mode๋กœ ๊ตฌ๋ถ„ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

  1. ํ”Œ๋ ˆ์ด๊ฐ€ ๊ฐ€๋Šฅํ•œ ํ™˜๊ฒฝ์ธ๊ฐ€?
  2. ๊ถŒํ•œ์ด ์žˆ๋Š”๊ฐ€? (์„œ๋ฒ„์ธ๊ฐ€?)
  3. ์™ธ๋ถ€์˜ ์ ‘์†์— ์—ด๋ ค ์žˆ๋Š”๊ฐ€?

์œ„ ์งˆ๋ฌธ์— ๋”ฐ๋ผ ๋‚˜์˜จ 4๊ฐœ์˜ Net Mode๋Š” ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค.

  1. Stand Alone
  2. Dedicated Server
  3. Listen Server
  4. Client

1. Stand Alone

์˜์ƒ์—์„œ๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค.

๊ฒŒ์ž„ ์ธ์Šคํ„ด์Šค๊ฐ€ ๋กœ์ปฌ์— ๋งต์„ ๋กœ๋“œํ•œ ๊ฒฝ์šฐ, Net Mode๋Š” ๋…๋ฆฝ ์‹คํ–‰ํ˜• (Stand Alone)์ด ๋œ๋‹ค.
๋‹จ์ผ ๊ฒŒ์ž„ ์ธ์Šคํ„ด์Šค๋Š” ์„œ๋ฒ„์ด์ž ํด๋ผ์ด์–ธํŠธ์ด๋‚˜ ๋‹จ์ผ ํ”Œ๋ ˆ์ด์–ด ๊ตฌ์„ฑ์ด๋ผ ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์ ‘์†ํ•  ์ˆ˜ ์—†๋‹ค.

์‹ฑ๊ธ€ ํ”Œ๋ ˆ์ด ํ™˜๊ฒฝ์ด๋ผ๋Š” ์†Œ๋ฆฌ์ฃ .

2. Listen Server

?Listen ์˜ต์…˜์„ ์ถ”๊ฐ€ํ•ด ์ฒญ์ทจ ์„œ๋ฒ„(Listen Server)๋กœ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋‹ค.
๊ธฐ๋ณธ์ ์œผ๋กœ ๋…๋ฆฝ ์‹คํ–‰ํ˜• (Stand Alone)๊ณผ ๋™์ผํ•˜๊ฒŒ ์‹คํ–‰๋˜๋‚˜, ๊ฒŒ์ž„์˜ ๋‹ค๋ฅธ ์ธ์Šคํ„ด์Šค๊ฐ€ ํด๋ผ์ด์–ธํŠธ๋กœ ์—ฐ๊ฒฐ๋  ์ˆ˜ ์žˆ๋‹ค.

์‹ฑ๊ธ€ ํ”Œ๋ ˆ์ด ํ™˜๊ฒฝ์—์„œ ํด๋ผ์ด์–ธํŠธ ์ ‘์†์ด ๊ฐ€๋Šฅํ•ด์ง„ ์ฒญ์ทจ ์„œ๋ฒ„(Listen Server)์ž…๋‹ˆ๋‹ค.

3. Dedicated Server

์ด๋Š” ์ œ๊ฐ€ ์˜ˆ์ „์— Dedicated Server ๊ตฌ์ถ• ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ํฌ์ŠคํŒ…ํ•œ ์ ์ด ์žˆ์ฃ .
ํ•ด๋‹น ํฌ์ŠคํŒ…์€ ์•„๋ž˜๋ฅผ ์ฐธ๊ณ ํ•ด์ฃผ์„ธ์š”.

[UE5] ๐ŸŒ Dedicated ์„œ๋ฒ„ ๊ตฌ์ถ• ํฌ์ŠคํŒ…

3๋ฒˆ์งธ๋Š” ์ „์šฉ ์„œ๋ฒ„(Dedicated Server)๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค.

LocalPlayer๋‚˜ ๋ทฐํฌํŠธ๊ฐ€ ์—†๋Š” ๊ฒŒ์ž„์˜ ์ธ์Šคํ„ด์Šค์ž…๋‹ˆ๋‹ค.
ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ํด๋ผ์ด์–ธํŠธ๋กœ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ๋Š” ์„œ๋ฒ„ ์ „์šฉ ์ฝ˜์†” ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์ผ ๋ฟ์ž…๋‹ˆ๋‹ค.

์‹ค์ œ๋กœ ๊ตฌ์ถ• ํ›„ ๊ตฌ๋™์‹œ ์„œ๋ฒ„.exe๋ฅผ ๋”ฐ๋กœ ์‹คํ–‰ํ•œ ํ›„ ๊ฐ ํด๋ผ์ด์–ธํŠธ๋“ค์ด ์ ‘์†ํ•˜๋Š” ๋ฐฉ์‹์ž…๋‹ˆ๋‹ค.

4. Client

์„œ๋ฒ„๊ฐ€ ์•„๋‹Œ ์œ ์ผํ•œ ๋ชจ๋“œ์ด๋‹ค.
๋กœ์ปฌ ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ๊ฒŒ์ž„์„ ํ”Œ๋ ˆ์ดํ•˜๋‚˜, ์„œ๋ฒ„ ์š”์ฒญ์— ๋”ฐ๋ผ ์—…๋ฐ์ดํŠธ๋œ๋‹ค.


์–ธ๋ฆฌ์–ผ ์—”์ง„์˜ ๋ฉ€ํ‹ฐ ํ”Œ๋ ˆ์ด์–ด ์‹œ์Šคํ…œ

์œ„ ๋ฐฉ์‹๋“ค์„ ํ•˜๋‚˜์”ฉ ์‚ดํŽด๋ณด๋ฉด ์•„๋ž˜ ๊ทธ๋ฆผ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

์‹ฑ๊ธ€ ํ”Œ๋ ˆ์ด

์‹ฑ๊ธ€ ํ”Œ๋ ˆ์ด์˜ ๊ฒฝ์šฐ ํ•˜๋‚˜์˜ Game Instance๋ฅผ ๊ฐ€์ง€๊ณ  ๋…๋ฆฝ ์‹คํ–‰ํ˜• (Stand Alone) Net Mode์—์„œ ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค.

๋ฉ€ํ‹ฐ ํ”Œ๋ ˆ์ด

๋ฉ€ํ‹ฐ ํ”Œ๋ ˆ์ด์˜ ๊ฒฝ์šฐ ๊ฐ๊ฐ ์ž์ฒด์˜ Game Instance๋ฅผ ๊ฐ€์ง€๊ณ , ์ž์ฒด ์›”๋“œ ๋ณต์‚ฌ๋ณธ์„ ๊ฐ€์ง„ ํ”„๋กœ์„ธ์Šค๋“ค์ด ์žˆ์Šต๋‹ˆ๋‹ค.
๊ทธ ํ”„๋กœ์„ธ์Šค ์ค‘ ํ•˜๋‚˜๊ฐ€ ์„œ๋ฒ„์ด๊ณ , ๋‚˜๋จธ์ง€๋Š” ํด๋ผ์ด์–ธํŠธ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค.

์„œ๋ฒ„์˜ ๋™์ž‘ ๋ฐฉ์‹์— ๋”ฐ๋ผ ์•„๋ž˜ 2๊ฐœ๋กœ ๊ตฌ๋ถ„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Listen Server

์ด๋•Œ, ํ”Œ๋ ˆ์ด๊ฐ€ ๊ฐ€๋Šฅํ•˜๋ฉด์„œ๋„ ์›๋ณธ ์›”๋“œ๋ฅผ ๊ฐ€์ง„ ํ”„๋กœ์„ธ์Šค๊ฐ€ ์ฒญ์ทจ ์„œ๋ฒ„(Listen Server)๋กœ ํ˜ธ์ŠคํŠธ๋ฅผ ๊ฐ€์ง„ Session ๋ฐฉ์‹์œผ๋กœ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Dedicated Server

์›๋ณธ ์›”๋“œ๋ฅผ ๊ฐ€์ง„ ํ”„๋กœ์„ธ์Šค๊ฐ€ ํ”Œ๋ ˆ์ด๋Š” ๋ถˆ๊ฐ€๋Šฅํ•œ ๋‹จ์ˆœ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์œผ๋กœ ๋™์ž‘ํ•˜๋Š” ๊ฒƒ์ด ์ „์šฉ ์„œ๋ฒ„(Dedicated Server)์ž…๋‹ˆ๋‹ค.
์‹คํ–‰ํ•˜๊ฒŒ ๋˜๋ฉด ์•„๋ž˜์™€ ๊ฐ™์€ ์ฝ˜์†”ํ™”๋ฉด์ด ๋‚˜ํƒ€๋‚˜๋Š” ๋ชจ์Šต์ž…๋‹ˆ๋‹ค.


Replication ์‹œ์Šคํ…œ

๊ฒŒ์ž„์€ ๊ฒฐ๊ตญ ๋ฐ์ดํ„ฐ ๋ฉ์–ด๋ฆฌ๋“ค์˜ ์ƒํ˜ธ์ž‘์šฉ์ž…๋‹ˆ๋‹ค.
๊ทธ๋Ÿผ ์„œ๋กœ ๋‹ค๋ฅธ ํ™˜๊ฒฝ์—์„œ ํ”Œ๋ ˆ์ด๋˜๋Š” ์บ๋ฆญํ„ฐ, ์•„์ดํ…œ ๋“ฑ์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์–ด๋–ป๊ฒŒ ์•Œ๊ณ  ๋ฉ€ํ‹ฐํ”Œ๋ ˆ์ด๊ฐ€ ์ง„ํ–‰๋˜๋Š”๊ฐ€?

๊ทธ ๋‹ต์ด '๋ณต์ œ(Replication)'๋ฅผ ํ†ตํ•œ ๋™๊ธฐํ™” ์ž…๋‹ˆ๋‹ค.

๋ฉ€ํ‹ฐ ํ”Œ๋ ˆ์ด ๊ฒŒ์ž„์ด ์‹คํ–‰๋˜๋ฉด ์–ธ๋ฆฌ์–ผ ์—”์ง„์˜ Replication ์‹œ์Šคํ…œ์ด ๋™์ž‘ํ•ด ์—ฌ๋Ÿฌ ์ธ์Šคํ„ด์Šค๊ฐ€ ๋™๊ธฐํ™”๋ฉ๋‹ˆ๋‹ค.

์ด๋ฅผ ์œ„ํ•ด Replication ์‹œ์Šคํ…œ์€ Net Driver, UNetConnection, UChannel์ด๋ผ๋Š” 3๊ฐ€์ง€ ํด๋ž˜์Šค์— ์˜์กดํ•ฉ๋‹ˆ๋‹ค.

์ƒ์„ธํ•œ ๋‚ด์šฉ์€ ์œ ํŠœ๋ธŒ ์˜์ƒ์—์„œ ์ง์ ‘ ๋ณด์‹œ๋Š” ๊ฒƒ์ด ๋” ์ดํ•ด๊ฐ€ ์‰ฌ์šธ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Replication System ํƒ€์ž„ ๋ผ์ธ

๋ฉ€ํ‹ฐํ”Œ๋ ˆ์ด ๊ฒŒ์ž„์—์„œ Replication์„ ํ†ตํ•œ ์•กํ„ฐ์˜ ์—…๋ฐ์ดํŠธ๋Š” 2๊ฐ€์ง€ ๋ฐฉ๋ฒ•์ด ์žˆ์Šต๋‹ˆ๋‹ค.

  1. Property Replication
  2. RPCs (Remote Procedure Call)

Property Replication

ํ”„๋กœํผํ‹ฐ ๋ฐฉ์‹์€ Replicate ํ”Œ๋ž˜๊ทธ๊ฐ€ ์ง€์ •๋œ ์†์„ฑ์ด ์„œ๋ฒ„์—์„œ ๋ณ€๊ฒฝ๋˜๋ฉด ์ƒˆ ๊ฐ’์ด ํด๋ผ์ด์–ธํŠธ๋กœ ์ „๋‹ฌ๋ฉ๋‹ˆ๋‹ค.

RPCs (Remote Procedure Call)

์บ๋ฆญํ„ฐ๊ฐ€ ๊ณต๊ฒฉํ–ˆ๋‹ค๊ณ  ํ•  ๋•Œ ํ”„๋กœ์„ธ์Šค๋Š” ์ œ Local ํ™˜๊ฒฝ์—์„œ๋งŒ ์‹คํ–‰๋˜๊ฒ ์ฃ .
์ด๋•Œ, RPC๋Š” ๋„คํŠธ์›Œํฌ๋ฅผ ํ†ตํ•ด ๋‹ค๋ฅธ ์ฃผ์†Œ๊ณต๊ฐ„์—์„œ ๋™์ž‘ํ•˜๋Š” ํ”„๋กœ์„ธ์Šค์˜ ํ•จ์ˆ˜๋ฅผ ์‹คํ–‰ํ•ด์ค„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋˜ํ•œ RPC๋ฅผ ์‚ฌ์šฉํ•  ๋•Œ 2๊ฐ€์ง€๋ฅผ ์ค‘์ ์œผ๋กœ ์ƒ๊ฐํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

  1. ์–ด๋””์—์„œ ์‹คํ–‰ํ–ˆ๋Š๋ƒ.
    ์‹คํ–‰์˜ ์ฃผ์ฒด๊ฐ€ ์„œ๋ฒ„์ธ์ง€ ํด๋ผ์ด์–ธํŠธ์ธ์ง€์— ๋”ฐ๋ผ ๊ฒฐ๊ณผ๊ฐ€ ์™„์ „ํžˆ ๋‹ฌ๋ผ์ง‘๋‹ˆ๋‹ค.
  2. Replicate๋  ์•กํ„ฐ์˜ ์†Œ์œ ๊ถŒ (ex. Game Mode, Player Controller, Game State...)

์–ธ๋ฆฌ์–ผ์—์„  3๊ฐ€์ง€์˜ RPC๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

1. Run On Server

Replicate ํ”Œ๋ž˜๊ทธ๋ฅผ Run On Server๋กœ ์„ค์ • ์‹œ ํ•ด๋‹น ์ด๋ฒคํŠธ๋Š” ์‹คํ–‰ ์ฃผ์ฒด์— ๊ด€๊ณ„์—†์ด ์„œ๋ฒ„์—์„œ ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค.

2. Multicast

Replicate ํ”Œ๋ž˜๊ทธ๋ฅผ Multicast์ธ ์ด๋ฒคํŠธ๊ฐ€ ์žˆ๋‹ค๊ณ  ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

ํ•ด๋‹น ์ด๋ฒคํŠธ๋ฅผ ์„œ๋ฒ„์—์„œ ์‹คํ–‰ํ•  ์‹œ ๋ชจ๋“  ํด๋ผ์ด์–ธํŠธ์—์„œ ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค.

ํด๋ผ์ด์–ธํŠธ์—์„œ ์‹คํ–‰ํ•  ์‹œ ํ˜ธ์ถœํ•œ ํด๋ผ์ด์–ธํŠธ์—์„œ๋งŒ ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค.

3. Run On Owning Client

Replicate ํ”Œ๋ž˜๊ทธ๋ฅผ Run On Owning Client์ธ ์ด๋ฒคํŠธ๊ฐ€ ์žˆ๋‹ค๊ณ  ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

๋ชจ๋“  ํด๋ผ์ด์–ธํŠธ๊ฐ€ Replicate๋œ ์•กํ„ฐ๋ฅผ ์†Œ์œ ํ•˜์ง€ ์•Š์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
๊ทธ๋ž˜์„œ ์•กํ„ฐ๋ฅผ ์†Œ์œ ํ•œ ํด๋ผ์ด์–ธํŠธ์—๊ฒŒ๋งŒ ๋ฐ์ดํ„ฐ๋ฅผ ์—…๋ฐ์ดํŠธํ•ฉ๋‹ˆ๋‹ค.

RPC ์‹คํ–‰ ๊ฒฐ๊ณผ ์ •๋ฆฌ

๊ฐ ์†Œ์œ ๊ถŒ๊ณผ ์‹คํ–‰ ์ฃผ์ฒด์— ๋”ฐ๋ฅธ ์‹คํ–‰ ๊ฒฐ๊ณผ์ž…๋‹ˆ๋‹ค.

์„œ๋ฒ„์—์„œ ํ˜ธ์ถœ

์•กํ„ฐ ์†Œ์œ ์žNot ReplicateMulticastRun On ServerRun On Owning Client
ClientServer์—์„œ ์‹คํ–‰Server์™€ ๋ชจ๋“  Client์—์„œ ์‹คํ–‰Server์—์„œ ์‹คํ–‰์•กํ„ฐ ์†Œ์œ  Client์—์„œ ์‹คํ–‰
ServerServer์—์„œ ์‹คํ–‰Server์™€ ๋ชจ๋“  Client์—์„œ ์‹คํ–‰Server์—์„œ ์‹คํ–‰Server์—์„œ ์‹คํ–‰
NoneServer์—์„œ ์‹คํ–‰Server์™€ ๋ชจ๋“  Client์—์„œ ์‹คํ–‰Server์—์„œ ์‹คํ–‰Server์—์„œ ์‹คํ–‰

ํด๋ผ์ด์–ธํŠธ์—์„œ ํ˜ธ์ถœ

์•กํ„ฐ ์†Œ์œ ์žNot ReplicateMulticastServerClient
๋กœ์ปฌ Clientํ˜ธ์ถœ๋œ Client์—์„œ ์‹คํ–‰ํ˜ธ์ถœ๋œ Client์—์„œ ์‹คํ–‰Server์—์„œ ์‹คํ–‰ํ˜ธ์ถœ๋œ Client์—์„œ ์‹คํ–‰
์™ธ๋ถ€ Clientํ˜ธ์ถœ๋œ Client์—์„œ ์‹คํ–‰ํ˜ธ์ถœ๋œ Client์—์„œ ์‹คํ–‰์‹คํ–‰ Xํ˜ธ์ถœ๋œ Client์—์„œ ์‹คํ–‰
Serverํ˜ธ์ถœ๋œ Client์—์„œ ์‹คํ–‰ํ˜ธ์ถœ๋œ Client์—์„œ ์‹คํ–‰์‹คํ–‰ Xํ˜ธ์ถœ๋œ Client์—์„œ ์‹คํ–‰
Noneํ˜ธ์ถœ๋œ Client์—์„œ ์‹คํ–‰ํ˜ธ์ถœ๋œ Client์—์„œ ์‹คํ–‰์‹คํ–‰ Xํ˜ธ์ถœ๋œ Client์—์„œ ์‹คํ–‰

Game Mode

์•„๋ž˜ ํ‘œ๋ฅผ ํ†ตํ•ด ๋ฉ€ํ‹ฐํ”Œ๋ ˆ์ด ํ™˜๊ฒฝ์—์„œ ๊ฒŒ์ž„ ์ธ์Šคํ„ด์Šค๋“ค์ด ์–ด๋–ป๊ฒŒ ๋™์ž‘ํ•˜๋Š”์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Game Mode

Game Mode๋Š” ์„œ๋ฒ„ ์ „์šฉ์œผ๋กœ ํด๋ผ์ด์–ธํŠธ์—๊ฒŒ ๋ณต์ œ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

์˜ค๋กœ์ง€ ์„œ๋ฒ„์—์„œ๋งŒ ์กด์žฌํ•˜๋ฉฐ Game Mode์—์„œ ์‹คํ–‰๋˜๋Š” ๋ชจ๋“  ๋กœ์ง์€ Run On Server์ž…๋‹ˆ๋‹ค.

๊ทธ๋ž˜์„œ ํด๋ผ์ด์–ธํŠธ ์ธก์—์„œ ํ˜ธ์ถœํ•˜๋”๋ผ๋„ ํ•ญ์ƒ ์„œ๋ฒ„ ์ธก์—์„œ ๋™์ž‘ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

Game Instance

Game Instance๋Š” ์„œ๋ฒ„, ํด๋ผ์ด์–ธํŠธ ๊ฐ๊ฐ ๋…๋ฆฝ์ ์œผ๋กœ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค.

์ƒํ˜ธ๊ฐ„์— ๋ณต์ œ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

ํ•˜์ง€๋งŒ Game Instance์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์–ป๊ธฐ ์œ„ํ•ด ์‹คํ–‰๋˜๋Š” ์ฃผ์ฒด์— ๋”ฐ๋ผ์„œ ๊ฐ€์ ธ์˜ค๋Š” ๋Œ€์ƒ์ด ์ •ํ•ด์ง‘๋‹ˆ๋‹ค.

ex) ๋ฉ€ํ‹ฐํ”Œ๋ ˆ์ด ํ™˜๊ฒฝ์˜ Game Mode์—์„œ Get Game Instance ์‹คํ–‰ ์‹œ Run On Server ์ƒํƒœ์ด๋ฏ€๋กœ ํ•ญ์ƒ Server์˜ GI ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ ์˜จ๋‹ค.

Game State

Game State๋Š” ์„œ๋ฒ„์—์„œ ์ƒ์„ฑ๋˜์–ด ํด๋ผ์ด์–ธํŠธ์—๊ฒŒ ๋ณต์ œ๋ฉ๋‹ˆ๋‹ค.
์ด๋•Œ, ํด๋ผ์ด์–ธํŠธ์—๊ฒŒ ์˜จ์ „ํžˆ ํ• ๋‹น๋˜๋Š”๊ฒŒ ์•„๋‹ˆ๋ผ ๋ณต์ œ๋œ๋‹ค๋Š” ๊ฒƒ์ด ์ค‘์š”ํ•ฉ๋‹ˆ๋‹ค.

ํด๋ผ์ด์–ธํŠธ ์ธก์—์„œ ์ง์ ‘์ ์œผ๋กœ Game State์˜ ๊ฐ’์„ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

์›๋ณธ์€ ์„œ๋ฒ„๊ฐ€ ๊ฐ€์ง€๊ณ  ์žˆ์œผ๋ฏ€๋กœ Run On Server์˜ ๋กœ์ง์„ ํ†ตํ•ด์„œ ์„œ๋ฒ„๋ฅผ ํ†ตํ•ด ๊ฐ’์„ ๋ณ€๊ฒฝํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

Player State

Player State๋„ Game State์™€ ๋™์ผํ•˜๊ฒŒ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค.
์„œ๋ฒ„์—์„œ ์ƒ์„ฑ๋˜์–ด ํด๋ผ์ด์–ธํŠธ์—๊ฒŒ ๋ณต์ œ๋ฉ๋‹ˆ๋‹ค.

์›๋ณธ์€ ์„œ๋ฒ„๊ฐ€ ๊ฐ€์ง€๊ณ  ์žˆ์œผ๋ฏ€๋กœ Player State ์—ญ์‹œ Run On Server์˜ ๋กœ์ง์„ ํ†ตํ•ด์„œ ์„œ๋ฒ„๋ฅผ ํ†ตํ•ด ๊ฐ’์„ ๋ณ€๊ฒฝํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

Player Controller

Player Controller๊ฐ€ ์กฐ๊ธˆ ๋ณต์žกํ•˜๊ฒŒ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค.
Player Controller๋Š” ์„œ๋ฒ„์™€ ํด๋ผ์ด์–ธํŠธ ๋ชจ๋‘์—๊ฒŒ ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.

์„œ๋ฒ„์— ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ ‘์†ํ•  ์‹œ ํ”Œ๋ ˆ์ด์–ด์— ๋Œ€ํ•œ Player Controller๋ฅผ ์ƒ์„ฑํ•œ ํ›„ ํ•ด๋‹น ํด๋ผ์ด์–ธํŠธ์—๊ฒŒ ๋ณต์ œํ•ฉ๋‹ˆ๋‹ค.

์ด๋•Œ, ํด๋ผ์ด์–ธํŠธ ์ธก์—์„œ Get Player Controller ๋…ธ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ปจํŠธ๋กค๋Ÿฌ์— ์ ‘๊ทผํ•  ์‹œ ๋ณด์•ˆ ์ด์Šˆ๋กœ ์ธํ•˜์—ฌ ์ •์ƒ์ ์œผ๋กœ ๋™์ž‘ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

๊ทธ๋ž˜์„œ Local Player Controller, Get Controller์™€ ๊ฐ™์€ ๋…ธ๋“œ๋ฅผ
ํ”„๋กœ์ ํŠธ์˜ Player Controller ํด๋ž˜์Šค๋กœ ์บ์ŠคํŒ…ํ•˜์—ฌ ์‚ฌ์šฉํ•˜๋Š” ๋Œ€์•ˆ์ด ์žˆ์Šต๋‹ˆ๋‹ค.

์ฐธ๊ณ  ํฌ๋Ÿผ

HUD

HUD๋Š” ๊ฐ ํด๋ผ์ด์–ธํŠธ์—์„œ ๋…๋ฆฝ์ ์œผ๋กœ ์ƒ์„ฑ๋˜์–ด ์„œ๋ฒ„, ํด๋ผ์ด์–ธํŠธ ๊ฐ„์— ๋ณต์ œ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

๋…๋ฆฝ์ ์œผ๋กœ ์ƒ์„ฑ๋˜๋ฏ€๋กœ ๋ณต์ œ๊ฐ€ ๋ถˆํ•„์š” ํ•ฉ๋‹ˆ๋‹ค.


๋งˆ๋ฌด๋ฆฌ

์—ฌ๊ธฐ๊นŒ์ง€๊ฐ€ ๊ฐ„๋žตํ•œ Replication์„ ์œ„ํ•œ ์‚ฌ์ „ ๊ฐœ๋…์ด์˜€์Šต๋‹ˆ๋‹ค.

์ฐธ๊ณ  ์˜์ƒ, ํฌ๋Ÿผ๊ณผ ๊ณต์‹๋ฌธ์„œ๋ฅผ ํ†ตํ•ด ์ž์„ธํžˆ ๊ณต๋ถ€ํ•ด์•ผํ•  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ ํฌ์ŠคํŒ…๋ถ€ํ„ฐ๋Š” ๋ธ”๋ฃจํ”„๋ฆฐํŠธ๋ฅผ ์‚ฌ์šฉํ•ด ์˜ˆ์ œ ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

profile
๊ฒŒ์ž„ ๊ฐœ๋ฐœ์ž๊ฐ€ ๋˜์–ด๋ณด์ž
post-custom-banner

0๊ฐœ์˜ ๋Œ“๊ธ€