Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (567)
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] 2 3
1  Java Game APIs & Engines / Java 3D / Re: Slow on: 2006-09-26 19:59:07
javagaming is not where the internet ends .... http://forums.java.net/jive/forum.jspa?forumID=70
2  Game Development / Networking & Multiplayer / Re: Yet another NIO networking API on: 2006-07-01 13:05:54
Praised Be The Riven!

seriously, thanks for the swift reply. guess what, you were right! best thing is I found an elegant solution right away. take a look:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
        if (readState == 0)
        {
            if ((bytesLast = this.channel.read(lBuffer)) < 0) throw new IOException("ioe");
            else if ((bytesRead += bytesLast) == 2)
            {
                msgLength = lBuffer.getShort(0);
                lBuffer.clear();
                bBuffer.clear();
                bBuffer.limit(msgLength);
                readState = 1;
                bytesRead = 0;
            }
        }
       
        if (readState == 1)
        {
            if ((bytesLast = this.channel.read(bBuffer)) < 0) throw new IOException("ioe");
            else if ((bytesRead += bytesLast) == msgLength)
            {
                byte[] msgBody = new byte[msgLength];
                bBuffer.flip();
                bBuffer.get(msgBody);               
                readState = 0;
                bytesRead = 0;
                inbox.add(new NIOMessage(msgBody, selKey));
                listener.handleNIOMsg();
            }
        }


I just set the body Buffer's limit on the fly before each read. it might not be too effective performance-wise if the messages come in small chunks, but that's just a design decision which can be taken into consideration when assembling messages.

you are right, the MT-related bug you described shouldn't be a bug really, because only the selector thread removes messages from the outbox. the worst that could happen is that the selector thread deletes the write ops just after another thread inserted a message to the outbox and set the channels key as writable. that's very unlikely to occur and even if, it would get remedied with the next messasge inserted for sending.

I have updated all the links to the now hopefuly working code.  thanks again.
3  Game Development / Networking & Multiplayer / Re: Yet another NIO networking API on: 2006-07-01 06:37:10
Quote from: sunsett
I'm actually about to release version 2.0 which has some significant improvements and quite a bit of help from Riven setting me straight on my mistakes on NIO. :-p

I'll take a look at your API and if something jumps out at me.

yes, I took a look at your code but it's rather an overkill for my needs. simplicity in function and implementation is my personal goal with this one. pure TCP/IP reliable message delivery with a couple of method calls, basically to demonstrate the core functionality of NIO and make it work.

I also remember from another thread how Riven showed up and proclaimed your code to be buggy with some very obvious errors in it. just to mention an example, I'm using unsynchronized LinkedList-s in a very obvious manner for the sole reason that I'd love to be publicly chastised by Riven also. :-)  what could go wrong with an unsynchronized LinkedList other than a poll returning null while another thread is adding an object? my code should be able to handle that but I'll take a look at it today and synchronize them all.

if it's something with the NIO stuff, than I'm kind of lost because it works, it just breaks very unpredictably.

Quote from: sunsett
I haven't looked at your code so this might be obvious to you, but have you made sure you are turning off write ops afer you are done writing (or aren't trying to write data)? There are a few posts in these forums about that particular issue

