Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Networking & Multiplayer / Re: Problems running the SGS on: 2007-03-13 16: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.
2  Game Development / Networking & Multiplayer / Re: Java Serialization and sendToServer() on: 2007-03-12 19:58:50
Yeah I was using EA when that problem came up, I'm currently switching over to 0.9 and trying to learn the changes, I'll see if the problem corrects itself when I get the server running agin.
3  Game Development / Networking & Multiplayer / Java Serialization and sendToServer() on: 2007-03-05 18: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 16: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 00: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 18: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 15: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.
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (29 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (40 views)
2014-12-09 22:41:13

BurntPizza (75 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (47 views)
2014-11-29 21:32:03

toopeicgaming1999 (114 views)
2014-11-26 15:22:04

toopeicgaming1999 (102 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!