|
Post by Admin on Aug 2, 2017 13:43:21 GMT
Hello guys! Today I was playing around with mazes. Then I implemented an algorithm that generate random mazes and build a scene with them. i.imgur.com/D1Bc3pk.pngBut as you can see in the picture, each maze uses a lot of entities. In this case a 20 x 20 uses 660 entities. Each wall is made by several pieces of 16 x 2. I’m looking for a way to optimize this to run smoother, so, any idea?
|
|
|
Post by Admin on Aug 2, 2017 13:43:54 GMT
** _M_S_D_ **
Some tips I’ve heard and learnt:
Use entities sized ^2, so in this case use them as 16×16, but set the collision to match the actual “wall of the maze”. Don’t know how much this will help, but it could give a bit of a boost.
If possible without screwing up your programming, try using one entity for L sections of wall instead of using two, this would probably cut your entity usage by 1/3 or 1/4.
Not sure if this will help, but set all entities to static and vertex shaded if you haven’t already.
Obviously, removing say 8 to 16px from each side will dramatically lower the size of the maze without removing that much content.
You could make the outer border of the maze into one or several entities instead of having it be comprised out of many tiny elements. I made a rough calculation, doing this could probably save you around 100-120 entities. Make one big entity 512×512 with the entire border, or make each corner out of 256×256 and place separate entities for collision. This could require you change the exit of the maze to a point instead of a hole in the wall. This would be efficient though if you are going for mazes that are always square.
That’s what I can think of off the top of my head. Good luck!
|
|
|
Post by Admin on Aug 2, 2017 13:44:21 GMT
** By tspy **
I suggest you to make a second pass to analize your maze and replace groups of entities with same orientation with bigger entities. You can use walls of 32 x 2 or 48 x 2 for replacing groups of 2 and 3 walls and reduce the number of entities used.
|
|
|
Post by Admin on Aug 2, 2017 13:44:46 GMT
** By Neto **
At first I was using them as 16 x 16, but don’t helped to much. I considered to use bigger entities to compose the walls, mainly the borders and L, T and + sections. But in last case I am too lazy to create the custom collision by hand since Ethanon don’t allow me to create more than one collision box per entity.
Than I’ll try to use bigger entities.
Thank you guys!
|
|
|
Post by Admin on Aug 2, 2017 13:45:10 GMT
** By Asantee **
Like others said, the best advice is to find smart ways you can use to minimize your entity count. Try to use bigger one when you can. Another important tip is to set all your tiles to static.
|
|