believe me, I've read all those threads and then some more. you could take a look at the code, it's very short! (and it's Saturday) .

...you bring up a point though, because turning off write ops depends on one of those unsynchronized LinkedList accesse's return value, so I should have considered that a clue earlier.

Update: so I'm using Vector for now.  link
4  Game Development / Networking & Multiplayer / Re: Yet another NIO networking API on: 2006-06-30 19:48:22
best thing is, now I'm getting weird behaviour with the test app on my home computer, which I'm unable to reproduce on my work computer (where I wrote it).

moving the little thingies in a client too fast sends frequent network updates which causes something to break and the server hogs the cpu. how do you guys debug this networking stuff anyhow?
5  Game Development / Networking & Multiplayer / Yet another NIO networking API on: 2006-06-30 11:48:16
well, how to justify this topic, let's see...

there have been many NIO servers written and posted as examples on this board and elsewhere, but since so few of them included a NIO client, I decided to write my own.
I tried to keep the networking part as simple as possible, so what you basically get here is one server class, one client class and a listener interface to handle message arrival and reports. both, server and client have their own inbox, which you poll to retrieve received messages.

I included a simple program, that uses a server to synchronize it's clients. please have a look and share your hate.

link << It actually works since 01 July 2006.
6  Game Development / Game Mechanics / Re: [ODEjava] how to use Ode.dCollide()? on: 2006-06-22 12:34:29
doesn't the GeomCone already exist in ODE? - so only the native binding to it would have to be coded...if it doesn't exist - ok, then I'll take my comment back.

well, there is an odejava class for GeomCone, with a constructor which looks like this:

1  
2  
3  
4  
5  
6  
7  
public GeomCone(String name, float radius, float length) {
        super(name);
        spaceId = Ode.getPARENTSPACEID_ZERO();
    //  geomId = Ode.dCreateCone(spaceId, radius, length);

        updateNativeAddr();
    }


...notice the commented-out call. the function itself is missing in the Ode class, so I guess the native interface for it is not implemented either.

the other thing is, GeomCone is a contributed geometry class for ODE if I'm not mistaken, so I can only guess wheter it is or is not compiled into the Odejava natives dll.
7  Game Development / Game Mechanics / Odejava natives update pending? on: 2006-06-22 10:31:59
Hi, I was browsing the web and noticed that a new version of ode has been released recently. http://sourceforge.net/project/showfiles.php?group_id=24884

Can we expect an update to the odejava natives as well?
8  Game Development / Game Mechanics / Re: [ODEjava] how to use Ode.dCollide()? on: 2006-06-22 06:16:34
it would probably be easier to implement it correctly Wink - The class for that already exists
please elaborate.
9  Game Development / Game Mechanics / Re: [ODEjava] how to use Ode.dCollide()? on: 2006-06-21 16:43:35
I'm currently thinking about implementing the same thing ... a cone shaped collision volume. What would be the best way of doing this since GeomCone is not implemented in Odejava. My last resort would be to fill a cone volume with spheres of appropriate sizes. Any other ideas?
10  Java Game APIs & Engines / Java 3D / Re: Constant frame rate problem on: 2006-06-09 10:39:45
I repeat... do not f*ck around with java3d's threads!

You still don't understand how it works. Java3d won't simply starve other threads, unless you change something in the scenegraph continuously. It simply renders a single frame to the frame buffer and does nothin until a change occurs (a behavior wakes up or you change something in the scene from outside which is you asking for trouble).

any code you place into a behavior is executed while java3d is waiting for it to finish. they don't compete for resources. what ever you do, update your scene using a behavior.
11  Java Game APIs & Engines / Java 3D / Re: Ferrari3D: java3d racing game/simulation/tech demo on: 2006-06-09 08:16:29
Edit: Got it working now, the effect isn't that noticable, but those little graphical touches make a big difference.

I assume you used a TexCoordGeneration object in REFLECTION_MAP mode for the second 'gloss' texture?
12  Java Game APIs & Engines / Java 3D / Re: Constant frame rate problem on: 2006-06-08 17:26:40
> canvas3d.getView().setMinimumFrameCycle(fps);
you are not a friend of reading the docs, are you? you use setMinimumFrameCycle(milliseconds); not to set framerate, but the minimum time the renderer waits before rendering another frame.

> Is there a way to restrict the priority of Java3D thread.
as I already told you, don't f*ck around with java3d's threads, it will cost ya!  all frame-dependent operations should be executed inside of a behaviour, that way you are guaranteed they will finish before another frame is rendered.
13  Java Game APIs & Engines / Java 3D / Re: Constant frame rate problem on: 2006-06-07 17:23:06
> 1)Is this the right way for not allowing Java3d to use all the processing power.

