Skip to content

AnyBananaGAME/ZigRaknet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZNET - Raknet in Zig.

A simple and easy to use RakNet implementation in Zig.

Installation

git clone https://github.com/AnyBananaGAME/ZigRaknet.git
cd ZigRaknet
zig build
node Test/test.js

Usage in Zig

const Client = @import("./src/client/client.zig").Client;
const std = @import("std");

var client = try Client.init("127.0.0.1", 19132);
defer client.deinit();
try client.connect();

while (true) {
    std.time.sleep(50 * std.time.ns_per_ms);
    try client.tick();
}

Usage in Node.js

import { createRequire } from 'node:module'
const require = createRequire(import.meta.url)

// If you have the .d.ts you can do
/**
 * @type {import('./index').zigraknet}
 */
const native = require(`${process.cwd()}/zig-out/lib/example.node`)

const client = native.createClient("127.0.0.1", 19132);
if (!client) {
    throw new Error("Failed to create client");
}

native.connect(client);
setInterval(() => {
    console.log('Is connected:', native.isConnected(client));
}, 1000);

Credits

  • Thanks to a user on Discord (akashic_records_of_the_abyss) for the name suggestion.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published