Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (404)
games submitted by our members
Games in WIP (289)
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 ... 18
1  Game Development / Newbie & Debugging Questions / Re: [Final Decision] LWJGL or LIBGDX on: 2013-05-03 05:21:49
Libgdx also has a bunch of stuff already made for you that is not so trivial. If you need to ask what, then just look at the source and be wowed. The point of I am making is that making a game takes long enough to if you just want to make a game, then don't reinvent everything.

All of the people on here spouting the "I want to understand what is going on" need to understand that you can know what is going on under the hood without creating that which is under the hood. OpenGL is actually I high level API when you look at it from assembly or machine language but we consider it low level. I know what OpenGL is doing when I call glBegin but I am not writing the driver calls from scratch or even the driver itself. If I wrote my own driver for my graphics card does that really give me bragging rights or make me super leet? No, I just like shooting myself in the foot or making a wheel that has only 6 vertices.

@HeroesGrave
Done more is meant as how much you did for game development. You probably would have made many more games if you used libgdx.

Tinkering and GFX programming is an important part of making games.
I personally love tinkering and GFX programming as you can tell from what I post but neither are a game. They are part of a game but not one by themselves.

@alaslipknot
Yes, very much so. Libgdx itself is not hard to use and really streamlines things if you know what it is streamlining. (and set it up properly) In order to know you do not have to code your own version of what libgdx does but read up on what it is doing. I say move on to libgdx now as you can learn opengl while learning libgdx.

Let me change things. Start with LWJGL and goof off for a while. Then when you want to get serious, use libgdx.
2  Game Development / Newbie & Debugging Questions / Re: [Final Decision] LWJGL or LIBGDX on: 2013-05-03 01:06:29
...I have only used LWJGL bindings to opengl so I can only comment on that. It is very easy to setup a display and get a few things to show up. But once you get passed glBegin/glEnd stuff, that is where it becomes very difficult. Opengl is not glbegin/glend. There is much much more. I thought all was good until I ventured into VBO/VAO/shaders which is where ugly things can happen. And I still have not yet tried much more then a cube in 3D. Most people don't do much more then voxel works because it is so damn hard. (not to mention find some form of artist to make stuff for you)

Most nooby programers do not like libgdx because it is a shit storm to get setup. Even with the GUI to do it for you it is still confusing with all the xml/json/file directories you have to manage. I think that this is probably the biggest issue noobs run into when using libgdx. There is cliff in front of them and all the hand holds involve some other coding like language. (scene2D to say the least) There is also very little documentation on how to get more then the bare minimum done.

Even with that, I still think it is better to start with libgdx if you want to make GAMES. If you would like tinker and do some GFX programing then no, not libgdx. HerosGraveDev would have done a whole lot more if he/she (he right?) was using libGDX as he would not have to write say a spritebatcher, or wrapper for shaders, or a texture loader, or etc etc etc.

TL:DR : go libGDX for making games and OpenGL bindings to make cool effects.
3  Game Development / Newbie & Debugging Questions / Re: Mixing light-weight (Swing) and heavy-weight (AWT) components? on: 2013-05-01 08:29:59
Learning stuff in java2d is a useless tool. Sure maybe you get better at coding but that comes with any form of coding.

And thanks for the correction but I think I got the point across.  Wink
4  Game Development / Newbie & Debugging Questions / Re: Mixing light-weight (Swing) and heavy-weight (AWT) components? on: 2013-04-30 15:38:11
Does it work? What works is what is right.

Like I always say with optimizations and designing the "perfect" system. All you are doing is getting nowhere faster and more elegantly. Get something that works and then if it is slow or too hard to use just then, you should consider a better more efficient design. As you code and recode you will get better and better. The over all design and structure of the stuff you write will naturally improve. Get something that does something first.

You don't really need to extend canvas. All a canvas is, is what its name implies. Just need to grab the graphics object in the render loop from it.
5  Discussions / General Discussions / Re: AWESOME particle system on: 2013-04-29 08:34:09
Very limited though. Nice to see someone mange to crank so many particles in just java2d but if you look at the source he does not do very many g.draw calls. (if any) most is directly manipulating pixels which is not very nice when you want to do more then program pixels.

