#game engine perfomance

45 messages · Page 1 of 1 (latest)

onyx quail
ionic pikeBOT
#

This post has been reserved for your question.

Hey @onyx quail! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

crude bloom
#

Is there a specific performance issue?

onyx quail
crude bloom
#

use a profiler for finding which pass is causing the issue

onyx quail
#

i looked it, a for condition for check all list of entities colliding

crude bloom
#

then you need to improve yourcollision logic

onyx quail
#

how i can?, there are others methods?

crude bloom
#

I don't know how you are doing it

onyx quail
#

"for (Entity entity : engine.entity_list)" this checks all entities rectangles, 30 are faster 500 or more cause lags

crude bloom
#

yeah that's the issue

#

if you check each entity with each entity, it will be slow

onyx quail
#

there are other method?

crude bloom
#

you could try to dplit your world in multiple parts

#

e.g. with a grid

onyx quail
#

a grid?

crude bloom
#

so your game has a 2D "world", right?

onyx quail
#

yes, but is not implemented

#

only with entities

crude bloom
#

so each entity has a position on the map, right?

onyx quail
#

yes

#

you can look the entire code in that link of the post

crude bloom
#

so you could split your map in let's say 16x16 parts of equal sizes

onyx quail
#

in the "entity.java"

onyx quail
crude bloom
#

then you can have a list of entities in each of these parts

onyx quail
#

yes, is stored in the engine.java

crude bloom
#

note that if an entity moves from one part to another, you need to remove it from the list of the left part and add it to the list of the entered part

#

if you check collisions, don't check every entity

#

only check entities in neighbouring parts

onyx quail
#

with 5 entities:

engine update time: 10300
input update time: 1000
paint update time: 8100

with 60:

engine update time: 27100
input update time: 1000
paint update time: 13600

onyx quail
crude bloom
onyx quail
#

an abstract class, interface or some?

#

using threads on each entities blow up my computer

crude bloom
#

I told you - split up the world in parts and have one list containing each entity for each part of the world

onyx quail
#

ok

#

max each world can up to 10 entities for 60 fps

crude bloom
#

currently

crude bloom
crude bloom
#

with 100 entities, these are 10000 checks

onyx quail
#

ok

#

i will try