Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (491)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (556)
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 / Object Stream Question / Problem on: 2006-06-20 22:52:10
I am currently writing some software which uses ObjectInput/ObjectOutputStream to pass messages back and forth.

I have a class called Message, and a class called GameState, both are serializable

Inside Message, there is a GameState object, which holds the state of a current game.

I construct a GameState, then pass it into the constructor of Message, and set my pointer to point to that GameState.

I then try to send Message across an ObjectOutputStream to the client from the server.

Here is where a problem starts... I try to set up the stream in a thread on the client side with the following code:

   
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
   public ClientThread(Socket conn, GameClient gcl) {
     
      connection = conn;
      gc = gcl;
     
      try {
         out = new ObjectOutputStream(connection.getOutputStream());
   (36)      in = new ObjectInputStream(connection.getInputStream());
         
      } catch (Exception e) {
         e.printStackTrace();
      }
   }


Which produces the following error:

1  
2  
3  
4  
java.io.StreamCorruptedException: invalid stream header
   at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
   at java.io.ObjectInputStream.<init>(Unknown Source)
   at Client.ClientThread.<init>(ClientThread.java:36)



My two questions are this:

1) Can you pass an object through an OOS which contains a reference to another object, and retrieve both on the other side, for example:

GameState g = new GameState(args);
Message m = new Message(g);     // this will simply contain a link to g in a private variable

OOS.writeObject(m);


then on the client:

Message m1 = (Message)(OIS.readObject());
GameState g1 = m1.getGameState();

Or does that fail completely somehow?


2) What could be causing that error? I have never encountered it before and dont know where to turn at all...
2  Games Center / Archived Projects / Re: Chromanode - Graph Based Game on: 2006-04-28 19:51:58
Ugh, yes....

There's like a 1/120,000 chance of a stack overflow due to the way I generate the level. I have to fix that, thanks!
3  Java Game APIs & Engines / Java 2D / Re: Fastest way to do 2D line drawing? on: 2006-04-28 17:47:52
 Embarrassed

I start this reply off with this face... because I was able to speed up my performance about a million fold...

... by turning off antialiasing...

I forgot that in my original drawing algorithm I needed to make it pretty for a screenshot we had to do for a paper, and did not turn this off. Now instead of a 7 second refresh, im getting about 10fps.
4  Java Game APIs & Engines / Java 2D / Re: Fastest way to do 2D line drawing? on: 2006-04-28 17:01:15
I didnt say I didnt want to learn OpenGL... I've been using opengl for almost 5 years now (in c)

I was just wondering if there was a way to do it almost as fast with the standard API, so i wouldnt have to install Jogl on any computer I need to demo this on :/
5  Java Game APIs & Engines / Java 2D / Re: Fastest way to do 2D line drawing? on: 2006-04-28 15:13:09
Nope, this isnt my problem. Whenever I resize the window, it still takes 7 seconds to redraw around 2000 lines. Moving the window around however is fine. So the displaying of the lines isnt a problem (NVidia quadro card), its the drawing and redisplaying of the image that is taking all the time.

Any suggestions?
6  Java Game APIs & Engines / Java 2D / Re: Fastest way to do 2D line drawing? on: 2006-04-28 15:03:47
Oh, I thought this would set the flag permanently. My bad!
7  Java Game APIs & Engines / Java 2D / Re: Fastest way to do 2D line drawing? on: 2006-04-28 15:00:26
Oh, I just noticed I didnt have opengl support for 2d rendering turned on. But I cant get the command line syntax to work. Under linux I typed

% java -Dsun.java2d.opengl=true

But this is just giving me the java options splash screen, what am i typing wrong?
8  Java Game APIs & Engines / Java 2D / Fastest way to do 2D line drawing? on: 2006-04-28 14:56:23
Hi, I'm currently writing some geophysical software which takes in a set of data based on seismic layers, and does ray tracing. I have the optimal algorithms for the math involved, but I am being slowed down by my current drawing algorithm in java.

I am currently using a Graphics2D object with .drawLine() to draw my lines on screen. The problem is that there may be up to 4 million lines which need to be drawn to a single image. This is resulting in literally minutes to refresh the screen. With up to 10 seconds just to draw a few thousand lines.

My question is this.. for the problem of drawing a *lot* of lines to the screen, what is the fastest way possible to do this using the standard java api? With no other packages such as jogl, etc?

