Show Posts
|
|
Pages: [1] 2 3 4
|
|
1
|
Java Game APIs & Engines / Engines, Libraries and Tools / Re: Benchmarks for 3D Scene Graph APIs
|
on: 2012-04-15 21:40:21
|
The reason for the 21 second spike in the DynamicGeometry benchmark is because its hitting GC on the leaked VertexBuffers (which are generated when you do clearBuffer/setBuffer on the Mesh). GC'ing VertexBuffers deletes them from OpenGL, so that spike was probably a million VBs getting deleted from the driver ... In any case, the latest version of jME3 has a limit placed upon number of GL objects deleted per frame at 100, which significantly reduces the spikes. An additional fix can be implemented on the benchmark itself, simply by removing the "clearBuffer" statement from Jme3Sphere, that makes sure the buffer will be updated, rather than deleted and then recreated. The final fix is here, in the Jme3Sphere class, which ensures that no VBs are created at runtime, and reduces the number of FBs created. In addition, it sets the "Stream" flag on the buffers which may help drivers organize memory better. 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
| protected void updateBuffer(Mesh mesh, Type type, float[] newData) { VertexBuffer vb = mesh.getBuffer(type); FloatBuffer vbData; if (vb == null) { vbData = BufferUtils.createFloatBuffer(newData.length); vb = new VertexBuffer(type); vb.setupData(Usage.Stream, 3, Format.Float, vbData); mesh.setBuffer(vb); } else { vbData = (FloatBuffer) vb.getData(); vbData = BufferUtils.ensureLargeEnough(vbData, newData.length); vb.updateData(vbData); } vbData.clear(); vbData.put(newData); vbData.flip(); } protected void setData(float[] vertices, float[] normals, boolean useNormals) { Mesh mesh; if (shape != null) { mesh = shape.getMesh(); } else { mesh = new Mesh(); mesh.setMode(Mesh.Mode.TriangleStrip); shape = new Geometry(); shape.setMesh(mesh); }
updateBuffer(mesh, Type.Position, vertices); if (useNormals) { updateBuffer(mesh, Type.Normal, normals); }
shape.updateModelBound(); }
|
|
|
|
|
|
6
|
Discussions / General Discussions / Re: Hi! Is this real life?
|
on: 2011-02-11 03:04:23
|
I have heard that JME has been a bit of a head ache for some of the people that use it. I have only heard good things about Ardor3D though. But I dont use the scene graphs myself, so hopefully other people will be able to help you more on the topic. When did you hear those rumors? Was it before 2009? Because since that time, jME is under very active development. If any people are having "headaches", they are free to come and complain and it will be fixed 
|
|
|
|
|
8
|
Discussions / General Discussions / Re: Scene Graphs: The good, the bad and the ugly
|
on: 2011-01-08 22:24:35
|
|
As an author of a scene graph based game engine, I think I might have something to say on the subject...
What most people seem to be saying here and everywhere else is that trying to make all your systems fit into the scene graph paradigm is a bad solution. So instead you use several data structures to handle various tasks. If you wish to use a spatial partitioning scheme, for example, the engine shouldn't enforce you to use the scene graph structure to do so.
The way jMonkeyEngine is designed, is somewhat similar to this idea. You have a scene graph, and it is used mostly for just rendering and arranging scene elements into groups by their spatial location. In other words you can create a house node and place props inside the house node by attaching them to it. The transform of the house will be propagated to the underlying nodes and so the props in the house will have their location relative to the house's origin. All the props in the house and the house itself have their own "appearance", this "appearance" is only set on the leaf level, so it doesn't propagate like the transforms do. Any state change optimizations will occur later (explained below).
When the scene graph is rendered, the culling is done by going down the graph, if a branch is deemed not visible, then all its child nodes will not be visible either. The entire tree is then flattened into several buckets. The opaque bucket is the most commonly used one, and is sorted by material ID, to reduce state changes for shaders and textures.
If you wish to add a spatial partitioning scheme on top of this scene graph, you can make an octree work quite easily with it. If you want to add skeletal animation with a bone hierarchy in the scene graph, you can do that as well. Detecting broadphase collisions for physics will also work. The GUI framework can also take advantage of the tree structure with its containers and panels. Yet none of those are done like this in jME. A scene graph node has many properties, but none of the mentioned algorithms really need these properties, so instead we have more efficient trees to work with these features. Physics broadphase collisions are handled with a DBVT structure in JBullet. Skeletal animation uses a bone tree that is better suited for bone-weight animation and generating appropriate matrices for transforms. An octree uses a very lightweight node structure that doesn't even need storing transform or bound information since those can be derived just by going down the tree. And Nifty GUI (the GUI library used by jME) also has its own tree with appropriate properties that are used for GUI like alignment, width and height, and so on that are more efficient for such uses.
Hopefully this will shed some light on how a real scene graph engine functions..
|
|
|
|
|
9
|
Java Game APIs & Engines / OpenGL Development / Re: shader-based engines and transformations
|
on: 2010-12-18 19:34:03
|
A shader-oriented engine, does not use the predefined OpenGL uniforms such as gl_ModelViewProjectionMatrix, or the glPushMatrix/PopMatrix calls. Instead the matrices are composed by the engine before the object is rendered and then those matrices are available through custom-defined uniforms to the shader. E.g, a basic vertex shader: 1 2 3 4 5 6
| uniform mat4 g_WorldViewProjectionMatrix; attribute vec3 inPosition;
void main(){ gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition, 1.0); } |
|
|
|
|
|
10
|
Games Center / Showcase / Re: Phantasy Blade
|
on: 2010-11-15 05:34:20
|
|
Ignoring the current state of graphics and UI (which are bad). The game is so-so, the run-with-sword move is a bit weird since it never ends. It would be more interesting if the AI was smarter and fought back. If this is supposed to be an RPG, there should be things like inventory, items, gold, cities, NPCs, minimap, etc Also I got to the end boss in the level and thats where it ended I guess.
|
|
|
|
|
13
|
Games Center / Showcase / Re: Phantasy Blade
|
on: 2010-11-08 04:35:36
|
Right at the beginning there's an exception thrown: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| java.lang.NullPointerException at java.io.ObjectInputStream$PeekInputStream.read(Unknown Source) at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source) at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source) at java.io.ObjectInputStream.readStreamHeader(Unknown Source) at java.io.ObjectInputStream.<init>(Unknown Source) at Game1.readLevel(Game1.java:466) at Game1.update(Game1.java:435) at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:657) at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:408) at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:318) at Game1.main(Game1.java:924) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.sun.javaws.Launcher.executeApplication(Unknown Source) at com.sun.javaws.Launcher.executeMainClass(Unknown Source) at com.sun.javaws.Launcher.doLaunchApp(Unknown Source) at com.sun.javaws.Launcher.run(Unknown Source) at java.lang.Thread.run(Unknown Source) |
Also the sprites and UI look a bit messy, I am not sure if its because of the exception or not: 
|
|
|
|
|
15
|
Java Game APIs & Engines / Android / Re: 3d (game) engine?
|
on: 2010-10-30 22:43:09
|
|
Problem with Android is that doing skinning for bone animated models is very expensive. This is really an issue with the Delvik VM and since they introduced a JIT in Android 2.2 it might be less of an issue now. Still it stands for all devices with Android versions 2.1 and below. If you really want to have bone animated models, you will have to do it natively (e.g manually in C++), or animate a single model at 10 fps. Really the best solution is to just use vertex/mesh animation instead of bone animation.
|
|
|
|
|
18
|
Games Center / Showcase / Re: rotate breakout
|
on: 2010-10-14 00:43:04
|
I get an error: 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
| Exception in thread "Thread-2" javax.media.opengl.GLException: java.lang.ArrayIndexOutOfBoundsException: 2 at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:271) at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:410) at javax.media.opengl.GLCanvas.display(GLCanvas.java:244) at com.sun.opengl.util.Animator.display(Animator.java:144) at com.sun.opengl.util.Animator$MainLoop.run(Animator.java:181) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.ArrayIndexOutOfBoundsException: 2 at engine.polygonMesh.obj.ObjParser.loadObjFromFile(ObjParser.java:139) at engine.polygonMesh.obj.ObjParser.<init>(ObjParser.java:68) at engine.polygonMesh.obj.ObjFactory.createObjParser(ObjFactory.java:40) at engine.polygonMesh.obj.ObjLoader.loadObjParser(ObjLoader.java:32) at engine.polygonMesh.MeshFactory.createPolygonMeshs(MeshFactory.java:59) at engine.sceneGraph.NodeFactory.createPolygonMeshLeaf(NodeFactory.java:196) at engine.sceneGraph.NodeFactory.createPolygonMeshLeafColred(NodeFactory.java:172) at test.breakout.Breakout.construct(Breakout.java:180) at test.breakout.Breakout.access$100(Breakout.java:21) at test.breakout.Breakout$1.run(Breakout.java:126) at engine.universe.Universe.render(Universe.java:199) at engine.utility.engineusage.EngineForm.display(EngineForm.java:124) at com.sun.opengl.impl.GLDrawableHelper.display(GLDrawableHelper.java:78) at javax.media.opengl.GLCanvas$DisplayAction.run(GLCanvas.java:435) at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:194) at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:452) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) |
And then its just a black screen with title bar saying 1000 fps  Also I had to use the command-line version of java instead of double clicking, cause I got an error message saying "Could not find the main class. Program will now exit".
|
|
|
|
|
20
|
Games Center / Archived Projects / Re: scanline road engine test
|
on: 2010-10-04 02:17:40
|
|
Doesn't work well on my machine! The screen blinks rapidly with white color, I see the road and then I see whitescreen, thats happening like every 30 ms. Windows 7 Home Premium 64 bit. Java 1.6 u21. ATI Radeon HD 5770.
|
|
|
|
|
21
|
Java Game APIs & Engines / OpenGL Development / Re: LWJGL now supports OpenCL
|
on: 2010-09-29 03:18:54
|
|
That's kinda interesting.. I was also prototyping with this sort of thing. But I did it in the bytecode level, which, by virtue of being low-level, doesn't have some of the odd limitations of this API. (e.g the a[i++] = b[i++] thing for example) I guess that in the future there would be workarounds for various Java features to be converted into OpenCL code that had the same effect but used different ways of doing it.
|
|
|
|
|
22
|
Game Development / Performance Tuning / Re: Fastest way to set every pixel?
|
on: 2010-09-29 03:12:43
|
|
Probably just getting the pixels from the BufferedImage, modifying it, then drawing the image should be fastest. Or you can go overboard and write a GPU shader that does this with OpenGL/OpenCL, it would be extremely fast but also hard to write.
|
|
|
|
|
23
|
Java Game APIs & Engines / OpenGL Development / Re: LWJGL now supports OpenCL
|
on: 2010-09-28 01:38:17
|
|
Can't say I agree with you guys. Having OpenCL in LWJGL means one less DLL I have to bundle with my engine. It will also integrate neatly into the already existing OpenGL renderer with buffer sharing and all. Also this having the LWJGL brand I can trust them to have a good and clean API that works.
|
|
|
|
|
27
|
Games Center / Archived Projects / Re: Gunslinger 2 - sci-fi action top down shooter
|
on: 2010-08-25 05:44:24
|
I was clicking around the inventory menu and then exited it, and an exception happened: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at borb.engine.game.Screen.mouseReleasedFinal(Screen.java:296) at borb.engine.game.GameApplication.mouseReleased(GameApplication.java:151) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) |
Also another bug I noticed is when your weapons runs out of ammo it just keeps trying to reload and reload (the red/blue bar keeps filling) but it doesn't stop until you switch the weapon. Other than that, good game  I got to the 3rd level without dying
|
|
|
|
|
29
|
Discussions / General Discussions / Re: Open Pandora
|
on: 2010-08-14 03:56:04
|
Here's a picture from the website:  Btw, since it runs OpenGL2 on Linux, that means LWJGL will work on it too? LWJGL doesn't require AWT, so it should work. It would be very cool if we could make some Java SDK for it that was easy to use. Right now it mostly has just basic 2D games and emulators, it would be great to have some 3D games as well.
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|