Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (517)
Games in Android Showcase (123)
games submitted by our members
Games in WIP (577)
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 ... 13
1  Games Center / WIP games, tools & toy projects / Re: TWL TextArea Demo on: 2010-06-17 21:52:28
Great work !!  Cool
2  Discussions / General Discussions / Re: annoying gaps playing Java2D games on: 2010-04-22 20:19:38
maybe to much Threads created, someone could log concurrent threads with jconsole 32 bits (im running jdk 64bits)?
3  Game Development / Shared Code / Re: 3DzzD - Applet Boot V2 on: 2010-04-12 21:45:43
WOW ! nice loader ! Smiley Is there any way to load native libraries ?

I mean, the goal of a good applet loader is to make native stuff like a openGL context available... otherwise a loader deserves no real price to the usual applet. Wink Wink
4  Game Development / Newbie & Debugging Questions / Re: Problem with Graphics/Graphics2D on: 2010-03-27 22:10:30
for example if a window of antoher software go over your frame than a repaint will be launch by the "system" (AWT/Swing) and the frame paint method like paint(Graphics g) (or anyother system called paint method) may be called with a clipped graphics because not the whole graphics have been occluded(in this case the clip area will be a rectangle where the window is over you frame ).

such clipping area is returned by the getVisibleRect() of JComponent. However, it won't be usable in an active rendering mode.  the clipping area will be useful when using the component in a Swing managed context, e.g. you paint a custom an animated component on a dektop panel.
In that particular case, update(getGrahics()) may be replaced by a call to paintImmediately(getVisiblerect) which will repaint on the visible graphics clipped area. This can save memory when you are displaying several panels.
5  Game Development / Newbie & Debugging Questions / Re: Problem with Graphics/Graphics2D on: 2010-03-24 12:12:17
1. Graphics2D g2 = (Graphics2D)g; is sufficient, a graphic2d context has not to be instanciated everytime in that way, java will decide.
2. JPanel are JComponent, and therefore will require to be painted alike. draw() must be implemented in the protected void paintComponent(Graphics) function while the LogicLayer will call either repaint() (for passive rendering) or Jpanel.update(Jpanel.getGraphics()) for active rendering.
This is because Swing is required to be involved for repainting for the Java2D overlay gets lost with peer sync and edthread.
6  Game Development / Newbie & Debugging Questions / Re: Moving Player on: 2010-02-06 22:08:55
Using Graphics2D direct transforms have issues that it can seriously damage the whole screen graphics if transforms are misused or in failure because it shares the peer-transform.
As in fact I don't have much to conceal between both methods, either choose Graphisc2D or AffineTransform to your fit. I DO prefer making AffineTransform on singular drawImage() callbacks.

What must be clear is the context of the matricial transform, that is if running from the peer graphics, (i.e. g.translate() , g.rot..) ensure to store the original context and translate correctly, because you have to restore the original state after making your painting as follows to getTransform() <-> setTransform(). Whenever an exception occurs between getTransform() <-> setTransform() you have to catch it and restore back with setTransform(toTheoriginalContextMatrixTransform). ... persecutioncomplex
7  Game Development / Newbie & Debugging Questions / Re: Java Games on Facebook? on: 2010-01-31 11:02:17
But you're supposed to have a Facebook-enabled webserver, to use facebook-php-api
Quote
Note: From this point on, I am already assuming you downloaded the Facebook API PHP files and have them all in a folder. The scripts we are about to work on must be in the same folder.

//Read more: http://bncapps.com/java-applet-as-a-facebook-app/#ixzz0eBct2TDr


Best way to relay on the java facebook api. In either case, the fb app must be registered  as a Web Application NOT Desktop (be careful with that because it cannot be changed after your app is registered, then you can lose secret keys etc.).
8  Java Game APIs & Engines / JOGL Development / Re: using GLJPanel on JOGL 2.0 on: 2010-01-22 23:41:14
implement reshape with the correct viewport and projection
1  
2  
3  
4  
5  
6  
7  
8  
/**
    * {@inheritDoc}
    */

   public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {
 gl.glViewport(x,width, y, height) ...
gl.gl...
}
}
9  Game Development / Newbie & Debugging Questions / Re: Moving Player on: 2010-01-22 23:38:14
Quote
translate to the center of your sprite, call rotate by the rotation amount, then translate back to the origin and finally draw the image.
this is trans = (Graphics2D).getTransform() ; ....do g.translate g.rotate.... (Graphics2D).setTransform(trans)
 Smiley
