Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (595)
Games in Android Showcase (168)
games submitted by our members
Games in WIP (647)
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  Game Development / Newbie & Debugging Questions / Re: Tile by tile lighting - Shader/alpha values/lightmap? on: 2015-05-24 03:03:20
Here's (maybe) a good way of thinking about the problem. If you want to figure out how bright to make some part of your image, it depends totally on how far that part is from the light source. So, you're going to be doing a distance calculation like: distance = sqrt(xDistance^2 + yDistance^2) and then you use that distance to figure out how much to darken or lighten things. When you calculate xDistance and yDistance, though you probably have something like: x2 - x1 and y2 - y1, and those x's and y's refer to pixels on your screen, so you would get a smooth gradient in lighting as distance varies. But what you want is for all of the pixels in a given rectangle to always have the same 'distance' value—to be treated kinda of like giant pixels themselves. If you just base your distance calculation on your 'grid coordinates' instead of pixel coordinates, you'll get the desired effect. This means your xDistance and yDistance are calculated with gridX2 - gridX1 and gridY2 - gridY1 instead. You can convert from pixel coordinates to 'grid coordinates' pretty easily — think about using division to do it.

To do it in a shader, you could use standard Phong or Gouraud shading (you can find examples on Google), but you'd have to modify it to base its distance calculation on 'grid coordinates' like above.

