Conreality Software Development Kit (SDK) for Go

The Conreality SDK for Go is currently at an early development stage at: https://github.com/conreality/conreality.go

Note

Pending the release of a Conreality SDK for Go, you can integrate Go software with Conreality games by issuing SQL commands over the PostgreSQL network protocol (e.g., via the lib/pq or jackc/pgx libraries). Refer to the documentation for the Conreality SDK for SQL.

Examples

Connecting to the Master

///usr/bin/env go run "$0" "$@"; exit "$?"

package main

import ("database/sql"; "fmt"; "os"; _ "github.com/lib/pq")

func main() {
  dbname := os.Getenv("USER")

  db, err := sql.Open("postgres", "sslmode=disable dbname=" + dbname)
  if err != nil { panic(err) }
  defer db.Close()

  rows, err := db.Query("SELECT 42 AS answer")
  if err != nil { panic(err) }
  for rows.Next() {
    var answer int
    rows.Scan(&answer)
    fmt.Println(answer)
  }
}

Installation

$ go get github.com/conreality/conreality.go

Reference

https://godoc.org/github.com/conreality/conreality.go

$ go doc github.com/conreality/conreality.go
package conreality
import "github.com/conreality/conreality.go"
constant conreality.Version
fmt.Printf("Conreality SDK for Go v%s\n", conreality.Version)

Actions

type conreality.Action
func (*Action)conreality.Abort() → error
func (*Action)conreality.Commit() → error
func (*Action)conreality.SendEvent(predicate string, subject, object *Object) → (*Event, error)
var event, err = action.SendEvent("met", bob, alice)
if err != nil {
  panic(err)
}
fmt.Printf("Sent an event: #%#v\n", event)
func (*Action)conreality.SendMessage(messageText string) → (*Message, error)
var message, err = action.SendMessage("Greetings from Go!")
if err != nil {
  panic(err)
}
fmt.Printf("Sent a message: #%#v\n", message)
func (*Action)conreality.SendAudioMessage() → (*Message, error)
// TODO
func (*Action)conreality.BeginAudioMessage() → (*?, error)
// TODO
func (*Action)conreality.ReportLocation(location Location) → error
// TODO
func (*Action)conreality.ReportMotion() → error
// TODO

Assets

type conreality.Asset

Binaries

type conreality.Binary

Cameras

type conreality.Camera

Clients

type conreality.Client
func conreality.Connect(gameURL string) → (*Client, error)
var client, err = conreality.Connect("tcp://skynet.local")
if err != nil {
  panic(err)
}
defer client.Disconnect()
func (*Client)conreality.Disconnect() → error
func (*Client)conreality.Login(agentUUID string, secret string) → (*Session, error)
var session, err = client.Login("ff27a78c-a8b3-48a5-bf7c-41b22cf14333", "")
if err != nil {
  panic(err)
}
defer session.Logout()

Events

type conreality.Event

Games

type conreality.Game

Locations

Messages

type conreality.Message

Objects

type conreality.Object

Players

type conreality.Player

Sessions

type conreality.Session
func (*Session)conreality.Logout() → error
func (*Session)conreality.Game() → *Game
func (*Session)conreality.NewAction() → (*Action, error)
var action, err = session.NewAction()
if err != nil {
  panic(err)
}
defer action.Commit()

Theaters

type conreality.Theater

Frequently Asked Questions (FAQ)

How can I help contribute to the development of the Go SDK?

See https://github.com/conreality/conreality.go

Does the Go SDK also support Go releases prior to 1.6?

No, the Conreality SDK for Go targets exclusively Go 1.6+ and newer versions of Go.

In case you cannot migrate to Go 1.6+, we suggest integrating your legacy Go software with Conreality games by issuing SQL commands over the PostgreSQL network protocol (e.g., via the lib/pq or jackc/pgx libraries). Refer to the documentation for the Conreality SDK for SQL.