I would love to know what his computer specs are because I simply can't see most peoples computers doing 1 mil particles. I also tried the code and although it compiled it just didn't do anything. Another reason why you should stay the hell away from java2D. It is not at all consistent on computers.
6  Game Development / Newbie & Debugging Questions / Re: Mixing light-weight (Swing) and heavy-weight (AWT) components? on: 2013-04-28 04:54:56
The only reason to do java2d for games these days it's fun learning it(at least for me).

By fun you mean like taking nutcrackers to ones testies. *whisper* Masochist *whisper*
7  Java Game APIs & Engines / OpenGL Development / Re: glReadPixels Issue on: 2013-04-27 01:22:52
UI is done in swing so that is not what I mean by UI issues. I mean that if I wanted to revamp the particle system then I would have to change UI elements.

I am using swing/awt and lwjgl so I am currently not actually using my own FBO. I render the previews with java2d and other such things as making changes to the animations (making them seamless) is much easier in java2d or at least I know how to do it in java2d.

Thank you for the code. I will change things to use an FBO and see if that will work.

You can layer the particles which means that you could have additive atop non atop add atop non etc. It is not just one time rendering all particles with additive or non.

Again thanks for the help. 
8  Java Game APIs & Engines / OpenGL Development / Re: glReadPixels Issue on: 2013-04-26 08:08:09
*sigh*

So I would have to change my whole particle system in order to use premultiplied alpha blending which I am ok with but that would also mean the UI would have to change which I am not ok with...for now. When I rewrite my system it will be not as special and more like libgdx but with more features.

Unfortunately, the issue I have now is when using davedes blending mode I get correct information except that nothing is additively blended.

The 3 step, which I should have read better, I do not do. That is to say, info is wrong coming from the frame buffer and does not get messed up after.
9  Java Game APIs & Engines / OpenGL Development / Re: glReadPixels Issue on: 2013-04-25 02:24:22
I made the system before I knew how much better pre-multiplied alpha is which is why I am not using it right now.

I am using the default frame buffer right now. I will be honest and say that I am not very well versed in opengl so I blame my lack of experience and not the bindings them selves.

I will just change everything to pre-multiplied alpha and have an option for the user to say whether the image is pre-multiplied or not and if it is not I will load the file accordingly. I really hope this will fix it. I will post again if this solves it and maybe the LWJGL wiki needs and update.
10  Java Game APIs & Engines / OpenGL Development / Re: glReadPixels Issue on: 2013-04-24 23:35:21
What would you like me to post? Name the things you think might be issues and I will post the relevant parts. If you really want I can post the whole damn thing but there are many things not necessary.

Thing is with just passing 0xff as alpha (no alpha) I get the right image. What is on the screen during testing is correct.  Opengl is rendering properly. I can post how I setup opengl, render stuff, etc if that will help.

11  Java Game APIs & Engines / OpenGL Development / Re: glReadPixels Issue on: 2013-04-24 23:01:29
So I am back at it trying to figure this shit out.

Looking at a single white block that fades out 8x8 pixels to keep the printouts readable. The color and alpha do not start at 255 but 250 or so but that should not make a huge difference. The alpha drops properly but so do the colors. Is opengl premultiplying everything when before I grab the pixels? When not using an image everything seems to look fine but when I load up an image that is not completely opaque, I start getting issues.

I know what pre-multiplied alpha is and it seems like the pixels returned are pre-multiplied. When I use the BufferedImage TYPE_ARGB_PRE I get the same results.

How would you reverse pre-multiplied alpha? I think I did it right but it did not help. Would rendering everything to an FBO work? I wouldn't think so but it is worth a shot.

I normally do not get pissed easily but this one really pisses me off because I can do almost the exact same thing in Java2D much much easier and it works. Hell I don't mind extra difficulty if the damn thing works.
12  Game Development / Newbie & Debugging Questions / Re: rotating a single object without rotating the entire screen with Graphics2D on: 2013-04-24 03:21:08
....for j2d I use this for its simplicity.