Unless you're really wanting to experiment with shader's though, I'd just do it on the CPU. If your game feels slow, then profile it to see what's actually slowing you down (it's easy for our intuition to be off on this stuff); if you find that this algorithm really is slowing you down, you might move it to the GPU at that point.

My guess at what would be slow with the cpu version (where you modify an alpha value and blend with a black background), is in doing the blending calculations for every pixel on the GPU—but that's also probably not really a problem, and again it's best to profile it and find out.
2  Discussions / Miscellaneous Topics / Re: What are your current personal projects? on: 2015-05-23 05:09:41
-More finishing touches on my first Android game
-An 'abstract visual debugger' (
-'structured' code editor (it only looks like there's text there! —it's really a bunch of nested tiles, like app icons on mobile devices), using libgdx (

I like this 7 DAY BUDDY idea matanui159 Smiley

Looks nice NegativeZero!
3  Games Center / Android Showcase / Re: Hopscotch Panic! on: 2015-05-14 21:11:48
 Grin Hey Kev! Long time indeed! Good to hear from ya. It's kinda surreal looking around here again—brings back good memories though.
4  Games Center / Android Showcase / Hopscotch Panic! on: 2015-05-14 03:42:21
Hello JGO. I used to be an active member here a long time ago (~2005 - 2008), but stopped programming (for the most part) for many years. This is the first game I've finished since starting to program again. Hey Kevglass, Princec, Kappa—good to see you guys are still active  Grin

So, the game started as a "I'm gonna do a quick game as a break from this other project...," then I ended up getting pretty into it and spending a lot of time on it—of course. I think it's finished now, but I'm very curious to see how it runs on other people's devices and how the difficulty feels, and if it makes sense how to play, and what ideas people have, etc. If all goes well, it'll be the first thing I put up on Google Play, which I'm pretty excited about. I suspect there are still some performance issues, but I'm gonna not do yet more optimizing unless I really have to...

Instructions: jump on cubes of the same color to go faster. Don't let your soul be eaten by the bad guys.

Game download:

Video: (Unfortunately, no sound on the video—though there is in the game!)
<a href=";hl=en_US&amp;start=" target="_blank">;hl=en_US&amp;start=</a>

5  Game Development / Newbie & Debugging Questions / Re: Looking for a good book/guide to 3D on: 2008-05-10 21:04:42
Check out the table of contents on this one, if you are looking to learn the stuff rather than to just find a solution to that particular problem.
6  Java Game APIs & Engines / Java 2D / Re: Please try the new Direct3D 9 pipeline in 6uN EA on: 2008-05-10 01:13:56
I know this is an old topic, but I just tried 6u10 and am pretty excited about the results Smiley I'd been working on some visualizations for a media player I'm writing for class (I'm doing gui, system architecture, and.. yep, anything visual - others are doing playback and xml library representation). So, the most cpu intensive visualization I was working on used something like 30% cpu before u10 and something like 5% after. I'm drawing lots of translucent BufferedImages to a VolatileImage and then drawing that to the screen. Some screens for fun, 'cause it's kinda perty (the numbers are a countdown btw, not fps - and the crappy image quality is because I only have Paint here Sad ):<br>
7  Game Development / Shared Code / Re: zShapes - Resolution Independent Curve Rendering on: 2006-09-02 16:10:47
That's really cool - works on my java 5.0.
8  Discussions / Miscellaneous Topics / Re: Pictures of Cas! on: 2006-08-30 15:18:36
Everyone think's I'm 26 Smiley There's hope yet!

Cas Smiley

haha.. 26 is the exact age I had guessed based on that picture..
9  Games Center / Showcase / Re: Super Mario Whee on: 2006-08-21 05:33:37
That's an amazing remake... I've played a LOT of Super Mario World and this feels very loyal to the original - I see the dust getting kicked up when Mario makes a quick direction reverse Smiley
10  Java Game APIs & Engines / Java 2D / Re: Images in JInternalFrame on: 2006-05-21 01:35:50
Try creating a class like 'DrawingPanel' or similar that subclasses JPanel. Do your drawing from within this class (in the paintComponent method still) and either set an instance of it as your JInternalFrame's content pane or add it to the content pane. The other thing you may try is adding a println to the paintComponent method where you are drawing now to see if it's even being called so that you can narrow down the origins of the problem a bit. If it's not getting called you could look in the Java api to find out what causes a JInternalFrame's paintComponent method to be called.
11  Discussions / Business and Project Management Discussions / Re: A New 3d Modelling Tool on: 2006-05-20 07:00:48
One other thing you might consider doing, if it's at all an option, is improving the look of the site a bit. No offense, but I can honestly say that I don't think I'd explore the site if I came across it just because it doesn't look professional enough. At a minimum, lose the embedded scroller, fix the 'special offer' graphic (edges are cut off), and maybe do something with your navigation. Check out the website for this free modeling program: - That may be a bit much to strive for, but that's sort of the competition I think.
12  Games Center / Showcase / Re: Growth Spurt on: 2005-12-12 07:45:38
very cool, good job Smiley Its actually a bit much for my geforce2 mx to handle though.
13  Games Center / 4K Game Competition - 2006 / Re: fuzetsu on: 2005-12-08 20:07:25
Cool idea. Its so tempting to get close and watch those tons of bullets fly out, but I know it will kill me! I think lots of good games have that balance though. I remember trying to run through the levels in super mario bros. really fast and dying over and over, but it was cool to go through the levels so fast.
14  Games Center / 4K Game Competition - 2006 / Re: Roll 4k on: 2005-12-01 23:31:33
great stuff kev  Smiley
15  Games Center / Archived Projects / Re: JAVAsteroids on: 2005-11-18 17:07:34
yeah I guess that could be sort of annoying... the game was only made for opengl practice though, my first opengl app Smiley

I know about I even have a game on there, Fatman in Strangeland. I was thinking of fixing up my asteroids and sticking it on there but I'm sort of not coding right now so if I do it will be later.
16  Games Center / Archived Projects / Re: Tempest on: 2005-10-26 05:34:45
I've always been horrible at this game, nothings changed. At least I can go out with style in this version Cheesy
17  Game Development / Newbie & Debugging Questions / Re: Timer or new Thread? on: 2005-10-21 14:15:29
Well there are lots of ways you can do that, a simple scheme would be to measure how much time passed while you were updating/rendering (i.e. during the current frame) and subtract it from your usual pause time. You could probably find something more advanced if you looked around (or came up with your own Smiley).
18  Game Development / Newbie & Debugging Questions / Re: Timer or new Thread? on: 2005-10-21 00:46:47
just stick it in a new Thread this way you can change the way you want to pause the loop or skip frames and that sort of thing since your not reliant on the swing timer.

Thread myThread = new Thread(this);

public void run()
    running = true;

       //handle input
       //update game
       //render game
       //do pause
19  Java Game APIs & Engines / OpenGL Development / Re: Looking for more testers/feedback on: 2005-10-19 00:08:29
I played till game over with shadows off, then went to the menu, turned shadows on and started over. I died a couple times and then (right after dying I think), the game crashed. I was shown a dialog that said: Fatal Exception has occurred.

I get about 60fps without shadows, 20fps with. Geforcefx 5200 and an amd64 2800+ (this was in the version you originally posted).
20  Discussions / Miscellaneous Topics / Re: I've been accused of something horrendous on: 2005-10-17 06:25:32
21  Java Game APIs & Engines / JOGL Development / Re: newb - how to colorize selected vertexes on: 2005-10-17 01:05:44
try the tutorials at nehe: or you can find the 'red book' for free online (from I think, but just search google).

I'm not sure what you mean when you say 'recreate the whole structure', but yes you will have to go through that loop you've shown in psuedocode again if the color changes. If the program is interactive than this should be happening > 20 times per second anyway, or maybe I misunderstand. One other thing, you won't be able to use the return value of a single method call to change the color. Once again I'm not exactly sure what your trying to do, but for example if you want the red component to change depending on the X value and Z maps to blue and maybe Y maps to green or something, then you could change your code to look like this:

 // incomplete pseudocode
for ( x = 0 ... 200 ) {
for (y = 0 .. 175 {
  // one square
  glColor3f(getRedValue(x), getGreenValue(y), getBlueValue(z))
  glVertex3f (x,y,z)
  glVertex3f (x+1,y,z)
  glVertex3f( x+1,y+1,z)
  glVertex3f( x,y+1,z)
22  Games Center / Archived Projects / Re: Feedback request: Pacifica on: 2005-10-17 00:50:38
Fun game and it looks great. Being able to use the arrow keys would be nice, unless the mouse is going to do something else too.. Only other thing is artwork stuff, so no complaints really Smiley  Everything I tried worked as it should.
23  Java Game APIs & Engines / JOGL Development / Re: Culling Scene Geometry for Rendering on: 2005-10-14 03:58:40
SeskaPeel> Maybe you are confusing lines of code and operations.

I think he is basically right... or else you will have to redefine what you mean by operations. As far as the computer is concerned, the dot product itself is hardly a single operation, its 3 multiplications and 2 additions. Also, the if statement is not without cost and should not be ignored. The compare itself is equivalent to a subtraction, but there are reason why just having the if there can slow stuff down (branch penalties). Also, maybe I'm misunderstanding something in the code shown, but it looks like that will only loop through once ever since you are returning in the if and the in the else, so whats the point of the loop?
24  Games Center / Archived Projects / MD3 loader on: 2005-10-11 22:18:38
I've completed (I think) an md3 loader that will be part of a set of loaders, that I may or may not get around to writing Smiley I've written a generic api for dealing with 3d models, with the idea in mind that I could extend the api with a set of classes for each specific loader. The application then just uses generic 3d model objects and has no knowledge of what format the model was originally in. I will make the api open source when it is _complete_, but I was hoping I could get some feedback on the api and make some final changes before releasing it. I'll give an example of how the api is used to load a couple differerent md3 formats. Please let me know if you think it sounds awkward to use or if it wouldn't integrate well with other code for some reason.

On md3 formats: If you look for md3 models on the net, you are likely to come across a few different formats that a loader would need to deal with in different ways. The first format comes from the game Quake III, it consists of .skin files, an animation.cfg file, and three .md3 files making up the legs, head, and torso of the model (titled: upper.md3, lower.md3, and head.md3). Another format could be a mix of these pieces. For example the model parts may not follow the quake naming scheme and an animation.cfg or skin files may or may not be present. Another format could be a single md3 with a single texture that should be used with it, my guess is you'll come across these if the md3 has been converted from another format.

For these different formats I've provided several unique load methods to deal with them, they are as follows:

ModelPattern[] loadSkinnedModel(String modelDirectory, String[] modelPartNames, String[] skinNames, boolean useAnimConfig)
ModelPattern[] loadTexturedModel(String modelDirectory, String[] modelPartNames, String textureDirectory, String[] textureNames, boolean useAnimConfig)
ModelPattern[] loadSkinnedModel(String modelPath, String skinName, boolean useAnimConfig)
ModelPattern[] loadTexturedModel(String modelPath, String texturePath, boolean useAnimConfig)
ModelPattern[] loadQuakeModel(String modelDirectory)

loadSkinnedModel assumes the model uses some .skin files that are in the same directory as the model, it may or may not use an animation config file.
loadTexturedModel specifies the textures directly instead of through a .skin file. When you pass in an array of model parts and an array of texture names, the model piece and texture with the same index will be used together.
loadQuakeModel assumes you are pointing it to a directory that is set up similar fashion to one of the player directories in quake III. The directory should contain an upper.md3, lower.md3, head.md3,,,, and an animation.cfg file.

To construct an MD3Loader object, you need to pass in an object created from a class that implements the TextureLoader interface, which looks like this atm(it could change...):

public int getTexture(String relPath,
                          int filter,
                          int wrapStyle,
                          int destPixelFormat);

here is a simple example of loading a skinned model without animation (its the railgun model from quake III):
        ModelPattern[] weaponModel = modelLoader.loadSkinnedModel("models/weapons/railgun/railgun.md3",       "", false);
        ModelPattern weaponPattern = weaponModel[0];
        ModelInstance weapon = weaponPattern.getModelInstance();

here is a more complex example of loading an md3 that was converted from mdx (warcraft 3 format), it doesn't use skin files or an animation config file:
        ModelPattern[] wcModelParts = modelLoader.loadTexturedModel("models/wc3/orc/orc_stand.md3", "models/wc3/orc/orc.tga", false);
        wcModelPattern = (AnimatedModelPattern)wcModelParts[0];
        wcModel = (AnimatedModelInstance)wcModelPattern.getModelInstance();
        Animation[] wcAnimations = new Animation[]{new Animation(0, wcModelPattern.getNumFrames()-1, 22, wcModelPattern.getNumFrames())};
        String[] wcAnimationNames = new String[]{"WALK"};
        wcController = new AnimationController(wcModel, wcAnimations, wcAnimationNames);
        wcController.playAnimation(wcAnimationNames[0], true);

The last example shows how you would load in a quake III model. In this example I'm going to use some convenience classes from the md3 loader package, so I'm sorta breaking the rule of only using the generic 3d model classes. This isn't necessary and I could just use classes from the generic api (the convenience classes put them together for you), but this makes it so much more convenient if you know that you are using a multi-part md3 with an animation.cfg file.

        ModelPattern[] modelParts = modelLoader.loadQuakeModel("models/players/sarge"); 
        quakeModelPattern = new MD3ModelGroupPattern((MD3Model[])modelParts);
        quakeModel = quakeModelPattern.getModelGroupInstance();

        legsController = quakeModel.getLegsController();
        torsoController = quakeModel.getTorsoController();
        legAnimations = quakeModel.getLegAnimationNames();
        torsoAnimations = quakeModel.getTorsoAnimationNames();

        torsoController.playAnimation(torsoAnimations[0], true);        


This saves you from having to create a ModelGroup and add ModelGroupNodes and simplifies the AnimationController retrieval process, which looks like this (whenever you've used an animation.cfg that is):
AnimationController legsController = legsPattern.createAnimationController(legsInstance);

Ok, one last piece to complete this quasi-tutorial: Once you've created these objects, there are two things you have to do to use them. The first is updating the animation controller (if the model is supposed to be animated). To do this you just need to call update on the controller and pass in the time passed in seconds since the last frame. The second part is rendering the model. If you are using a ModelGroup or just ModelInstances, you have the option of using the render() method which will render the model in immediate mode, or you can get an array of vertices/normals/tex coords from each model piece and do the rendering yourself. If you are using a ModelGroup (MD3ModelGroupInstance is a subclass of this), then you will need to call transformGroup() before rendering and reset() after. Here is the simple example, using the pre-written rendering method (immediate mode == slow):

here is a demo:
Left: play previous leg animation
Right: play next leg animation
Up: replay current leg animation
A: play previous torso animation
D: play next torso animation
O: uses the warcraft model in place of the railgun (quite funny)
T: toggles texturing
W: toggles wireframe
L: toggles lighting
R: toggles rotating

Let me know what you think of the demo/api and hopefully I can make changes and finish it to release the source soon.

25  Java Game APIs & Engines / Java 2D / Re: Best possible FPS achieved? on: 2005-10-11 10:51:59
JayTe, lwjgl works well on the big three: windows, mac, and linux. I personally haven't tested on any other OSs. I developed my current lwjgl app on windows xp and tested on mac, it worked fine without changing a single line of code. Haven't tested that particular app on linux, but you get the point Smiley
26  Java Game APIs & Engines / Java 2D / Re: Best possible FPS achieved? on: 2005-10-11 10:46:51
dunno if its true if the rect is 1x1, maybe someone else can answers that.
27  Java Game APIs & Engines / Java 2D / Re: Best possible FPS achieved? on: 2005-10-11 01:21:12
dunno about performance comparisons, I've never tried a similar benchmark.

For particles you will want to use a small graphics, not colored pixels, drawing lines and filling rectangles is quite a bit slower than drawing an image (how much faster will depend on the type of image you've created). Transparency you can do, bitmask transparency that is (1-bit). If you use 'translucent' images, its going to be damn slow. You won't be able to create effects that are too convincing with only bitmask transparency because a lot of effects rely on the the particles blending together, your best off animating a spritesheet of the effect if you don't have hardware accelerated blending.

Here is a somewhat limited example of what you can do with particle effects in java2d:  It just uses bitmask transparency with the images and you can compare the performance of rendering ovals vs. images (filling rectangles would be nearly as slow I'd guess). Please note that this was written without knowledge of how to achieve good performance in j2d and as such it probably doesn't perform as well as it could/should Tongue
28  Game Development / Shared Code / Re: 2D & 3D Spline (think smooth curve through n points) function on: 2005-09-24 06:58:28
cool, thanks  Grin
29  Game Development / Shared Code / Re: 2D & 3D Spline (think smooth curve through n points) function on: 2005-09-23 22:53:18
sounds good, but your link doesn't work Smiley
30  Discussions / General Discussions / Re: Why makes games in Java ? on: 2005-09-23 15:56:40
err the ps3 is using OpenGL ES? isn't that opengl for mobile devices? Also, even if there was a wrapper for opengl es 2.0, how would that solve the problem of actually getting a jvm on the ps3... seems like it would just solve yet another problem (using the ps3's rendering system) if the ps3 already had a jvm.
Pages: [1] 2 3 ... 13
deepthought (49 views)
2015-06-30 15:39:44

deepthought (56 views)
2015-06-30 15:39:09

deepthought (65 views)
2015-06-30 15:36:52

Za\'Anzabar (43 views)
2015-06-29 05:44:54

TritonDreyja (49 views)
2015-06-24 17:10:40

CopyableCougar4 (52 views)
2015-06-23 00:34:45

BurntPizza (58 views)
2015-06-21 20:36:46

cookiecompiler (98 views)
2015-06-11 15:42:53

cookiecompiler (58 views)
2015-06-11 15:41:14

NegativeZero (82 views)
2015-06-11 09:49:18
How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14 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‑
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!