Framework icon indicating copy to clipboard operation
Framework copied to clipboard

Server->Client resource streaming

Open zpl-zak opened this issue 2 years ago • 4 comments

Description

The issue at hand is optimizing the transmission of game server resources to clients, while considering security and efficiency. The server must efficiently manage and distribute client-side logic and other resources to the clients without overwhelming them or compromising on the loading speed of the game.

Tasks

  • [ ] Implement a system for transmitting data from server to client.
  • [ ] Decide between a demand-based approach (lazy loading) and startup loading for resource distribution.
  • [ ] Develop a method to hash asset names to conceal their real names during transmission.
  • [ ] Investigate whether to transmit client-side JavaScript in bytecode instead of source code.
  • [ ] Consider the viability of introducing encryption for data sent between server and client.
  • [ ] Assess the use of APIs from RakNet or similar tools for networking capabilities.
  • [ ] Create a caching system with a manifest that includes file checksums to avoid redundant transfers.

Discussion

A discussion is needed to determine the most efficient and secure approach for transmitting data from the server to the client. This includes exploring lazy loading versus startup loading, hashing techniques, bytecode versus source code transmission for scripting, and the practicality of encryption in an open-source environment.

Scope

The scope encompasses server-client netcode, client and game mechanics..

(generated from voice note, yes)

zpl-zak avatar Jan 24 '24 10:01 zpl-zak

gamemode directory would contain 3 folders: server, client and assets

  • server contains Node.JS gamemode logic
  • client contains JS client code that has to be delivered to the client, preferably in bytecode.
  • assets various data streamed that can contain either game assets or other resources required by client script (low priority)

Web assets for UI are a separate concern we already handle via mongoose's ability to serve static assets from custom folder.

zpl-zak avatar Jan 24 '24 10:01 zpl-zak

Actually, we don't care about gamemode directory organization.

We need a entry_point_server and entry_point_client in package.json

About assets, probably also an Array in package.json with the path of the asset

Deewarz avatar Jan 24 '24 10:01 Deewarz

We do care about organization, for the specific reason that client & server scripts won't get executed under the same scripting layer (node + v8 vs raw v8) and thus, have to be routed properly to destination, compiled to bytecode and binded to the correct SDK.

Splitting avoids to over complexify logics.

As of reference, that's how Alt:V team does https://docs.altv.mp/js/articles/create-your-first-resource.html

  • V8 has a class named ScriptCompiler

Segfaultd avatar Jan 24 '24 10:01 Segfaultd

RakNet has the following class DirectoryDeltaTransfer, it states: Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

zpl-zak avatar Jan 24 '24 10:01 zpl-zak