Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (582)
Games in Android Showcase (163)
games submitted by our members
Games in WIP (633)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2] 3 4 ... 10
 11 
 on: 2015-05-29 23:28:54 
Started by tdegroot96 - Last post by SwordsMiner
Ah sorry, I misread the question. But yes, I usually use a Bin/Cell structure or something sort of like it. That sounds like something you should look into.

 12 
 on: 2015-05-29 23:26:22 
Started by tdegroot96 - Last post by BurntPizza
Use AABB, it is super simple and there are plenty of things on here for that.

This only solves the e.collidesWith, and is probably what tdegroot is already doing.


the amount of loops will explode exponentially

Technically it's only quadratic, but yes.

A BSP tree/kdtree/quadtree etc. can work, although a simple Bin/Cell structure is much simpler and usually plenty effective.
It's also more performant than many trees when entities are often moving.
Note: The wiki page says each bin has a linked list, but just use an array list.

 13 
 on: 2015-05-29 23:22:49 
Started by tdegroot96 - Last post by SwordsMiner
Use AABB, it is super simple and there are plenty of things on here for that.

I recommend digging for HeroesGrave's AABB class and taking what you can from there.

(hint: use the search function)

EDIT: http://www.java-gaming.org/index.php?topic=28059.0

 14 
 on: 2015-05-29 23:21:29 
Started by tdegroot96 - Last post by tdegroot96
For about 2 years, I have been making small stupid games. Each game taught me a lot and I'm really enjoying the fact that I can make games. However, I'm bumping a lot of times into the best way to check collision with in game entities. The most simplistic approach would be:
1  
2  
3  
4  
5  
for (Entity e: level.getEntities()) {
    if (e.collidesWith(this)) {
        // Do stuff
    }
}


Now, if we would have a system where every entity is checking collision with other entities, the amount of loops will explode exponentially and performance would crash. Someone told me the best solution to this is by having a binary search tree to only list entities that CAN collide with the current entity. I've been studying this thing, but can't really get the hang of it.

- What's the best way to take care of this?
- Could a binary search tree fix this?

 15 
 on: 2015-05-29 23:10:51 
Started by SauronWatchesYou - Last post by opiop65
Learn design patterns, study syntax

And then learn to not care about either. Tongue

But really, learn to solve problems, not memorize specific tools, similar to what Kevin said.
Eh you're right, that's what I meant. I worded that wrong!

 16 
 on: 2015-05-29 22:37:44 
Started by philfrei - Last post by BurntPizza
Please ignore: Some words to satisfy the 90% non-quote rule. Blah blah.

Tip for posterity: whitespace counts as non-quote.

 17 
 on: 2015-05-29 22:35:22 
Started by philfrei - Last post by ags1
Debugging tools are a godsend sometimes, and I pray to whatever man created them.

Her name is Grace Hopper.

                                                                                                                   

 18 
 on: 2015-05-29 22:33:43 
Started by Riven - Last post by theagentd
Jesus christ, one round of applause for Riven.

Everyone: "EVERYTHING'S BROKEN"
*5 min later*
Riven: "Okay, migrated server, patched the broken SMF code, added some new features, repelled spam bots and hacking attempts, etc etc etc"
Everyone: "=O"

 19 
 on: 2015-05-29 22:04:47 
Started by Riven - Last post by Riven
There. 13min later we're running on a brand new VM Smiley

Old trusty VM was hovering around 20MB free RAM just after launching MySQL. Now we have ~1GB headspace. Gotta get some sleep now!

 20 
 on: 2015-05-29 21:52:55 
Started by chrislo27 - Last post by chrislo27
I put together my own quadtree implementation that I mostly didn't write but I made it easy for you to put into your own projects.

Classes here

Example:
In order for your entities to be compatible with the QuadTree implementation, you must implement the interface Sizeable which returns X, Y, and width and height.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
QuadTree quadtree = new QuadTree(<your width>, <your height>);

// every game update (preferably not every frame)
quadtree.clear();
for (int i = 0; i < entities.size; i++) {
   quadtree.insert(<your entity that implements Sizeable here>);
}

// to return a list of entities near a given entity
ArrayList<Sizeable> array = new ArrayList<>();

array.clear();
// fills the arraylist with entities near a given entity
quadtree.retrieve(array, <your entity>);


I didn't make most of this, I just wanted to share (and have a little bit of competition from the other one submitted here  Grin). Supports floats.

Pages: 1 [2] 3 4 ... 10
 
Ralphanese (20 views)
2015-05-29 13:07:55

Gibbo3771 (17 views)
2015-05-29 06:54:17

Ralphanese (23 views)
2015-05-28 16:52:52

theagentd (31 views)
2015-05-27 22:21:17

theagentd (37 views)
2015-05-27 22:21:08

CopyableCougar4 (27 views)
2015-05-27 19:24:50

MrMapcom (24 views)
2015-05-23 20:26:16

MrMapcom (33 views)
2015-05-23 20:23:34

Waterwolf (38 views)
2015-05-20 15:01:45

chrislo27 (46 views)
2015-05-20 03:42:21
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

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
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!