Skip to content

Instantly share code, notes, and snippets.

View Vincenz099's full-sized avatar
🏠
Working from home

Maxim Vincenz099

🏠
Working from home
View GitHub Profile
@Vincenz099
Vincenz099 / stringcompress.cs
Created March 17, 2019 12:19
string compression
[MethodImpl(256)]
public BitBuffer AddString(string value) {
Debug.Assert(value != null, "String is null");
Debug.Assert(value.Length <= stringLengthMax, "String too long, raise the stringLengthMax value or split the string.");
int length = value.Length;
if (length > stringLengthMax)
length = stringLengthMax;
@Vincenz099
Vincenz099 / stringcompress.cs
Last active March 12, 2019 10:51
string compress/decompress for network
#if NETSTACK_INLINING
[MethodImpl(256)]
#endif
public BitBufferV2 AddString(string value) {
if (value == null)
throw new ArgumentNullException("value");
uint length = (uint)value.Length;
if (length > stringLengthMax)
length = stringLengthMax;
@Vincenz099
Vincenz099 / enetThread.cs
Last active March 19, 2020 06:33
enet thread example sniplet
private volatile bool isRunning = true;
private Thread serverThread;
private void ServerThread()
{
enetHost = new Host();
enetAddress = new Address();
enetAddress.Port = enetPort;
enetHost.Create(enetAddress, maxClients, 8);
@Vincenz099
Vincenz099 / SmallestThreeAddon.cs
Last active January 1, 2021 15:40
Smallest Three Bitlevel Addition
/*
* Copyright (c) 2019 Stanislav Denisov, Maxim Munnig Schmidt
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@Vincenz099
Vincenz099 / SimpleENetSpanTestCase.cs
Created February 22, 2019 10:53 — forked from lazalong/SimpleENetSpanTestCase.cs
Simple Test Case to Send messages with ENet-Sharp & ENetStack
//
// Simple Test Case to Send messages with ENet-Sharp & ENetStack
// -------------------------------------------------------------
// steven 'lazalong' 2019
//
// If all goes smoothly you should see the followign log line:
// [Server] LogindData= OpCode= 4 passHash= 70 username= username
// UnityEngine.Debug:Log(Object)
// You will need the dll from the reference below.
// Reference: