Conreality Software Development Kit (SDK) for Kotlin

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

Note

Pending the release of a Conreality SDK for Kotlin, you can integrate Kotlin software with Conreality games by issuing SQL commands over the PostgreSQL network protocol (e.g., via the PgJDBC library). Refer to the documentation for the Conreality SDK for SQL.

Prerequisites

Examples

Connecting to the Master

#!/usr/bin/env kotlinc -script

import java.sql.DriverManager

Class.forName("org.postgresql.Driver").newInstance()

val dbName = System.getenv("USER") ?: "test"

val connection = DriverManager.getConnection("jdbc:postgresql:" + dbName)

val statement = connection.createStatement()

val resultSet = statement.executeQuery("SELECT 42 AS answer")

while (resultSet.next()) {
  println(resultSet.getInt("answer"))
}

Installation

// TODO

Reference

package org.conreality.sdk
import org.conreality.sdk.*

Actions

class org.conreality.sdk.Action
property org.conreality.sdk.Action.isPending → Boolean
property org.conreality.sdk.Action.isClosed → Boolean
method org.conreality.sdk.Action.abort() → Unit
method org.conreality.sdk.Action.close() → Unit
method org.conreality.sdk.Action.commit() → Unit
method org.conreality.sdk.Action.sendEvent(String, Object, Object) → Event
// TODO
method org.conreality.sdk.Action.sendMessage(String) → Message
// TODO
method org.conreality.sdk.Action.sendAudioMessage(ByteArray) → Message
// TODO
method org.conreality.sdk.Action.sendAudioMessage(InputStream) → Message
// TODO
method org.conreality.sdk.Action.beginAudioMessage() → BinaryOutputStream
// TODO
method org.conreality.sdk.Action.reportLocation(Location) → Unit
// TODO
method org.conreality.sdk.Action.reportMotion() → Unit
// TODO

Assets

Binaries

class org.conreality.sdk.Binary
property org.conreality.sdk.Binary.id → Long
property org.conreality.sdk.Binary.session → Session

Cameras

Clients

class org.conreality.sdk.Client
property org.conreality.sdk.Client.gameURL → String
property org.conreality.sdk.Client.connectionURL → String
method org.conreality.sdk.Client.close() → Unit
method org.conreality.sdk.Client.login() → Session
// TODO
method org.conreality.sdk.Client.login(String, String) → Session
// TODO
method org.conreality.sdk.Client.login(UUID, String) → Session

Events

class org.conreality.sdk.Event
property org.conreality.sdk.Event.id → Long
property org.conreality.sdk.Event.session → Session

Games

class org.conreality.sdk.Game
property org.conreality.sdk.Game.session → Session

Locations

class org.conreality.sdk.Location
// TODO
property org.conreality.sdk.Location.latitude → Double
property org.conreality.sdk.Location.longitude → Double

Messages

class org.conreality.sdk.Message
property org.conreality.sdk.Message.id → Long
property org.conreality.sdk.Message.session → Session

Objects

class org.conreality.sdk.Object
property org.conreality.sdk.Object.location → Location?
property org.conreality.sdk.Object.session → Session
property org.conreality.sdk.Object.uuid → UUID

Players

Sessions

class org.conreality.sdk.Session
property org.conreality.sdk.Session.agent → Object
property org.conreality.sdk.Session.agentUUID → UUID
property org.conreality.sdk.Session.client → Client
property org.conreality.sdk.Session.id → Long
property org.conreality.sdk.Session.isClosed → Boolean
property org.conreality.sdk.Session.game → Game
method org.conreality.sdk.Session.close() → Unit
method org.conreality.sdk.Session.execute(body: Action -> T) → T
// TODO

Theaters

Exceptions

class org.conreality.sdk.ConnectionException: SQLException
class org.conreality.sdk.TransactionException: SQLException

Frequently Asked Questions (FAQ)

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

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

Does the Kotlin SDK also support Kotlin releases prior to 1.1?

No, the Conreality SDK for Kotlin targets exclusively Kotlin 1.1+ and newer versions of Kotlin.

Does the Kotlin SDK also support Java releases prior to Java 8?

No, the Conreality SDK for Kotlin targets exclusively Java SE 8 and newer versions of the Java platform and runtime environment (JRE).