no, not really. you should probably set the minimum time between frames for your view ... canvas3D.getView().setMinimumFrameCycleTime(33);

> 2) When i call Thread.sleep which thread sleeps. Becouse if i increase the sleep time, some operations (which are not related to Java3d) becomes slow, as if their threads are sleeping too.

don't do that.

3) Is there method or way in Java3D , like setFrameRate(30);

> see answer to 1)

4) Is there a mthod or way in Java3D, like renderOnce();

> why would you ask? search the documentation, you'll have to study it anyway because yes, there is such method.


the thing with java3D is that it only renders continuously when there is something changing in the scenegraph. create a simple scene with a ColorCube and you'll see your CPU at 0% load all the time. the problem is the behaviors in java3D like interpolators and view manipulator which are waking up on WakeupOnElapsedFrames(0) ... that is as soon as a frame is rendered .... it's basically an endless loop.

the solution for this is writing your own behaviors that wakeup on time elapsed instead, or constraining the render speed of your views as described in 1).
14  Java Game APIs & Engines / Java 3D / Re: DirectX and OPGL help needed on: 2006-06-04 17:14:53
http://forums.java.net/jive/thread.jspa?threadID=15882&tstart=0
15  Game Development / Game Mechanics / Re: Getting Velocity relative to a Body on: 2006-05-30 16:33:21
How do I get local velocity though thats what I'm after?
I had it wrong ... I was going for all 3 velocity components, but it wasn't right anyway. I made some corrections to the posts above. take a look.
16  Java Game APIs & Engines / Java 3D / Re: Picking not working right in Java3D on: 2006-05-29 21:23:22
OK, that's what I was using.  It starts out as 0,0,4, and then I turn it and get something like .1,.1,3.8333 but it doesn't seem to like either.

what do you mean you turn it? you shouldn't be transforming the eye->target vector anymore, it's only used for the current picking. and btw, the chances you got a straight 0,0,4 ray vector from picking are very slim, are you sure you are doing what I suggested?
17  Java Game APIs & Engines / Java 3D / Re: Picking not working right in Java3D on: 2006-05-29 08:49:59
yes, it's the position vector of your camera / eye.

you can easily find out where your camera is by reading it's transformgroup's transform3D, then doing  transform3D.get( eyeIs );

It seems to work for you up until the point where you do the actual picking, I dont know why it says it encountered a Singular matrix. I can only guess you provided the pickray with a ZERO vector? check the values.
18  Game Development / Game Mechanics / Re: Getting Velocity relative to a Body on: 2006-05-29 08:08:12
Vector3f worldVelocity; //your global velocity vector
Vector3f carForward; // - normalized! your car's local forward vector e.g.  (0,0,1)
Transform3D carTransform; // your car's current world transform
float forwardVelocity; // your relative velocity
19  Game Development / Game Mechanics / Re: I have a game written in java and I need some physics on: 2006-05-28 16:49:15
in Odejava you call step to process the simulation, so you simply can dynamically set the step size.
sure , but steping through the simulation with a different time each iteration should be avoided. the step(float steptime) method can create quite a mess (unpredictable behaviour) if your step times vary too much. Ode supposedly does a lot of predicting in between steps. it's better to step ode with a constant step time and to adjust the sleep time in between steps to compensate.
20  Game Development / Game Mechanics / Re: Getting Velocity relative to a Body on: 2006-05-28 13:36:34
Thanks arne thats exactly what I was looking for Smiley.

The problem I have is I'm not used to the way javax.vecmath does rotation. I'm my program I mainly deal with 4x4 matrix and euler values. I'm sure I get used to it as I use it more.

Quote
Relative speed to itself... are you going all 'theory of relativity' on us?
lol Smiley no I just want to know my speed, I think if the speedo in a car read your speed relative to the origin rather than relative to your car you would have problems.
aaah, I think I get it.

but in a car I would expect the world coordinate speed vektor to be aligned with my car's orientation (momentarily), if not, then I'm sliding a lot and my forward speed would be the least of my worries.

my suggestion would be:

