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 (408)
games submitted by our members
Games in WIP (293)
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  Java Game APIs & Engines / Java 2D / Re: Java 7 runs slower ? on: 2013-05-24 19:17:08
What are those trace logs supposed to mean ?
What and how did you measure ?
In any case, no, its not slower.
2  Game Development / Newbie & Debugging Questions / Re: JFrame, JPanel, JLabel issues on: 2013-05-24 07:45:14
Add it to the content pane of the JFrame.
Generally only use static fields for very good reason. Learn to get along without static first.
It is good practice to no inherit from JFrame and but to use one.
3  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Tile-based game: fastest jumpstart for newbie? on: 2013-05-22 14:04:13
Also depends on your background and (game) programming experience.
4  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [LibGDX] Linking a Sprite (Or another image) to a Box2D Body on: 2013-05-22 07:57:01
Looking out for certain collisions and handling them with user data. Pushing user data into type specific working variables.
This approach works for all entities of a certain class.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
// disable droid-bullet collisions if between shooter and own bullet because bullets are fired from the center of the body
world.setContactFilter(new ContactFilter() {

         @Override
         public boolean shouldCollide(Fixture fixtureA, Fixture fixtureB) {
            Object userDataA = fixtureA.getBody().getUserData();
            Object userDataB = fixtureB.getBody().getUserData();

            Droid droid = cast(userDataA, userDataB, Droid.class);
            Bullet bullet = cast(userDataA, userDataB, Bullet.class);
            if (droid != null && bullet != null) {
               if (bullet.getShooter().equals(droid)) {
                  return false;
               }
            }

            return true;
         }
      });


1  
2  
3  
4  
5  
6  
7  
8  
9  
private <O> O cast(Object object1, Object object2, Class<O> expectedClass) {
      if (expectedClass.isAssignableFrom(object1.getClass())) {
         return (O)object1;
      }
      if (expectedClass.isAssignableFrom(object2.getClass())) {
         return (O)object2;
      }
      return null;
   }
5  Game Development / Game Mechanics / Re: Need Help With My 2D Tile Engine on: 2013-05-21 23:29:31
So make a separate class with a method that can check the age and determine what it should be if it returns true make a new block with the type and attributes?
Yes. Changing object behaviour with if-statements is often a sign of missing design to benefit from inheritance, object composition, polymorphism, etc.

And have it in the for block, in the worldmap.render method?
No, do it before. Modifying the game world is game logic. Rendering should, well, render. Clearly assign tasks and do not mix them.
6  Game Development / Game Mechanics / Re: Need Help With My 2D Tile Engine on: 2013-05-21 17:51:45
Drop those if-statements inside the block class. Instead, replace the whole block with a new object when time comes. Create some kind of watcher class which does the job.
Do not inherit from Rectangle but add a property for the rectangle boundary. Probably you will get along with one block class and different color or image attributes.
7  Game Development / Newbie & Debugging Questions / Re: Making a bullet, inventory + weapon system for a top down shooter? on: 2013-05-21 09:04:12
And thanks for the tip, appropriate methods would be using getters and setters, correct?
Yes, but only add those truly required, for instance, if the remaining bullet count of a weapon is set from inside a weapon's fire() method, do not add a public setter for it.
8  Game Development / Newbie & Debugging Questions / Re: Two Questions. One About Collision of Rectangles , Other about libgdx Logic in on: 2013-05-20 23:13:01
Give meaningful names to classes, methods and variables.
MainCollision suggest a class that represents a collision, while it actually detects collision.
A method collision() does not even suggest anything at all.
What does a GameUpdate do ?
Drop that garbage collector call.
No upper case letters for ordinary variables.
Remove unused code like the plane variable.
Abstraction. If you do not need any special feature of ArrayList, use List instead. The same is true for the methods returning lists of receiving lists as parameters.
Limit responsibilities. The job of a collision detector should be detecting collisions, but not taking actions on it. Just notify someone else about it.
9  Game Development / Newbie & Debugging Questions / Re: Making a bullet, inventory + weapon system for a top down shooter? on: 2013-05-20 22:59:38
Why are the weapon attributes static ? Very unlikely that all weapons share the same attribute values.

