Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (105)
games submitted by our members
Games in WIP (524)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Portals and objects  (Read 1403 times)
0 Members and 1 Guest are viewing this topic.
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Posted 2002-11-26 16:57:50 »

I've been thinking about portal based space division and rendering recently (nice collumn over at flipcode.com if anyone is wondering what I mean by portals) but while most of it makes sense and sounds like a good system, I've become stuck on an important point: moving objects.

Static level geometry is ok, lets assume that we've nicely carved up our world into convex sectors and portals storing their connectivity. Portals join two sectors via a plane/portal geometry. Theres nothing to stop T junctions between three sectors though, and these are likely to be pretty common.

So where do we insert our dynamic objects? If its totally within a sector then it'll be stored in an ArrayList or similar expandable data structure, but what to do when it overlaps two sectors? Store in a list in the portal? But then what to do if the object overlaps a T junction of three or more sectors (and therefore more than one sector).

Ideally I'd like to avoid storing multiple references to the same object, since this makes it easier in many areas (mainly for removing/adding when the object moves).

Anyone any ideas?

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline EgonOlsen
« Reply #1 - Posted 2002-11-26 19:12:13 »

In my engine, i'm not storing references to objects in the sector but references (in fact not even that but simple sector-numbers...anyway...) to the sectors an objects covers in the object itself.
I'm using three kinds of objects:

1 - Objects without any sector binding...they will always be rendered/processed. This could be usefull for short-living, simple objects like particles, gunshots etc.

2 - Static objects that belong to a specific sector and that don't move at all...no problem here...

3 - Moving objects with an automated sector-detection. I detect all sectors such an object covers and if it's only one, i simply process them like they were static. If it covers more than one sector, i assume that it is visible if at least one of the sectors it covers is visible.

I'm not doing pixel-perfect clipping on the portals but polygon wise culling in a way that i assume a polygon of a multi-sectored object as being visible if it is visible through at least on portal into a sector it covers.

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #2 - Posted 2002-11-26 21:21:18 »

So how do you get from a Sector object to all of the dynamic objects contained within it? This is pretty important for fast collision detection (amongst other things) so some sort of global search isnt really practical (and would defeat the point somewhat).

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline EgonOlsen
« Reply #3 - Posted 2002-11-27 14:48:16 »

Quote
...so some sort of global search isnt really practical (and would defeat the point somewhat).
In theory: yes, you are right. In practice: It's a very cheap operation. What i'm actually doing is this: I detect which sectors are visible (or covered by an object for collision detection in that case) and store them in a list. Then i'm iterating through the objects that are attached to my world-object (i'm doing this anyway) and simply ask them, if they are in one of the relevant sectors. If they are, they need further processing (rendering, collision detection...). This is really a very cheap operation and nothing compared to the more advanced operations that are happening later in the pipeline (per polygon and even per pixel because it's a software renderer).
What i'm not doing is to collect all objects that belong to a specific sector. I simply don't need this information. My portals are an option, not a must. You can build a level without using a single portal (you don't even have to care about the fact that they are an option...you can just ignore them completely). This will be slower of course, but it's possible.


Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

quew8 (13 views)
2014-07-13 13:57:52

SHC (39 views)
2014-07-12 17:50:04

Riven (34 views)
2014-07-10 20:20:18

CopyableCougar4 (34 views)
2014-07-10 02:26:14

CopyableCougar4 (36 views)
2014-07-09 02:55:38

Code Mage (35 views)
2014-07-08 23:57:00

Code Mage (25 views)
2014-07-08 23:49:08

AppleSauce (29 views)
2014-07-08 19:25:32

CopyableCougar4 (31 views)
2014-07-06 01:51:26

ipe369 (39 views)
2014-07-05 14:18:25
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!