Vector3f worldVelocity;
Vector3f carForward; // - normalized!
Transform3D carTransform;
float forwardVelocity;

carTransform.transform( carForward );
forwardVelocity = worldVelocity.dot( carForward );
21  Game Development / Game Mechanics / Re: Getting Velocity relative to a Body on: 2006-05-28 10:19:20
No thats not reall what I am talking about. I'll explane. My body has a velocity of (x, y ,z) where x, y, z are the change in position relative to the origin(0,0,0), what I want is my body's velocity relative to itself not the origin. So to give you an example say my body is facing down the X axis and is traveling at 1 unit per second my velocity will be (0,0,1) now lets say I turn my ship 180 degress so its going straight down the X axis in the other direction my velocity is now (0,0,-1)  that is relative to the origin. The velocity in both cases relative to my body is (0,0,1) because I am moving forwards in both cases. So does anyone know a calculation that can convert a velocity so its relative to my body no the origin?
You make little sense to me. Just save your ships position from one step back, then compare to its current position, using your time step you can calculate the speed or what ever you want with it. Relative speed to itself... are you going all 'theory of relativity' on us? Smiley
22  Java Game APIs & Engines / Java 3D / Re: Textures on a .obj file? on: 2006-05-28 08:26:28
The way I load OBJ files is from this tutorial:

http://www.vrupl.evl.uic.edu/oldsite/VRLabAcc/about_vrlab/java3d/

Click on Lesson 8a. No matter what I do I can't seem to get anything more than different colors. If I need to do a sign or something I render the text as polygons.

I wrote my custom loader (don't ask fot it, it' very application specific). I recommend you do the same, it's easy and gives you a lot of insight into how things work. you'll find all the specs on .obj tags in the source of the bundled J3D obj loader (as comments). Don't forget that for textures to work, you need to export your model with normals (and then load them). I have no idea whether texture loading works or not with the bundled loader.
23  Java Game APIs & Engines / Java 3D / Re: Picking not working right in Java3D on: 2006-05-28 08:14:43
I wrote my own class for picking to avoid the problems of obscurity you are encountering. I do something like this to adjust for the projection distortion:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
// mouse click to imageplate coordinates
c3D.getPixelLocationInImagePlate(pickXY.x, pickXY.y, p3d);
// imageplate to world transformation
c3D.getImagePlateToVworld(t3D);
t3D.transform(p3d);
// find vector eye -> target
v3d.sub(p3d, eyeIs);
// set the pickRay
pickRay.set(eyeIs, v3d);
// do the picking
PickInfo pi = sceneBranch.pickClosest(PickInfo.PICK_GEOMETRY, PickInfo.NODE, pickRay);


I think this is as safe as it gets.
24  Java Game APIs & Engines / Java 3D / Re: Collision Detector in Billiard on: 2006-05-25 20:19:27
Circle/circle collision physics are quite hard...
Circle - circle collisions are hard? They are almost trivial compared to everything else! Breakfast's idea is very good in that respect,
25  Java Game APIs & Engines / Java 3D / Re: Ferrari3D: java3d racing game/simulation/tech demo on: 2006-05-10 12:09:17
The wheels don't turn Sad

You've put a lot of effort into this though, so ignore the complaining. I wonder what is slowing it down so much on my computer.
26  Java Game APIs & Engines / Java 3D / Re: How to manage Pitch, Roll and Yaw for a "first-person-shooter-view" ? on: 2006-04-27 09:43:29
is exactly the same as:

1  
2  
3  
Transform3D a = new Transform3D();
a.set(...);
a.rotY(...);


I'm not so sure about that... looking into javadocs:
set(V3f) - Sets the translational value of this matrix to the Vector3f parameter values, and sets the other components of the matrix as if this transform were an identity matrix.
rotX/Y/Z(double) - Sets the value of this transform to a counter clockwise rotation about the x/y/z axis. All of the non-rotational components are set as if this were an identity matrix.