Instead of using those if-blocks with string comparisons, rather directly call appropriate methods on the current weapon.
10  Games Center / WIP games, tools & toy projects / Re: [WIP] Diabolus Ex Machina on: 2013-05-18 08:31:20
upvoted Wink

I didn't know you were on greenlight, you should have posted a link here when you published, it could have bring some more votes/visibility.
Oh well, Greenlight...
But thanks anyway Smiley
11  Games Center / WIP games, tools & toy projects / Re: [WIP] Diabolus Ex Machina on: 2013-05-17 11:08:00
Update 0.9.0 brings graphic assets in different tile sizes for a better image quality and to support small phone screens.

Diabolus Ex Machina is also at Steam Greenlight
12  Game Development / Newbie & Debugging Questions / Re: Building a better animation infrastructure on: 2013-05-16 19:02:59
Create a dedicated Animation class which holds a bunch of frames, has a current frame, knows it animation speed, gets updated frequently to switch the current frame and is able to draw itself. Just a graphics work horse. No relation to the player whatsoever.

You can develop and test that completely independent of the player and the whole game.

Let the player use that, give it a reference to one current animation object. Exchange the animation object depending on the player's state like left/right moving, attacking, etc.
No images stored inside the player.
When the player needs to be rendered, call the animation object to do the hard work. Use the player to hold its location and movement, hit points, inventory, etc.
13  Game Development / Newbie & Debugging Questions / Re: How to Draw Alpha(transparent) And About [Particle Editor(very noob question)] on: 2013-05-16 18:42:16
Gimp is fine for that. There is a function for converting specified colors into transparency.

I launch the particle editor from a complete libgdx git clone. Then just "run application" on the ParticleEditor class. There used to be a web start launcher available from some likbgdx wiki page.
14  Game Development / Newbie & Debugging Questions / Re: How to Draw Alpha(transparent) And About [Particle Editor(very noob question)] on: 2013-05-16 18:32:11
- JPGs have no transparency, use PNGs
- "still nothing" is no helpful error message
- What are your performance problems ?
15  Game Development / Newbie & Debugging Questions / Re: Text based combat system trial (Java) on: 2013-05-16 10:19:25
Always give variables the narrowest possible scope.
Have a little faith in compiler and JVM optimizations.
Primitive variables != garbage collectable objects.
16  Game Development / Game Mechanics / Re: Libgdx 2D lights on: 2013-05-15 06:55:48
And each flying bullet gets it own moving light as well Smiley
Kudos to Pitbuller for this little library which allows to enlighten your game without having the slightest clue about the low level details inside.

Quote
Well, I guess I'm not so much looking for lighting as I am for creating an alpha mask. That seems like a more reasonable approach to what I'm doing.
I think you need to be more specific about your requirements. You have the alpha channel in color objects for instance.
17  Game Development / Game Mechanics / Re: Libgdx 2D lights on: 2013-05-14 17:27:11
Box2dLights, for instance.
18  Game Development / Newbie & Debugging Questions / Re: Rectangle Intersection - LIBGDX -- Collision on: 2013-05-13 06:38:13
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
public class BadForLoopRemoval {

   public static void main(String[] args) {
      List<String> items = new ArrayList<String>();
      items.add("a");
      items.add("b");
      items.add("c");
      items.add("d");
      items.add("e");

      for (int i = 0; i < items.size(); i++) {
         String item = items.get(i);
         System.out.println(item);
         
         if (item.equals("c")) {
            //            items.remove(item);
           items.remove(i);
         }
      }
   }
}
19  Game Development / Newbie & Debugging Questions / Re: Rectangle Intersection - LIBGDX -- Collision on: 2013-05-12 15:41:45
I thought about that, i think i should remove the item from the list using the "int i" and "int k" instead of using the object as reference.

Thats what you meant Tongue ?

