Client Script – Ylands
Introduction
Client scripting is new way how to optimize multiplayer games created in Ylands editor. It allows to offload some of the scripting from server and execute it only on the client meaning that these scripts are not subjected to player multiplayer latency (i.e ping). However this advantage is coming with few disadvantages.
Differences
Because the local scripting is not authorized by server, it does not allow to do all the stuff possible with "normal" (server) scripting. Everything done trough Client Scripting stays only on the client, so there are several limitations imposed by this fact.
- Only handful of Game Logic are supporting Client Scripting
- Limited script abilities
- Can only read data from the scene but can't write data to the scene (i.e object color, hit points etc.).
- Cannot change properties of supported Game Logic.
On the other hand Client Script allows to do many things that are not needed to be authorized by server, because they only matter to the client (player) or stuff which would not be effective in Server script due the latency. It is mostly useful for improving player UI experience.
- Extensively customize UI on the client.
- Program simple UI games on the client.
- Utilize new instructions such as:
- On Update event, which executes every frame, to create i.e animations.
- Get Cursor position.
- Get Screen resolution.
- And much more.
In order to assure the communication between server and client scripting, there are events that allow to send/listen to messages between those two. For example you can send a final score of 2D UI game to the server to be included in the leaderboard.
Supported Game logic
- Custom Controls
- Custom HUD
- Custom Window
- Event Listener
Client scripting
How to
In supported Game Logic, client script can be toggled by switching the canvas by using the to toggle found in the top bar.