[FND] Entity/Agent refacto

Content and general development discussion for Source of Mana.


Post Reply
User avatar
Reid
Lead Developer (SoM)
Lead Developer (SoM)
Posts: 1549
Joined: 15 May 2010, 21:39
Location: Artis
Contact:

[FND] Entity/Agent refacto

Post by Reid »

I'm currently doing a pretty huge refacto on all of our entity system (mobs, npcs, players) to split everything to work with a client/server style.

The first version will feature a pretty heavy/greedy system that mimic the 0.0.3 milestone, it will be laggy but it will give us a first implementation to work on.

To differentiate the client and server side entity I renamed this last in "Agent".

The client will send player movement (both click events and input vector) at each frame to the server.
The server will then manage all of the move logic and create a velocity vector based on the computed navigation path or collision avoidance for both movement cases.
This velocity vector is then sent back along all other surrounding agents to each client.


The mock-up currently looks like this:

Navigation by mouse:

  • Service Action: Click

  • Service Client: SetClickPos to Server

  • Service Server: SetClickPos through the navigation agent

  • Service Server: Apply NavigationPath to Agent

  • Service Agent: Update along the NavigationPath with the navigation server

  • Service Agent: Receive _velocity_computed() apply and forward to Client

  • Service Client: Receive _velocity_computed(), forward to Entity

  • Service Entity: Receive _velocity_computed() and (lerp a) set_position(new_pos)

Navigation by sticks/keys:

  • Service Action: Move input

  • Service Client: SetMovePos to Server

  • Service Server: SetMovePos to the Agent

  • Service Agent: Call direction_to() on (pos + velocity)

  • Service Agent: Trigger manually the _velocity_computed()

  • Service Agent: Receive _velocity_computed() apply and forward to Client

  • Service Client: Receive _velocity_computed(), forward to Entity

  • Service Entity: Receive _velocity_computed() and (lerp a) set_position(new_pos)

Surrounding Agents (npcs, mobs, other players):

  • Service Agent: Randomly apply a new NavigationPath to Agent

  • Service Agent: Update along the NavigationPath with the navigation server

  • Service Agent: Receive _velocity_computed() apply and forward to Client

  • Service Client: Receive _velocity_computed(), forward to Entity

  • Service Entity: Receive _velocity_computed() and (lerp a) set_position(new_pos)

All of this is being worked on this branch: https://gitlab.com/sourceofmana/sourceo ... ic_network
More info about the on-going network integration: viewtopic.php?t=21582

"Time is an illusion. Lunchtime doubly so."
-- Ford Prefect
User avatar
Reid
Lead Developer (SoM)
Lead Developer (SoM)
Posts: 1549
Joined: 15 May 2010, 21:39
Location: Artis
Contact:

Re: [FND] Entity/Agent refacto

Post by Reid »

This refacto has been completed, the current version is still a huge work in progress but we now have something to work with!

A little change on the implementation: the server is meant to be working without physic and thus collision-less. All displacement will be computed within the navigation server, it's a different system but it should ease up some of our development.
I made some change on our implementation of "Navigation by sticks/keys" to reflect this design. We now have all entities and agents sync in the offline mode as it was on 0.0.3.

"Time is an illusion. Lunchtime doubly so."
-- Ford Prefect
User avatar
WildX
Source of Mana
Source of Mana
Posts: 2084
Joined: 07 Aug 2010, 14:13
Location: United Kingdom
Contact:

Re: [FND] Entity/Agent refacto

Post by WildX »

It's good to see the [FND] tag once again!

TMW Team member

User avatar
jesusalva
Moubootaur Legends
Moubootaur Legends
Posts: 1438
Joined: 14 Nov 2016, 22:20
Location: Brazil
Contact:

Re: [FND] Entity/Agent refacto

Post by jesusalva »

As long that you don't do it tmwa style it's fine.

(In tmwa, with proper packet forgery, it's possible to ignore completely the collision map).

Jesusalva (aka. Jesusaves)
Donate to the project! ─ (Note: If you want to support me instead, Buy me a coffee!)

Former system administrator, project lead and developer.
Do not contact me regarding The Mana World inquiries.

Post Reply