Slick Forums

Discuss the Slick 2D Library
It is currently Sun Jul 21, 2019 9:12 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Dec 24, 2013 10:43 pm 
Offline

Joined: Tue Dec 24, 2013 12:04 am
Posts: 3
When an entity with pooled components is deleted, are those pooled components recycled as well? I guess I'm missing how the component manager sees which entities are deleted after a call to world.deleteEntity(...). I'm kind of new to Java so I'm sure I'm missing something important. Kind of a silly question maybe but I really want to know

Thanks!


Top
 Profile  
 
PostPosted: Thu Dec 26, 2013 9:51 am 
Offline

Joined: Sun Jun 03, 2012 9:21 pm
Posts: 49
Yes, pooled components are always reused. Deleting an entity invokes the deleted(Entity) method on all EntitySystems and Managers. The ComponentManager reclaims/removes all affected components during World#process.

More behind the scenes: upon encountering a component type for the first time, a ComponentType for said component is created which - among some other things - checks whether the component extends Component, PooledComponent or PackedComponent.

When a component is removed or an entity deleted, the ComponentType associated with the component is queried about its taxonomy (basic, pooled, packed). Pooled components are returned/obtained from the ComponentPool (or, if the pool hasn't recycled any components, a new instance is returned).

Since you're somewhat new to java:
- I'm assuming you haven't set up your project as a maven project, but if you have: the @PooledComponent annotation can automatically transform components into PooledComponent via the artemis-odb-maven-plugin.
- There's a slight performance hit from using PooledComponents - unless you're creating a ton of components (>1000/s), you're probably better off using normal components. On android/dalvik however, GC pauses can cause a lot of micro stutter - which can be alleviated to some extent by using pooled components.

_________________
agrotera: bytecode-weaving antiboilerplate lib for artemis. | artemis-odb: bugfixing and performance optimized fork.


Top
 Profile  
 
PostPosted: Sat Dec 28, 2013 10:23 pm 
Offline

Joined: Tue Dec 24, 2013 12:04 am
Posts: 3
Upon closer inspection I know see what I was missing... Thanks for answering!


Top
 Profile  
 
PostPosted: Fri Aug 01, 2014 2:07 am 
Offline

Joined: Sat Feb 02, 2013 12:44 am
Posts: 17
Does artemis pool entities? And would it be worth using the libgdx pooling interface for entities?


Top
 Profile  
 
PostPosted: Fri Aug 01, 2014 2:16 am 
Offline

Joined: Sun Jun 03, 2012 9:21 pm
Posts: 49
It already pools all entity instances and any component types that extend com.artemis.PooledComponent or are annotated with @PooledWeaver (@*Weaver annotations require the CLI tool or maven plugin).

_________________
agrotera: bytecode-weaving antiboilerplate lib for artemis. | artemis-odb: bugfixing and performance optimized fork.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group