If you can speed this up somehow i'd be very greatful!
9  Java Game APIs & Engines / JOGL Development / Fastest way to do 2D line drawing? on: 2006-04-28 14:47:50
I am currently working on a project in java which takes a bunch of seismic data, does a bunch of calculations, and ends up drawing (possibly millions) of lines to an image which is then displayed on screen. I originally did this by Paint()ing using a Graphics2D opject, but this is incredibly slow. It takes up to a few seconds to redisplay when just a few thousand lines are being displayed.

I know opengl is much faster, as I have been doing opengl in c for a few years now. My question is, what would the fastest way to do this line drawing? Would it be jogl? If not, which would be the fastest way to implement this within the standard java api?
10  Java Game APIs & Engines / JOGL Development / Re: Creating a standalone application on: 2006-04-28 14:41:52
You are probably going to have to bite the bullet and write it in c.

I did a course in graphics at my university (cs4751), and the first thing I noticed is that everything needs to work. For you, for the marker, and for the prof. Whatever he says is the default for their system is probably going to be what you need to use in order for all 3 parties to function. I would give you 20:1 odds that your department does not have jogl installed, and wont install it if you ask nicely.

As for the standalone thing, it is possible to create a 'standalone' jar executable, or a jnlp web launch thing, but both of these require that you have jogl installed to run them. So I would think that you are stuck with c.

C is where I learned opengl, and let me tell you, if you prof gives you a decent template.... c is actually much easier to code IMO. The c opengl implementation using glut is as simple as you could possibly get in terms of an opengl app. As long as you're given a makefile and the correct libraries you should be alright.
11  Games Center / Archived Projects / Re: Chromanode - Graph Based Game on: 2006-04-26 18:40:32
That is a byproduct of the original way the applet was coded, combined with some laziness of not having updated it in some time. We have plans to finish it this summer once work dies down.
12  Games Center / Archived Projects / Chromanode - Graph Based Game on: 2006-04-25 16:03:50
Try it out, tell me what you think.

The scoring algorithms arent done yet.
High scoring needs to be implemented.
There is a new mode coming soon.

Thats about it! Enjoy


http://www.chromanode.com
13  Java Game APIs & Engines / JOGL Development / Re: Jogl & Eclipse - On amd64 on: 2006-04-25 15:58:35
Thanks Ken

Do you have any insight on why I am getting the drihack.so error, when it is indeed in the folder I am pointing to? I have tried making them executable, but this does nothing to solve the issue. I get this error as mentioned before when using the 32bit natives from i586.jar on the opteron. Does this message occur when the shared object files are incompatible, or is there some other thing I am forgetting to do?  (i am speaking of the No such file or directory error).

It is obviously finding the other libjogl  .so files, but this one isnt working.
14  Java Game APIs & Engines / JOGL Development / New to jogl, quick question on: 2006-04-25 13:00:09
I am confused as to why two different versions of jogl.jar I downloaded from the main jogl project site contained different libraries.

One contained a bunch of com.sun.opengl stuff, whereas the other was java.net.games or something.

Could someone quickly explain to me why these two versions I downloaded were different?
15  Java Game APIs & Engines / JOGL Development / Jogl & Eclipse - On amd64 on: 2006-04-25 12:54:11
I have been trying to get jogl to work on this opteron for almost a week now, and my head is about to explode Sad

I went to https://jogl.dev.java.net/ and downloaded: (from the bottom right nightly builds)

jogl.jar
jogl-natives-linux-i586.jar

To try the 32 bit version first, just to see if it works. I open eclipse, add the jar file to my build path. I then unjar the natives into a directory, which I point to with the clipse 'native directory' option under jogl.jar.

I get the following error when I try and run any example from the  jogl-demos-src.zip file:

libjogl_drihack.so: cannot open shared object file: No such file or directory

The trouble is, the older build of the amd64 natives doesnt even come with a drihack.so file, so I cant even try that. I used the older amd64 build they have under their downloads section and they werent included, so I get no results. This process worked fine on my turion laptop running xp, using the windows dlls, but for some reason I simply cannot get this to work under linux. Am I doing anything wrong? Please... help.
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.

Nickropheliac (15 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (32 views)
2014-08-22 19:31:30

atombrot (41 views)
2014-08-19 09:29:53

Tekkerue (40 views)
2014-08-16 06:45:27

Tekkerue (35 views)
2014-08-16 06:22:17

Tekkerue (25 views)
2014-08-16 06:20:21

Tekkerue (37 views)
2014-08-16 06:12:11

Rayexar (72 views)
2014-08-11 02:49:23

BurntPizza (49 views)
2014-08-09 21:09:32
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

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!