Asset - Scripts ZNet - Easy to use, entity-based networking framework!

Zek

Member

Game Maker: Marketplace
Itch.io
Price: $1.99
Cross-Platform (Except for HTML5)

Networking can be hard and time-consuming, especially for beginners.

ZNet is a lightweight, cross-platform, networking framework for making multiplayer games a lot easier to create!

The main focus when developing ZNet was to make an easy to use entity system.
With this system you can easily create NPCs, enemies, etc... without writing a lot of extra code.

Here's an example of how you would go about creating a simple enemy:
znet_entity_create("enemy_type", "enemy_id", "x", 0, "y", 0, "hp", 100).
You simply specify the entity type and the entity id, followed by a set of defined keys.

With ZNet you can easily get the state of a client/server, making error handling a lot simpler!

ZNet works on every platform, except for HTML5.

ZNet also handles a lot of things such as:
  • Checking if the client is still connected to the server.
  • Better way of checking if the server if full.
  • Version checking.
  • Using both a client and a server in the same room.
  • Getting the ping of a client.
  • And more!
Click here to download a platformer and chat demo.
Click here for documentation and a list of all the features that comes with ZNet.
 
Last edited:
@Zek
can you explain how znet_create_entity() and znet_entity_attach_client() works?

it looks like they automatically syncs the variables you pass it to the other client's instances but I don't actually see where your passing in the instance or object
 
Last edited:

Zek

Member
@Zek
can you explain how znet_create_entity() and znet_entity_attach_client() works?

it looks like they automatically syncs the variables you pass it to the other client's instances but I don't actually see where your passing in the instance or object
Sorry for the late reply! For some reason I never got a notification.

Entities are not actually objects. They work similarly to how ds_maps works, you give them keys and assign values to them.
So for example:
znet_entity_create("enemy", "enemy_0", "x", 320, "y", 240, "hp", 100);
When creating a entity you first need to set the entity_type and the entity_name.
Here we give the entity a type of "enemy". This can be useful if want to get all the entities that is an enemy.
Next we set the name of the entity. This basically acts as a unique identifier for that entity.
The following arguments are keys that we can give to the entity. Think of them as variables. Here we set the x, y position to 320, 240 and the hp to 100.
The keys will also be automatically synced now. So whenever you modify a key ZNet will automatically handle everything.

znet_entity_attach_client basically attaches an entity to a specific client, meaning that once the client disconnects, that entity will also get destroyed. I added this because destroying an entity in the Game End event won't work. This would only really be useful for player entities.

Feel free to ask if there's anything else you need help with. :)
 

yokun51

Member
Hello, I know that this framework is not new, but I am starting to use it. I notice that each time I send a packet, the ram increases without ever going down, is this normal and how to solve this problem?
 
Top