Show Posts
|
|
Pages: [1]
|
|
1
|
Game Development / Networking & Multiplayer / Re: Problems running the SGS
|
on: 2007-03-13 17:05:38
|
|
I followed the running SGS in Eclipse guide, and I think I've made some progress with it. Right now though I'm stuck because it says it can't find the /dsdb directory. I have an empty dsdb directory directly inside the root of my project directory (where the sgs jar and all other stuff is also) I also included have another one at Data/<Game Name>/dsdb because the demos are set up like that. Neither is working. Is there a location I can specify where this directory should be?
Thanks -Alkix
**EDIT** Scratch that, upon closer examination it's the second entry in the App.properties file that points to the directory that contains the dsdb folder. Mine was wrong.
|
|
|
|
|
3
|
Game Development / Networking & Multiplayer / Java Serialization and sendToServer()
|
on: 2007-03-05 19:41:58
|
|
I'm getting a strange bug while trying to use the Java Object Serialization and moving data back and forth between my client and server, via the sendToServer() method.
The code works when i run a test case in a single class, but then fails when i move the data over through the server. The first thing I noticed is that sgs appends two bytes of data to the array that backs the bytebuffer. I managed to get around that, but now when I try to read an object from the ObjectInputStream i created from a ByteArrayInputStream i created from a byte array i created from the bytebuffer that the UserDataRecieved callback method hands me *breathe now*, it blocks and doesn't finish the method.
Firstly, can anyone explain why this may be happening, and secondly, what all happens to the bytebuffer after I send it to the server?
here's the code for my abstract event class that handles both the serialization and deserialization for the events.
Please excuse the attempted problem solving code in there.
Thanks for your help in advance -Alex
**********
package events;
import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.nio.ByteBuffer;
public abstract class AbstractEvent implements Serializable{
public ByteBuffer dematerialize() {
byte[] bytes = null; ObjectOutputStream oos =null; ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { oos = new ObjectOutputStream(baos); oos.writeObject(this); oos.flush(); baos.flush(); bytes = baos.toByteArray(); for (byte b : bytes){ System.out.print(b+" "); } System.out.println(""); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally{ try { baos.close(); assert oos != null; oos.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } assert bytes != null; ByteBuffer bb= ByteBuffer.allocate(bytes.length); bb.put(bytes); for (byte b : bb.array()){ System.out.print(b+" "); } System.out.println(""); System.out.println(bb.array().length+"long"); return bb; } public static Event rematerialize(ByteBuffer bb){ System.out.println("Byte buffer at pos "+bb.position()); System.out.println(bb.capacity()+" total bytes"); byte[] byteArray = new byte[bb.remaining()]; System.out.println(bb.remaining()+"bytes remaining"); bb.get(byteArray); //System.out.println(bb.arrayOffset()); //bb.get(); //bb.get(); for (byte b : byteArray){ System.out.print(b+" "); } System.out.println(""); ObjectInputStream ois = null; System.out.println(1); ByteArrayInputStream bais = new ByteArrayInputStream(byteArray, 0, byteArray.length); System.out.println(bais.available()+" bytes available in bais"); Event e = null; try { ois = new ObjectInputStream(bais); System.out.println(bais.available()+" bytes available in bais"); } catch (IOException e1) { System.out.println("Couldn't make ois"); // TODO Auto-generated catch block e1.printStackTrace(); return null; } try { System.out.println(2); System.out.println(ois.available() + " bytes can be read"); e = (Event)ois.readObject(); System.out.println(3); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (ClassNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } System.out.println("Recieved "+e.toString()); return e; } }
**********
|
|
|
|
|
4
|
Game Development / Networking & Multiplayer / Re: sendToServer() - help
|
on: 2007-02-22 17:48:59
|
|
Update - Fixed
But I'm not sure exactly why the problem was fixed. Basically, it worked as soon as I deleted the persistent_store folder and rebooted the server. Can anyone help shed some light on this. Could it be because I update the functionality of the Player class so I had to remove all previous versions of them? Could it have something to do with the userID?
-Alkix
|
|
|
|
|
5
|
Game Development / Networking & Multiplayer / sendToServer() - help
|
on: 2007-02-20 01:04:07
|
|
Can someone please layout the steps required to get the ClientConnectionManager.sendToServer() method to activate the SimUserDataListener.userDataReceived(UserID arg0, ByteBuffer arg1) callback function?
You can assume that my client is already connected to the server, and that an instance of the class that implements SimUserDataListener has already been created and registered. It has also joined a channel.
I would really appreciate the help, no matter what I do I can't get the server to respond to messages sent from my client.
|
|
|
|
|
6
|
Game Development / Networking & Multiplayer / Re: "Missing Installation Loader" Error
|
on: 2007-01-26 19:31:11
|
|
Ok I fixed the problem.
Apparently, regardless of the values you enter for the file path to the server deployment XML file and the way your file system is structured, the server won't recognize your boot class unless it is located in an apps folder. I don't know if this is a bug or not, but you would think that you could structure your files however you wanted. Anyone have any insight on this?
|
|
|
|
|
7
|
Game Development / Networking & Multiplayer / "Missing Installation Loader" Error
|
on: 2007-01-23 16:04:39
|
|
I've been trying to start learning SGS. My goal right now is to get the server running and do something as simple as printing out a message to the console in my BootGLO class. The problem is that I run into this error before I get there. I've tried everything I can think of but I keep getting the following error:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1768) at com.sun.gi.framework.install.impl.InstallationURL.<init>(InstallationURL.java:121) at com.sun.gi.framework.install.impl.DeployerImpl.<init>(DeployerImpl.java:123) at com.sun.gi.SGS.<init>(SGS.java:128) at com.sun.gi.SGS.main(SGS.java:197) java.lang.InstantiationException: Missing Installation Loader at com.sun.gi.framework.install.impl.DeployerImpl.<init>(DeployerImpl.java:129) at com.sun.gi.SGS.<init>(SGS.java:128) at com.sun.gi.SGS.main(SGS.java:197)
Here's what my files look like (I think these are the relevant ones)
SGS-apps.conf
#This file describes the games installed into this back end as a list of one line entries #The entries make up a 2 column able as follows #Game ID URL Location of deployment XML
1 file:zombieSurvival_Deployment.xml
zombieSurvival_Deployment.xml
<GAMEAPP gamename="ZombieSurvival"> <GLEAPP bootclass="server.BootGLO" classpathURL="file:."></GLEAPP> <USERMANAGER serverclass="com.sun.gi.comm.users.server.impl.TCPIPUserManager" reconnect_key_ttl="30"> <PARAMETER tag="host" value="127.0.0.1"></PARAMETER> <PARAMETER tag="port" value="1150"></PARAMETER> <VALIDATOR moduleclass="com.sun.gi.comm.users.validation.impl.FlatFileUserValidator"> <PARAMETER tag="password_file_url" value="file:passwd.txt"></PARAMETER></VALIDATOR></USERMANAGER></GAMEAPP>
These two files are in the same directory.
Nothing I did with changing the classpath or bootclass changed the error. Any help would be appreciated, as I am completely stumped.
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|