Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (711)
Games in Android Showcase (213)
games submitted by our members
Games in WIP (785)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 ... 5 6 [7] 8 9 10
 61 
 on: 2017-02-22 14:58:02 
Started by cygnus - Last post by SHC
Cell grids are good, I agree, but @Riven, I don't know which type of game the OP is making, so I recommended one that works for all sorts of games. Even with adding a number to make the indices positive, it won't work well when we have open world games. However, AABB trees are easy to understand, and yet the same time, give good performance.

 62 
 on: 2017-02-22 14:12:24 
Started by cygnus - Last post by princec
A good pragmatic solution Smiley

Cell grids are currently perfect for my use case which is thousands of approximately similarly sized entities moving slowish around a grid upon which they can only "just" intersect each other on briefly. That's really the important thing... choosing the right data structure for your specific use case. One-size-fits-all never works best.

Cas Smiley

 63 
 on: 2017-02-22 13:58:38 
Started by cygnus - Last post by Riven
Grids are extremely fast and trivial, but you need to spend some time tweaking them when you have objects with negative positions. Since you'll typically implement them as 2D arrays, negative indices will be a problem.

You just add a value to the coords to ensure they are positive... you'll never need negative cell index logic.

 64 
 on: 2017-02-22 13:19:47 
Started by cygnus - Last post by SHC
Grids are extremely fast and trivial, but you need to spend some time tweaking them when you have objects with negative positions. Since you'll typically implement them as 2D arrays, negative indices will be a problem.

I really really prefer using boundary volume hierarchies, like aabb trees or circle trees. You can read up more here:

https://goharsha.com/blog/aabb-trees-for-collision-detection/

 65 
 on: 2017-02-22 12:35:03 
Started by vfmachado - Last post by vfmachado
Thanks man... this exactly the answer that I'm looking for.

Yesterday I configured my project into a Maven project, makes easy to manage things.

Also I've tested the example linked here (thanks Kaihh).


Spasi, I'm working on these integrations now... hopefully no take so longer to do something useful.. or at least pretty. Smiley
Currently I'm using glfw to manage windows and recently added the stb_image (much easier than codify a lot of image readers).

Thank you all guys.

 66 
 on: 2017-02-22 10:29:59 
Started by cygnus - Last post by kappa
Someone posted this article a while back.

Its a very good read for your problem, especially if you are trying to decide whether to use quad trees for collision detection.

 67 
 on: 2017-02-22 08:49:06 
Started by numerical - Last post by numerical
thanks works now with the toolkit

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  
package DrawImage;   

import java.applet.Applet;
import java.awt.*;

public class Load extends Applet
{
   private Image img;  

   public void init()
   {
      img = null;
     
   }
   public void loadImage()
   {
      try
      {
         img = Toolkit.getDefaultToolkit().getImage("src//DrawImage//java.gif");;
      }
      catch(Exception e) { }
   }
   public void paint(Graphics g)
   {
      if (img == null)
         loadImage();
      g.drawImage(img, 0, 0, this);
   }
}

 68 
 on: 2017-02-22 07:56:30 
Started by vfmachado - Last post by Spasi
LWJGL does not have a complete, integrated solution that you could label a Swing/JavaFX replacement. What it does have is bindings to libraries that solve parts of the equation:

- Windowing system and input: GLFW
- Dialogs: nativefiledialogs (nfd) or tinyfd
- UI components: nuklear
- UI layout: Yoga (in 3.1.2 snapshots)
- Vector graphics (canvas/Java2D-style): NanoVG
- Image IO: stb_image
- Font rendering: stb_truetype

It's obviously quite a bit of work to learn and integrate some or all of the above, but it's entirely possible. They are all lightweight solutions and there are no interop issues with OpenGL.

 69 
 on: 2017-02-22 07:38:06 
Started by numerical - Last post by Riven
Not sure why you think you have to use "//" -- did you see "\\" and attempt to swap the slashes to make it cross-platform? Simply use "/"

That will be the first step to solve your problem. This thread will help you with the next steps:
http://www.java-gaming.org/topics/faq-cannot-find-the-resource-file/33226/view.html

 70 
 on: 2017-02-22 07:20:46 
Started by numerical - Last post by numerical
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  
package DrawImage;

import java.applet.Applet;
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import java.net.URL;
import javax.imageio.*;
 
public class LoadWindows extends Applet {
 
     private BufferedImage img;
 
     public void init() {
         try {
             URL url = new URL(getCodeBase(), "src//DrawImage//java.GIF");
             img = ImageIO.read(url);
         } catch (IOException e) {
             System.out.println(e);
         }
     }
 
     public void paint(Graphics g) {
       g.drawImage(img, 50, 50, null);
     }
}


here is the code with exception and it says:"javax.imageio.IIOException: Can't get input stream from URL!"

Pages: 1 ... 5 6 [7] 8 9 10
 
numerical (256 views)
2017-02-21 07:32:16

numerical (255 views)
2017-02-21 07:31:46

theagentd (367 views)
2017-02-18 13:42:33

theagentd (366 views)
2017-02-18 13:35:16

h.pernpeintner (1533 views)
2017-01-24 22:39:11

h.pernpeintner (1520 views)
2017-01-24 22:38:32

Galdo (2084 views)
2017-01-12 13:44:09

Archive (2093 views)
2017-01-02 05:31:41

0AndrewShepherd0 (2630 views)
2016-12-16 03:58:39

0AndrewShepherd0 (2343 views)
2016-12-15 21:50:57
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21
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!