That would not fix the bug...
20  Game Development / Newbie & Debugging Questions / Re: Rectangle Intersection - LIBGDX -- Collision on: 2013-05-12 08:17:00
Think about what happens when you remove list items the way you do while iterating with a for loop.
21  Game Development / Game Mechanics / Re: How would you do player-to-player collision with box2d? on: 2013-05-11 07:32:01
Yes, what's wrong with setting restitution to 0?

You can push your opponent?
If there are no equal but opposite forces, yes.
Otherwise, set up contact listeners/filters and clear steering forces from both players. Setting linear velocity is not recommended and not necessary, afaik.
Box2d example
22  Game Development / Game Mechanics / Re: How would you do player-to-player collision with box2d? on: 2013-05-10 20:04:00
Don't know exactly what behaviour you want. Setting the fixture restitution to zero prevents from bouncing back at collisions.
23  Games Center / WIP games, tools & toy projects / Re: [WIP] Daedalus on: 2013-05-10 18:21:53
A fixed camera, very well.
That needs to be rewarded. Wink
24  Java Game APIs & Engines / OpenGL Development / Re: Am i good student :D ? Hows the code? background drawing on: 2013-05-08 17:59:59
You create a s******d of avoidable object garbage.
Better reuse SpriteBatch and Sprite during each rendering pass.
25  Game Development / Newbie & Debugging Questions / Re: Any idea why my game slows down when I try to record a video of it using Fraps? on: 2013-05-08 08:32:23

I have a hard time believing that my barely 500-line code - even if it is potentially unoptimized - can cause more problems for Fraps than mainstream AAA games on high settings...  Undecided
You can hog cpu time with much less code...
What does the task manager say about that ?
26  Game Development / Newbie & Debugging Questions / Re: Any idea why my game slows down when I try to record a video of it using Fraps? on: 2013-05-08 08:13:01
Thoughts?
Cpu load of the game is too high.
Quality settings of Fraps need to be lowered.
27  Game Development / Newbie & Debugging Questions / Re: Finding nearest objects on: 2013-05-06 09:47:14
It's more for less number of objects.
Take care when doing micro benchmarks.
-> warm-up phase
-> dead code optimizations
-> cache sensitivity
-> timer accuracy
-> etc.
28  Game Development / Newbie & Debugging Questions / Re: Tile Maps : how do they works ? on: 2013-05-04 06:33:41
Hello,
am currently using lwjgl, but i think my question has nothing to do with it so i didn't mention that in the title
anyway...
how tile maps work
SCNR

You recreate the whole world in each rendering pass. Set up the world once and before.
What is block for int class World ?
setWorld should rather be called createWorld and not draw blocks - and there is drawInWorld
What is Block member drawing, why does each Block has one ?
To check wrong click positions, start with the origin at 0,0, verify output, then move on slowly and see how it behaves.
Instead of determining Block colors by type, set the color directly or derive sub classes with different visual appearance. Keeping modes in classes is not good and not OOP.
29  Game Development / Newbie & Debugging Questions / Re: [Final Decision] LWJGL or LIBGDX on: 2013-05-03 06:11:23
@StumpyStrust
do i need more than glbegin/glend to do a 2D game Huh
i mean what else would i need except drawing squares,circles,line,points and loading images
Developing a game is way, way more than "just" fiddling with graphics...
It is about AI, game play, balancing, sound design, fun, input and usability, ui widgets and layout algorithms, network for multiplayer games, entity handling, system architecture and class design, build system, testing, storing highscores, performance optimization, difficulty tweaking, game loops, loading and saving game states, tile maps, game physics, game menus, game options, cross platform concerns, collision detection, path finding, etc. ...
Not to forget polishing, polishing, polishing...
30  Discussions / Miscellaneous Topics / Re: Class size to make the most of OOP on: 2013-05-02 22:07:23
  • do not create God classes
  • methods should be comprehendible at sight
  • but do not split up algorithms for no reason
  • clearly assign tasks and responsibilities to classes and methods, one for each class or method preferably
  • look up separation of concerns
  • as few dependencies as possible
Pages: [1] 2 3 ... 13
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks 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 (114 views)
2013-05-17 21:29:12

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

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

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

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

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

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

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

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

UnluckyDevil (215 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.162 seconds with 20 queries.