
idarkstar
This is an Obj-C client for the java MMO engine Project Darkstar. This API is ultimately designed for the iPhone but should work on Mac OSX also without modification. This API is based off of the C api available from Sun which therefore makes it compliant with version 0.9.7 of the SGS protocol. I haven't been able to find any documents specifying the differences with the current version, 0.9.8, of the SGS protocol. If anyone has any documentation on this, I would love to make the appropriate changes to make iDarkstar fully compliant with the current protocol.
This source should be considered an alpha version. Most, but not all, features of the client have been tested.
My currently testing environment consists of a single-node server setup with a basic Darkstar app. The features which have been tested include:
- Client connect/disconnect
- Login/Logout protocol handling
- Channel Join/Leave
- Session Messaging
- Channel Messaging
Features which still need to be tested:
- Client Redirect
- Reconnect
Features still in the works:
- Connection Exception Handling
All packet communications are wrapped in a utility class called SGSMessage. This class provides easy access for reading/creating messages which are compliant with the Project Darkstar protocol.
Licensing
While the current source doesn't have any attached license, it is being released under a modified BSD license. Please feel free to use the API without giving any credit back to the project. All I ask is that you share any code modifications/improvements with the iDarkstar project.
Also, as time moves on, I would like to provide a list of applications which use iDarkstar to people curious about the project. So please share with me if you use the API in your project and I will post it here.
Code Snippets
To initialize a connection and login:
```
import "SGSContext.h"
import "SGSConnection.h"
(void)connect { /* Create the a context which defines who we are connecting
- to and where we want the notifications to go. The delegate
- needs to implement the SGSContextDelegate protocol defined
- in SGSContext.h. */ SGSContext *context = [[SGSContext alloc] initWithHostname:@"localhost" port:1139]; context.delegate = self;
/* Create a connection. The connection will not actually connect to
- the server until a call to loginWithUsername:password: is made.
- All connection messages are sent to the context delegate. */ SGSConnection *connection = [[SGSConnection alloc] initWithContext:context]; [connection loginWithUsername:@"me" password:@"aPassword"]; }
```
To listen to channel messages:
```
import "SGSContext.h"
import "SGSConnection.h"
import "SGSChannel.h"
/** sgsContext:channelJoined:forConnection: is defined in the SGSContextDelegate protocol. */ - (void)sgsContext:(SGSContext *)context channelJoined:(SGSChannel *)channel forConnection:(SGSConnection *)connection {
/* To receive channel messages, we must set the channel delegate upon joining a * channel. The channel delegate must implement the SGSChannelDelegate protocol * defined in SGSChannel.h. */ channel.delegate = self; }
```
Project Information
- License: New BSD License
- 11 stars
- svn-based source control
Labels:
iphone
projectdarkstar
mmo
gameengine