...so no, it's not the same.
27  Java Game APIs & Engines / Java 3D / Re: Completed Java3D applet game, opening discussions about how it was made. on: 2006-04-27 08:20:27
If by camera animation, if you mean the spinning at the start of each level, it is basically just manipulation of the camera's matrix and target positions.

Spinning the camera around it's target (only on the XZ plane) whilst lowering the target's Y position achieves the spin, as well as dollying closer to the target (moving the camera position based on the target to camera position vector).

Hope this helps!

Thirg...

thnx, I was thinking more in the direction whether you're using some funky custom interpolator or path following behavior.

I posted a question concerning picking in immediate mode, you might have a suggestion considering you went with immediate mode in your game.
28  Java Game APIs & Engines / Java 3D / Re: How to manage Pitch, Roll and Yaw for a "first-person-shooter-view" ? on: 2006-04-27 08:13:50
I hope you're not creating new objects with each method call as your code would suggest.

There is more then one way to get what you want, but you'll need to understand the concept of transforms. I'd suggest you go through some J3D examples first, then read the javadoc for Transform3D and Vector3f.... useful stuff.
29  Java Game APIs & Engines / Java 3D / Re: Immediate-mode rendering problems. on: 2006-04-27 08:02:55
Is there a good reason fro using immedaite mode?

In general I dont think J3D's immediate mode has been kept up because noone uses it.  If you are going to go immediate, you mihgt as well go straight to JOGL/LWJGL...

Pure immediate in Java3D = Xith3D with full Java3D features  :-)

I went for pure immediate for the full control you get... at least for testing purposes. I know of no other way how to make Java3D run fluently (low frame period variation).
30  Game Development / Shared Code / Re: Updated network API on: 2006-04-20 08:45:31
hi,

I consider myself a newb in the networking department, so please don't feel insulted should I be pointing out problems that are no problems at all. Wink

I was looking at the newdawn code and I have some questions concerning the ByteArrayMessageEncoder's encode method. I'll place my questions directly into the code block if you don't mind:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
 public static byte[] encode(Message message) throws IOException 
  {
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
   
    DataOutputStream out = new DataOutputStream(bout);
    out.writeShort(message.getMessageCode());
    out.writeShort(0); // length
    message.encode(out);
   
    // considering you use a message structure of
    //
    //  CODE[2B] - LENGTH[2B] - BODY[variable_length] ,
    //
    // should the next two lines not be commented out?
   
    out.writeShort(message.getMessageCode());
    out.writeShort(bout.size()-4); // length
   
    // while using the following bitwise manipulations
    // to correct the message's length in your byte[] ,
    // why not use integer for length with the rest of
    // the code untouched? you would achieve the
    // equivalent of using an unsigned short increasing
    // the max length of your message from 32K to 64K,
    // which as Riven pointed out in another thread is
    // considered a drawback. this would also need to be
    // addressed in the Connection's readMessage /
   // writeMessage methods of course but why not?
    // nnot very elegant I guess.
   //
   // also, why not include a
    //
    // public short getMessageLength();
    //
    // in your Message interface and let people handle this
    // themselves?
   
    byte[] data = bout.toByteArray();
    short length = (short) (bout.size()-4);
    data[3] = (byte) (length & 0x00FF);
    data[2] = (byte) ((length & 0xFF00) >> 8);
   
    return data;
  }
Pages: [1] 2 3
 

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

The first screenshot will be displayed as a thumbnail.

Pippogeek (39 views)
2014-09-24 16:13:29

Pippogeek (30 views)
2014-09-24 16:12:22

Pippogeek (19 views)
2014-09-24 16:12:06

Grunnt (45 views)
2014-09-23 14:38:19

radar3301 (27 views)
2014-09-21 23:33:17

BurntPizza (63 views)
2014-09-21 02:42:18

BurntPizza (33 views)
2014-09-21 01:30:30

moogie (41 views)
2014-09-21 00:26:15

UprightPath (50 views)
2014-09-20 20:14:06

BurntPizza (54 views)
2014-09-19 03:14:18
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!