1024programmer Java Some thoughts on Go game server development (36): Seamless world scene construction and synchronization (3)

Some thoughts on Go game server development (36): Seamless world scene construction and synchronization (3)

The ideas in this article come from the research of two colleagues.

Mainly about the creation of entities, determination of master-slave, and master-slave switching.

The first instance of the entity is created

There is not much to talk about in itself

What you need to know is that this The entity is Master (nonsense)

Entity master-slave switching principle

  • If the entity Master instance is completely under the jurisdiction of the Cell (Green area), there is no need to switch between master and slave.
  • If the entity Master instance moves within the Cell boundary and the master-slave switching line, there is no need to perform master-slave switching.
  • If the entity Master instance crosses the master-slave switching line, a master-slave switching is performed.

Details, follow the analysis below.

Entity master-slave switching

Write picture description here

The picture above shows entity A from Cell1 Go to Cell0 and complete the master-slave switching process. (Note that there is a master-slave switching line here.)

The normal idea is that A1 -> A2, on the dividing line between the two Cells, the master-slave switching can be completed.

But there is a problem with this. After A1->A2, and then A2->A1, if there is an entity running back and forth on the dividing line between the two Cells.

Otherwise, master-slave switching will continue to occur, causing system errors.

Therefore, switch the master-slave line,

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/746472

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索