1  
2  
3  
4  
5  
6  
public void render(Graphics g)
{
    Graphics2D g2d = g.create(); //cast this to a g2d object
   //do all normal rotation/blending/drawing stuff here
   g2d.dispose();
}

May not be super fast but then neither is j2d.
13  Discussions / Miscellaneous Topics / Re: How to make a name for your RPG on: 2013-04-23 03:11:15
Finding names for my games is super easy. I really have no idea why people have issues with things like essay titles, paper titles, game names, character names, etc.

Key thing is to build your world in your head a bunch. Think up all sorts of lore. Gods, cultures, peoples, everything. Once you have some foundation the name is trivial.
Right now I am working on an RPG form of game which is named Haven. If you would like some help for some interesting names, post some details about your game and I could throw out some names. Heck, you will probably find your name while posting.

Here is one game idea/name that I have been wanting to produce but well...you know.

Game name is "You Will Die"
Base defense game setup in the same formula as the Learn to Fly and Shopping Cart Hero games. You defend as long as you can and inevitably die. Then you go to a shop, buy some upgrades, and defend again. Throw in some Box2D physics to make it look like the "hero" is getting crazy swarmed and add some mega blood and BAM!!! Never ending fun. Well...at least I think it would be crazy fun. Game could work easily on android/iOS/desktop.
14  Java Game APIs & Engines / OpenGL Development / Re: LWJGL 2.9.0 on: 2013-04-22 17:58:30
Do the menus still appear under the lwjgl canvas?

I wanted everything to work with jre7 so I was using the nightly builds but they broke a whole lot of other things. Fixed focus issues with java 7 but got the menu item issues back.
15  Java Game APIs & Engines / OpenGL Development / Re: LWJGL 2.9.0 on: 2013-04-22 06:15:12
Windows:
  • Fix: focus problems with Display.setParent
  • Fix: setIcon will now block until the taskbar icon has updated
  • Fix: async state query for missed key events


Oh sweet baby Jesus yes.
Does it still have the drawing issues with menus that drop down? Right now I had to throw in some hacky crap to make it clear the spot where the menu was.
16  Games Center / WIP games, tools & toy projects / Re: Preview of TT - Tile Tools on: 2013-04-18 21:37:28
Malban, in English it is Graphic not Grafic. Although the seem to sound the same, they are not. I know, I hate English too.
17  Game Development / Newbie & Debugging Questions / Re: Typecasting in render method? on: 2013-04-18 09:43:01
No you cannot render sub pixels as there are none.

Thing is, java2D looks like pooder at low movement speeds where opengl does not. I think this as to do with the way in which opengl renders.
18  Game Development / Newbie & Debugging Questions / Re: Typecasting in render method? on: 2013-04-18 03:50:23
Keep in mind though that java2D can only render ints which means that a slow movement stutters due to the loss of precision. You can easily get away with a game update rate of 30 and render rate capped at 30 and keep things smooth with only integer movement rates. Another reason why java2D sucks for rendering.
19  Game Development / Game Mechanics / Re: First Post - Bufferstrategy, jpane and canvas? on: 2013-04-15 14:34:41
I will let someone else get to the gameloop but I can help with the BS (no pun intended)

JPanel and most Swing components are double buffered automatically and I do not think canvas is. They also use passive rendering which is not what we want. Normally, you use a canvas because it is meant to be used to draw stuff with where a JPanel is not. I have used both and with a few extra settings in JPanel, they both work fine. They whole thing is like you said, don't mux up AWT and Swing. The reason why we use BS is to keep things actively rendering and not passive which is what java2D wants to do. You also need to double buffer when you want animations to be smooth. pack() will automatically shrink all components into the smallest size in a JFrame. So if your frame is 1600x900 and your canvas is 800x600 it will make the JFrame 800x600. I may be wrong on this one.

Now comes what you probably don't want to hear. Drop learning any rendering in Java2D. It is crap. Use libgdx or slick2D. No need to wonder about all the black magic java2D is doing and the reasons why.