10  Game Development / Newbie & Debugging Questions / Re: Making the character attack ONCE on: 2010-01-08 14:00:55
Marvelous game demo Demonpants ! Cheesy Is it running on LWJGL, JOGL ?
1  
        //PLAY_AND_CLAMP plays the animation once, then clamps on the final frame. Can only be interrupted as normal (used for death animations, etc.).

this Animation.state is what I'm missing in my code. But it can be handled if Animation is stopped or paused at last.
11  Game Development / Newbie & Debugging Questions / Re: Making the character attack ONCE on: 2010-01-05 10:01:10
This ain't easy stuff. But I'm just on the go to release a beta of THE GAME (M.U.G.E.N-like) for the sf3jswing project.
I 've achieved about 90% of this game, now I'm right dealing with this exact same issue.
What would be my advice, is focusing on Animation timing and KeyStroke's stacks. I done something like this :
Animation is XX frames length and should play until the time length is gone, or the program calls stop(). Anyway it should stop whenever it is required. A Fighter is a collections of Animation so that it's not possible to have full control over the Animation's. That is, only a KeyStroke or a AI method such as doDefend() - doAttack() can change the state of that Fighter. Hence, writing the perfect loop is the goal. It should scan for remaining KeyStroke over time and state of each individual keystroke AND check for the Animation.STATE (PLAYING|STOPPED|LOOP).
Subsequently, Fighter is needed to have a Stack of KeyStroke events, ordered ascendingly to time and the current Animation. Plus, the Animation that is linked to the IDLE state.

Here it is : Fighter reads one sequence of, say, 3 Keystrokes (that be Punch-key pressed repeatly) and the IDLE Animation (call it "stance") LOOPING. read 3 KeyStrokes, the first is checked for CONSUMED and left off the stack because it's not needed anymore, then you can call doAttack(PUNCH) for that read keyStoke. It will then immediately check for the play time of that animation, whether it should return to the IDLE Animation or continue with Punch Animation.

Resulting in 2 classes : Fighter{int currentAnimationHash, Stack<KeyStroke{int state=CONSUMED|FREE}>, int state=IDLE|ATTACK|DEFEND|MOVE} and Animation{int state = PLAYING,STOPPED,LOOPING}.
 Cool enjoy!
12  Java Game APIs & Engines / JOGL Development / Re: JOGL on ARM + OpenGL ES 2.0 on: 2009-12-30 19:25:43
this is cross-compile. Maybe get JOGL native source code and use gcc to cross-compile.
13  Java Game APIs & Engines / Java 2D / Re: Active rendering: configure TopLevel or all components? on: 2009-12-21 23:47:45
1  
createBufferStrategy(2);

notice that this may only work in a full-screen exclusive mode. otherwise createBufferStrategy(1); is needed (which disables double buffer).
14  Game Development / Newbie & Debugging Questions / Re: Few questions to organize my game(How to create RTS?) on: 2009-12-10 22:34:36
1  
contenu2.add(DoodeVert);

most mistakes in your samples are layout settings.
1. Adding a component when using other layouts than FlowLayout is done with a constraint : BorderLayout -> South, north... ; GridBagLayout * -> gridbagconstraints instance; etc.
2. And at least one of the component must set a preferredSize if no "fixed" component like JLabel or JprogressBar are present.
3. each modification sequence after setVisible(true) must be explicitely validated
4. when handling multiple threads, ensure you're in the EventDispatcherThread to make such layout modifications : SwingUtilities are therefore recommended tools.
Wink

* : GridBagLayout may generally render a better look and feel, but is tricky.
15  Game Development / Performance Tuning / Re: Sprite Atlas vs. Sprite cache on: 2009-12-09 22:34:22
(...)
The real advantage of a sprite atlas is that, if you're smart in implementing them, you can end up with 3 or 4 texture binds per draw step instead of 50 or 100 or more. Texture binds have a high overhead, so keeping everything in as few textures as possible is a large advantage.
That's what I thought about atlas mode. Indeed, it'll end up in one big texture for a animation set... But that means the bigger the single sprite frame is, the biggest will be an atlas texture.
I mean I have 200 sprites I'd store in one big atlas file. The texture will be 100x256 squared, which leads to a 25k texture, hence impossible to fit in the gl standard cache (limit is 4096 squared texture size on  a geforce 6200).  lol ! An animation of 1 sec long, at 24 fps would be 12x256 squared ≃ 2400 px large... that may be thinkable.. but 2400 is a 2Mpx texture, which should be raw-tiled in say 128px² tiles and behave like decoding 24 small png to textures.
 
I'm currently using a so-called Sprite cache to store the data from one run to the other, not actually to use it in a real-time render. yet I cannot use the atlas mode for it .. .(


