Early development pre alpha teeworlds 0.7 network protocol library
Go to file
2024-06-25 12:18:42 +08:00
.github/workflows Fix sys/game check in CI 2024-06-25 12:18:42 +08:00
chunk7 cleanup code, add test utilities, add error return values 2024-06-23 21:18:54 +02:00
examples/client_verbose Allow regiserting multiple callbacks (closed #4) 2024-06-25 09:22:25 +08:00
internal/testutils cleanup code, add test utilities, add error return values 2024-06-23 21:18:54 +02:00
messages7 First draft of snap unpacking 2024-06-24 17:34:51 +08:00
network6 First draft of snap unpacking 2024-06-24 17:34:51 +08:00
network7 Finish adding all 0.7 snap items that are actually sent 2024-06-24 22:50:15 +08:00
object7 Finish adding all 0.7 snap items that are actually sent 2024-06-24 22:50:15 +08:00
packer First draft of snap unpacking 2024-06-24 17:34:51 +08:00
protocol7 Unpack some more messages (not complete yet) 2024-06-25 12:16:08 +08:00
snapshot7 First draft of snap unpacking 2024-06-24 17:34:51 +08:00
teeworlds7 Allow regiserting multiple callbacks (closed #4) 2024-06-25 09:22:25 +08:00
.gitignore Compile readme examples in CI 2024-06-24 12:26:43 +08:00
go.mod cleanup code, add test utilities, add error return values 2024-06-23 21:18:54 +02:00
go.sum Make packet a module and import huffman 2024-06-06 12:51:18 +08:00
LICENSE Add bsd 2 LICENSE 2024-06-23 07:50:17 +08:00
README.md go fmt readme snippets and shellcheck check script 2024-06-24 12:40:22 +08:00

go-teeworlds-protocol

WARNING! NOT READY TO BE USED YET! Apis might change. Packages and repository might be renamed!

A client side network protocol implementation of the game teeworlds.

high level api for ease of use

The package teeworlds7 implements a high level client library. Designed for ease of use.

package main

import (
	"github.com/teeworlds-go/go-teeworlds-protocol/messages7"
	"github.com/teeworlds-go/go-teeworlds-protocol/teeworlds7"
)

func main() {
	client := teeworlds7.Client{Name: "nameless tee"}

	// Register your callback for incoming chat messages
	// For a full list of all callbacks see: https://github.com/teeworlds-go/go-teeworlds-protocol/tree/master/teeworlds7/user_hooks.go
	client.OnChat(func(msg *messages7.SvChat, defaultAction teeworlds7.DefaultAction) {
		// the default action prints the chat message to the console
		// if this is not called and you don't print it your self the chat will not be visible
		defaultAction()

		if msg.Message == "!ping" {
			// Send reply in chat using the SendChat() action
			// For a full list of all actions see: https://github.com/teeworlds-go/go-teeworlds-protocol/tree/master/teeworlds7/user_actions.go
			client.SendChat("pong")
		}
	})

	client.Connect("127.0.0.1", 8303)
}

Example usages:

  • client_verbose a verbose client show casing the easy to use high level api

low level api for power users

The packages chunk7, messages7, network7, packer, protocol7 Implement the low level 0.7 teeworlds protocol. Use them if you want to build something advanced such as a custom proxy.

projects using go-teeworlds-protocol