If you insist on java2D then before you wonder all the magical ways of getting java2D to perform right, here is this.

http://www.java-gaming.org/topics/java2d-clearing-up-the-air/27506/msg/246444/view.html

If you would like, I can post my old classes that I used to get java2D to perform well but really you should just drop java2d.
20  Discussions / General Discussions / Re: why are people trying to use Java2D to make games? on: 2013-04-12 00:56:56
Java2D is so very very very limited. I can do image processing...slowly.

One of the big issues is not that it is super slow (which it is) but that the performance is inconsistent across systems. That is to say, on my desktop I easily get 5k sprites (64x64) but on my laptop due to crapy DX drivers, get fill rate limited after about 200 sprites at the same size. I could switch to the opengl pipeline which will fix the fill rate limit but gives all sorts of other issues. It is not consistent.

Using opengl, my laptop gets fillrate limited again but easily hits 10-20k sprites using glBegin glEnd. Adding basic sprite batching and bam! 50k. You also cannot do any cool effects such as lighting, additive blending, or the all powerful shaders without bashing your skull into the ground and sacrificing valuable processing time to try and hack java2d to get it to do what you want. Java2D was NEVER meant for games. It is not as simply as just rendering. Rendering eats into frame rate which logic needs.

If you want to make a game, then use a library/rendering method for games. *whisper* libgdx
If you insist on writing your own engine/lib/everything then break out some assembly or use opengl bindings.
If you STILL like java2d well then before you start asking all sorts of questions on performance and best method for rendering images, please read this.

http://www.java-gaming.org/topics/java2d-clearing-up-the-air/27506/msg/246444/view.html

Once you are done reading that, shoot yourself in the foot because that is what you are doing by using java2d for rendering
21  Game Development / Game Mechanics / Re: Rotating Particle (Flamethrower) Tower Spawn Acceleration on: 2013-04-11 04:02:18
If you get a box it is because you are using different speeds for x and y.

If you want it so it looks like someone with a water hose spinning in a circle with flames instead of water, then what relminator said is right. You might be doing something different in your particle system.

Here is how my emitters do this

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
float temp = angle2 - angle1; 
         
         float newAngle = (float) (((Rnd.randomPlus(temp))+angle1) * Math.PI/180);
         newAngle *= -1;
         if(randomV)
         {
            float v = Rnd.randomPlus(vel);
            x.setVel((float)(v*FastMath.cos(newAngle)),(float) (v*FastMath.sin(newAngle)));
         }
         else
         {
            x.setVel((float)(vel*FastMath.cos(newAngle)),(float) (vel*FastMath.sin(newAngle)));
         }

Note in this I have extra options like random vel and emitting particles between 2 angles but the key is the x.setVel
22  Game Development / Newbie & Debugging Questions / Re: Measuring time inside render loop. on: 2013-04-11 02:12:21
Cool then. If it works then don't do anything. If it is slow, ask yourself "is it REALLY slow?"

Keep up the work.
23  Game Development / Newbie & Debugging Questions / Re: Measuring time inside render loop. on: 2013-04-10 20:33:34
I told myself I would stop trolling here so much but I give in.

Normally, you do not do any sort of logic in the rendering thread. That is to say, you do not care about delta or anything like that. For animation rendering, you would set which frame is to be render in your logic (update). Then when rendering comes, you render is. If this code is working fine for you, use it but do not try measuring delta time stuff in renderloop.

Here is how I do animations or any form of timing. (no interpolation)

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
int currentUpdate = 0;
int frameRate = 60; //(1 frame every second)

updateMethod(delta)
{
    currentUpdate++;
    currentUpdate *= delta; //
   if(currentUpdate >= frameRate)
    {
         currentUpdate = 0;
         nextFrame();
         //check to see if you need to loop back to start when updating frame
   }
}


This is just some psudo code. It will not take into account huge deltas but the key is to keep logic away from rendering.
24  Java Game APIs & Engines / Engines, Libraries and Tools / Re: LibGDX BufferedImage to Texture on: 2013-04-10 08:38:18
If you are using libgdx, you should NEVER EVER touch anything from java2d.