maybe I should use the atlas for small sprite stores, like menu icons or small background patterns. As you said, a mix of both worlds would be fine..

thank you demonpants !
16  Game Development / Performance Tuning / Sprite Atlas vs. Sprite cache on: 2009-12-09 14:12:06
Hi !
I'm wondering  which one would a game developer choose between an Sprite Atlas (described  http://www.java-gaming.org/topics/cramming-the-most-into-a-sprite-atlas-bin-packing-problem/21680/view/topicseen.html) and a Sprite Cache.

Having 200 Sprites of 256x256 RGBA for one character in my game, I meant a Sprite Cache that loads up in ~40 seconds from the cache to openGL cache.
Do you think a Sprite Atlas would break down the load time ?

One constraint is that the java heap should not be increased more than one or two RGBA sprites (that's 2⁸⁺⁸⁺² = 2¹⁸ bytes / sprite ≃ 256kb / sprite) at a time. Then the cache is max 50 MB uncompressed per character.

17  Game Development / Newbie & Debugging Questions / Re: Few questions to organize my game( JScroll bar with backgound) on: 2009-12-09 13:45:00
I made it with Netbeans, look at the map.Main source code it works for a map5.jpg located in the current working folder (see properties of project in NB).
You can run the code with the provided executables.
18  Game Development / Newbie & Debugging Questions / Re: Few questions to organize my game( JScroll bar with backgound) on: 2009-12-07 22:26:52
assuming your container is a contentpane from applet or frame, you load an image map5.jpg and want to scroll over it. This is quite simple :
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  
Container contenu = getContentPane();
contenu.setLayout(new BorderLayout());
final Image map = ImageIO.read(new File("map5.jpg"));
final  MediaTracker myTracker = new MediaTracker(this);
myTracker.addImage(map, 1);
JPanel myPanelMap = new JPanel(true) {   
   protected void paintComponent(Graphics g) {           
           try{myTracker.waitForId(1);} catch(InterruptedException e) {}             
           Graphics2D g2 = (Graphics2D)g;
             // clear the background if your image has transparency
           Color c = g2.getColor();
           g2.setColor(getBackground());
            g2.fillRect(0,0,getWidth(), getHeight());
            AffineTransform tx = new AffineTransform();
           // tx may be modified with custom transform such as scaling
           // or rotating matrixes, that the image will be applied on rendering
           g2.drawImage(map, tx, this); 
           g2.setColor(c);         
    }
};
/* this line is needed*/
myPanelMap.setPreferredSize(new  Dimension(map.getWidth(), map.getHeight()));
JScrollPane sp = new JScrollPane(myPanelMap);
// this makes the panel more reactive
sp.getHorizontalScrollBar().setBlockIncrement(30);
sp.getVerticalScrollBar().setBlockIncrement(30);
contenu.add(sp, BorderLayout.CENTER);
contenu.validate();
contenu.repaint();

 Cool
19  Games Center / 4K Game Competition - 2011 / Re: Applet templates on: 2009-12-04 23:28:23
Quote
It has an isActive() check.
Sorry, but I've never seen this elsewhere and I really find this code unefficient... And writing a book over such mind-less lines, is more boring than ever. Sad
20  Game Development / Game Play & Game Design / Re: American football simulation on: 2009-12-04 23:21:19
My next big hurdle is figuring out how to simulate playing a game. 
You should read some about AI design... in a few words, you need to firmly define what are the individual actions--namely "states"--a player would do, the less actions the more reactive would the AI look like at a first glance. Actions are localized through some UID (unique identifier). A second important bunch of definitions is the so-called "inputs" each individual player would receive--actually in a FIFO order--those are e.g. other team is holding the ball, an opponent is very close to the player, etc. but in a really "live" fashion so that you think it is in the real game.   Those "inputs" also have their UID.

With those 2 sets of UID, try to find out a game strategy/tactic. THE BEST WAY IS TO OUTPUT A LOGICAL SCHEME that tells when the player changes from state A to state B and how it goes from B to A back, thus depending on inputs (notice that the fewer inputs, the lesser smart the player can react).
 Cool
From such a scheme, there are various wayd of implementing it... I do prefer a sequential digital design which offers best performance result over complexity of the schemes (like robots would be designed).
 Cheesy
21  Games Center / 4K Game Competition - 2011 / Re: Applet templates on: 2009-12-04 22:14:45

1  
2  
3  
4  
   public void start() {
      new Thread(this).start();
   }
(...)


this is a true mess,  it runs an anonymous Thread  "open in the sky" where it couldn't be checked for a termination, an aborting, ... in shorter words with no control over it.
A correct impl. would handle native lnstallation and loading, with control over start-stop behaviours, window focus and a caching system.
 Cool
an applet is implemented through init-destroy and start-stop methods. So this template should define ignition AND shutdown otherwise anyone terminating the applet into a middle-aged browser would see its system crushing down out of memory and busy...
Smiley
I like the one from LWJGL or appletLoader from JOGL which truely provide a powerful interface to such complex applet management with high-valueable capabilities.
22  Game Development / Performance Tuning / Re: Speed with Java2D and full viewport Applet. on: 2009-11-27 22:39:39
Quote
I have the OpenGL enabled option on, on my .PHP file.
Why with OPERA or KONQUEROR the Applet wont get accelerated. ( only 2fps )
I have a full succes on all WinXP browsers ( 53fps ) and on Linux Firefox browser ( 52 fps ).
Opera and konqueror may not be using the java plugin 2, which means no args can be given  to the JVM.
e.g. <param name="separate_jvm" value="true"/> is not recognized. This is also an issue on non-plugin2 browsers as Safari. Then opengl pipeline or memory heap may not be modified from an applet.
23  Game Development / Newbie & Debugging Questions / Re: Jar Indexing progress bar on: 2009-11-26 19:50:50
I'm not sure if this is what you're seeking for, you're supposed to put the whole input stream in a BufferedInputStream.
I used to dowload .jar in this way :
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
        final URLConnection connection = src instanceof URL ? ((URL) src).openConnection() : null;
        final BufferedInputStream JXAextensionStream = connection instanceof URLConnection ? new BufferedInputStream(connection.getInputStream()) : src instanceof BufferedInputStream ? (BufferedInputStream) src : src instanceof InputStream ? new BufferedInputStream((InputStream) src) : null;
(...)
while ((r = inputStream.read(b)) != -1) {
                        JXAtmpPath.write(b, 0, r);
                        rBytes += r;
                        if (progressBar) {
                            if (!(src instanceof File)) {
                                UIMessage.getProgressBar(id).setString("downloaded " + Math.rint(rBytes * 10 / 1024) / 10.0 + " Kbytes");
                            }
                            UIMessage.updateProgress(id, rBytes, (int) connection.getContentLength();
                        }
                        /*** ERASED, hangs the SYSTEM.OUT if (_debug) {
                        System.out.print(".");
                        }*/

                    }        


you can find this in JXAenvUtils._fileCopy() of sf3jswing-jxakernel below at sf.net. Cheesy
24  Java Game APIs & Engines / JOGL Development / Re: Load Textures in Background while Rendering on: 2009-11-21 21:28:21
Of course I can suggest you my own API http://sourceforge.net/projects/sf3jswing/files/ .
Download sf3jswing-jigaxtended and sf3jswing-jxakernel.

1. compile jxakernel for your arch. (ant jar)
2. copy the dist/yourOS/unsigned/sf3jswing-jxakernel.jar to sf3jswing-jigaxtended/lib/yourOS/yourarch/.
3. compile jigaxtended. (ant jar), you should get dist/yourOS/unsigned/...jars which include the full API.

Then Tile Caching is implemented into the net.sf.jiga.xtended.impl.Sprite . You make it happen by loading a texture tiles cache with setTilemodeEnabled(true) setTextureModeEnabled(true) , loadResource() and retrieve the Sf3Texture cache with getTexData()

For the Sprite to load fine, it must be loaded all LWJGL natives libraries at once.
You can do it instantly by running JXAenvUtils.loadEnvironment() at startup.

PLZ tell me what you think ! you may directly post into the forum below.
 Roll Eyes
25  Java Game APIs & Engines / JOGL Development / Re: Load Textures in Background while Rendering on: 2009-11-20 22:49:02
Hey guys,

(...)
Currently when I load textures, I load them from TextureData (which I pre-create in another thread) inside the loop (which pauses the rendering, since the loop is on a single thread). 

Do you load it into GL directly ?
Quote
I would like to export the texture generation to another thread and continue rendering, updating the render once the texture becomes available (probably using a volatile boolean to switch on while waiting for the texture to generate).  Is this possible?
Actually, YES and NO. if you were not loading directly to GL, then you meant loading data from reading the data file and yes you be able to send a new Thread for this loading process.
If you were loading into GL, then you meant using 2 Thread sharing the same GL context, which is afaik NOT possible.

A good way to reduce the time your rendering loop is stalled, is to split the Image in Tiles and/or using GL subtextures functions to upload the data to GL, one sample at a time. This means that you either read the source file partially, or hardly split the file into parts that will be read one each other. What shouldn't be done is to open the source file and read the whole data at once before to upload it.

I use for myself a Tile cache to load big textures.

26  Discussions / General Discussions / what os do you run ? on: 2009-11-16 00:24:19
I'm interested in how many people would choose an opensource platform to develop game softwares. Huh
27  Game Development / Newbie & Debugging Questions / Re: Few questions to organize my game. on: 2009-11-13 22:25:38
A few advices :
 1. You are targeting to a RTS (is that real time shooter ?), Swing is rather passive (indirect) rendering wised, so it be more understandable to use an accelerated rendering strategy like opengl.
 2. A game should be as compact as possible in terms of objects concurrently loaded, as you said a game needs to react pretty fast. Then I'd use one JFrame and several JPanel's for menu, options and maybe a canvas to make real-time rendering.
 3. following those advices makes you plently open to further implementations of third party libraries like LWJGL, JOGL, etc. As of 2. you will have your object amount increased by 10 in a later time and your code will stay "open" to high-end API's.

Game design is not a fair work, you may spend more time on coding basic rendering aspects, where you may not have enough time to define a robust Threading concept, multi-player interface or AI simulation...
Last but not least, books are not the best tutorials, but school curses (yes, school is teaching game design) or using a library designed for games (google it, but I know about Slick, JME, or even mine JIGAXtended API) make the approach easier to begginners.
 Cool
28  Java Game APIs & Engines / JOGL Development / Re: Drawing 2d shape in 3d scene? on: 2009-11-13 22:01:56
There's no real need of an overlay, as you want a single  rectangular shape to draw. OpenGL can render a quad (a GL_polygon) with no texture, you choose to fill it or the outline you want. GL_fill or GL_line
There's no particular difficulty to doing this...
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
protected static void _GLdoPolygon(AWTGLCanvas gld, boolean fill, float lineWidth, Point.Float[] vertexes, float[][] vertexesColors, double z) {
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        if (fill) {
            GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
        } else {
            GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
        }
        GL11.glPushAttrib(GL11.GL_LINE_BIT);
        GL11.glLineWidth(lineWidth);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        float[] color = GLHandler._GLgetCurrentColor(gld);
        GL11.glBegin(GL11.GL_POLYGON);
        int i = 0;
        for (Point.Float pf : vertexes) {
            float[] c = vertexesColors[i++];
            GL11.glColor4f(c[0], c[1], c[2], c[3]);
            GL11.glVertex3f(pf.x, pf.y, (float) z);
        }
        GL11.glEnd();
        GL11.glColor3f(color[0], color[1], color[2]);
        GL11.glPopAttrib();
        GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
    }

This sample is part of the GLGeom class of JigaXtended API. I'm running LWJGL 2.1 but this could be easily ported to JOGL. Cheesy
29  Game Development / Newbie & Debugging Questions / Re: Cannont find main class... Problems with making executble Jars on: 2009-11-09 18:33:33
(...)
so I tried to add to classPath both lwjgl natives and slick/lib, but no help so far.
(...)
Check this : Native must be on java.library.path not classpath. then slick might not load lib correctly and a "noclassdeffounderror" will occur.
Anyway why do you choose Slick ? LWJGL isn't sufficient after all ?
30  Java Game APIs & Engines / Tools Discussion / Re: webstart with nativelibs on: 2009-11-08 20:46:38
of course, native .jar are are common packages that may be built using jar command or ant <jar> tasks.
Those jar have to be signed with the same certificate (same person) as the main .jar that holds your jnlp app.
One single rule is necessary : all native libs must be found on the / root path of the .jar.
e.g.
1  
2  
3  
4  
5  
6  
7  
8  
 - myNative.jar
     - META-INF/
         + Manifest
     - myJNINativeLib.dll|jnilib|dylib|so
     - anotherJNINativeLib.dll|jnilib|dylib|so
     - myPackage/
       + myClass.class
     -...

Pages: [1] 2 3 ... 13
 

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

The first screenshot will be displayed as a thumbnail.

TehJavaDev (33 views)
2014-10-27 03:28:38

TehJavaDev (27 views)
2014-10-27 03:27:51

DarkCart (41 views)
2014-10-26 19:37:11

Luminem (22 views)
2014-10-26 10:17:50

Luminem (27 views)
2014-10-26 10:14:04

theagentd (33 views)
2014-10-25 15:46:29

Longarmx (61 views)
2014-10-17 03:59:02

Norakomi (59 views)
2014-10-16 15:22:06

Norakomi (48 views)
2014-10-16 15:20:20

lcass (43 views)
2014-10-15 16:18:58
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

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!