Have fun.  Cheesy


PS:

You should be able to get a pixel array from the bufferedimage and create a libgdx texture from that. Look at how to take a bufferedimage and make it into a opengl texture. Hell, you could just use that search box with the cob webs on it.

http://www.java-gaming.org/index.php?topic=25516.0
25  Game Development / Newbie & Debugging Questions / Re: Collision Detection on: 2013-04-09 08:08:43
hmmm after you use the intersects method find which side should be trivial.

In order for a object to move there must be a velocity right? Or some value you are incrementing by. Check to see if that value is positive or negative. Do this for both X and Y. Not to correct the collision you would need to find how much these objects intersect and subtract or add to the X and Y. Well look around at some Rectangle2D stuff in java and you will find what you are looking for.
26  Game Development / Newbie & Debugging Questions / Re: Simple Math Problem on: 2013-04-09 05:25:55

Note that, that all can be done in one line but I use many for the sake of clarity. There is also an optimization that is not all necessary but might be something to look into. You will probably figure it out. Basically, stay away from anything that is not addition, subtraction, or multiplication.

@Stumpy: don't use sqrt. Squaring maxdistance is faster since we don't care what the actual distance is, just if it's lower than 400 units

I used it for the sake of clarity and left that part out as something he could figure out on his own. Please try and read everything someone says as the lack of communication can cause errors. I know that sometimes I type too fast.  Cheesy
27  Game Development / Newbie & Debugging Questions / Re: Simple Math Problem on: 2013-04-09 02:52:25
Don't do any of that. I will help with how the distance formula works.

The idea is to create a triangle and then find the hypotenuse.

So some psudo code.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
public boolean distanceCheck( loc1x, loc1y, loc2x, loc2y, maxDistance)
{
      int xDiff = (loc1x-loc2x);
      xDiff *= xDiff //square it.
     int yDiff = (loc1y-loc2y);
      yDiff *= yDiff;//square it
     int distance = Math.sqrt(xDiff+yDiff);
      if(distance > maxDistance)
          return false; //not in the circle.
     else
          return true;
}


Note that, that all can be done in one line but I use many for the sake of clarity. There is also an optimization that is not all necessary but might be something to look into. You will probably figure it out. Basically, stay away from anything that is not addition, subtraction, or multiplication.
28  Game Development / Newbie & Debugging Questions / Re: Simple Math Problem on: 2013-04-09 02:35:55
...this is 2d so we are basically going to be doing culling or w/e it is called in 3d but in 2d.

Since you are using java2d which has some great utilities you should use.

If you want a circle around your player of visible enemies that is very easy.

http://www.purplemath.com/modules/distform.htm

If you want a square then for Gods sake use shapes/squares/rectangles that java2d gives you. They have a nice intersects method. I could post the code for both but that would not really help you learn so take this and have at it.
29  Java Game APIs & Engines / OpenGL Development / Re: glReadPixels Issue on: 2013-04-08 23:58:04
I give up.

I have tried the nightlies of lwjgl and they only broke the gui. I have tried using the images graphics object and g2d.fillrect with the color set and that gave same results. I think java2d could be screwing with some shit... Could someone else try it and see if they get the same results as me? If it works fine for you then I MUST be doing something wrong.
30  Games Center / Featured Games / Re: Heroes of Loot on: 2013-04-08 22:27:05
Go for matheus' He has taken the best of the 2 I made and some how through unknown black magic combined them into one. Bravo old boy!
Pages: [1] 2 3 ... 18
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (31 views)
2013-05-17 21:29:12

alaslipknot (40 views)
2013-05-16 21:24:48

gouessej (70 views)
2013-05-16 00:53:38

gouessej (69 views)
2013-05-16 00:17:58

theagentd (78 views)
2013-05-15 15:01:13

theagentd (73 views)
2013-05-15 15:00:54

StreetDoggy (113 views)
2013-05-14 15:56:26

kutucuk (137 views)
2013-05-12 17:10:36

kutucuk (136 views)
2013-05-12 15:36:09

UnluckyDevil (145 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.196 seconds with 20 queries.