Hiding objects that aren't on screen...surely not?

this?

I see many ppl struggling at create a working culling system…(i’ve even answered in the Biscuit’s thread about this… i still appreciated he’s works)
In my game i had this fixed long time ago or my game would had never been possible.

i just do this

Explained:

i use the Silver camera Method with player follow and rooms positioning
(the only things you requires are well placed squared proxy box rooms in your game)

The player get the same number variable room for each room.
everything outside (not in the same room or different player room variable is deleted).

I find it really simple…am i forgetting something?
You can even check by rooms collision to creater different culling between rooms…

It works flawlessly in sideview scroller games…but i think iot can be done for everyhting…and i’m proud of it… :wink:.l…joke.
You can even use the same tiled maps for checking.

Just a note: ofc the creation happen when the player enter a room. In games without the camera buffer u may notice the creation for a millisecond.
But it is really not noticable with a minimum of camera buffer.
You can fix this creating a lag between rooms…Like eg to not cull starting rooms, collided rooms to start room ecc…

I 've always wanted this to be an extension…so i can spare som e code lines…
better if some developer would try to turn this ina built in culling method for GD

Ps: i apologize to biscuit to have never said this in his culling thrread…but he was so focused on his work that i ended to let him try. :pray:
The differences is that he’s method use the camera for culling…
I don’t find it as good as it should be because the creations happens almost instantly when in the camera bounduary again and bad behaviours could happen.

PS: maybe this could be integrated in the same Room Camera extension…If approved.

If too many objects are truly the issue then you could divide the game up into chapters or areas.

But, it could also be the events. Having fewer objects might not completely fix things.

Did you use the profiler to see if something is using more processing time?

Wiki : Game profiler

This shows only how to delete something not how to create it
So i fail to understand what you mean

Also i need to split map into grid and use each cell as some area i can refer to
This is base for chunk system where i would load dynamically parts of map and not just objects spamming close to borders each frame

This

I understand…
It will not fit that particular chunk system.
But surely it works for other games, (since i have tested it a lot in mine) if u need a better culling system that destroy things instead to hide em.

this is my creation event.


just as example…(u can create a behaviour for object)…
as i said above the only downside is that if u have a camera with no buffer u can notice the creation cos the timer. (fortunately i have a gamne with fixed zoom and surely you don’t want an enemy at close distance when the player enter a room)
But if u want it is easly fixable if u check differently the var room for the player.

i’ve seen that chunk system…i may be wrong but i don’t find it good for culling bcs it culls in realtime (like biscuit’s method)…if that is what u want…

eg: with real time culling bad things happens if u have for example an object with linked objects, whit the async timers you give the time to read other events…
imo the key for a culling system is there.

PS: this method only works with finite areas.

Do not get it as i am not grateful cause i am
This is in fact helpful
However i am for something more precise
You just create objects you do not save any values they have
And i kinda need to save any kind of values i would need to

And guess what
This is 1st step into chunk system
@Davedorkmouse
I know how to split map into chunks
I only now need a way to give each chunk ID and manage all chunks creation/deletion by ID
Since creating and deleting based on position i already have
So maybe soon enough i will have chunk system to de lag any game

That is fixable.

…I really don’t think of it as a part of a culling method.
But i agree…that have them both…is mandatory in some games…(fortunately not in mine)

Anyway i’ll be the first to test that chunk method if it’ll works. Since idd a culling system solve many lag problems in mosts games.

to Zero.
If possible can you consider to add this chunk system for finite areas too.
I mean it looks like you’re using the camera bounduary system (like biscuits).

This is great for open world games.
If you can eg intergarate a system for finite areas too like eg is inside object area instead of a camera…it would be great.

like an option to chose which object to check or camera in the behaviour.

…basically an improved ver on what i did above

Thanks @ZeroX4 and @RMDB - I’m going to look into this further once i’ve got 5 days of my proper job out of the way! I like the chunk system! …i’ll chew it over while making owls this weekend! seems great for something where crafting and resources are involved like terraria etc . A virtual cellular grid based on players position? my mind is full of half baked thoughts like …could it be based on distance and angle from player and use trigonometry?

@RMDB …i like the simplicity of your system…it’s almost like each room is a mini scene and it’s perfect for dungeon crawlers etc, but it doesn’t seem to allow for things moving around in the rooms or between them…but i like it!
this is something id like to delve into when ive got the headspace as the next game I want to make is procedurally generated …with objects made of other objects.
@Keith_1357 …i did run the debugger …but i don’t know a good stat from a bad…5ms overall with 37% render and 19%events

1 Like

mine is the metroidvania style…in castlevania enemies don’t follow you outside rooms.
Ojects are regenerated each room.

a mix of both methods is what we need

Take a look at the time and percentage that each event uses. It helps if your events are in event groups. See if something is using a large share.

If you’re still unsure then you could post a screenshot or two of the profiler and someone here might be able to suggest something.

what if you had an object without image or behaviours etc just variables…called say ‘holding object’
every 5 frames or so you check if any of your objects are more than say 600pix from player. If so create holding object at that loc. record the id of the object to destroy, size, variables etc in the new holding object. and delete the object.
then every 5 frames or so you check if holding object is within 600pix… create the right object and transfer the attributes and delete the holding holding.

Just because i do not have chunk system it works based of whatever was where to camera boundary

If i be able to give chunks ID’s i won’t be limited to 1st create grid and then give them ID
I could dynamically create grid
So would work for pre-built maps with limited area
And infinite maps with unlimited areas

@Davedorkmouse Here i check if object is off screen where in chunk system i would check if whole chunk is off screen or well on it
I wonder what benefit it would give to have it on player position?
Cause if player is not on screen then what is the point in loading/unloading?
Also angle would not make sense for same reason
Same as position
Since what you can see should be loaded or not
And not what is close to player
BUUUT since i check camera border left and position of object
You could check Player.X() and Player.X()-100 against position of object
Which would check if player is in range of 100 pixels to the left from player
Which stil would not make sense in my eyes

Guy who did teach me how to do this did also this based on radius
But i fail to find usage for it other than it being cool effect
IF that radius would be large enough to cover whole screen seamlessly
Then it would load a lot of tiles for no reason wasting resources

1 Like

Wish u good luck…You’ve got all the right moves. :+1: :+1:
Senza titolo

Stupid question: for chunk…do u mean grid tiles?..
if so…isn’t possible to count tiles based from scene grid size from 0,0?
isn’t assiging an ID for each grid tiles heavy in terms of performances?

Chunk = some portion of map (or to be precise pre determined area/range)
Not a tiles themselves
Imagine i have 16x16 tiles
I could go with 100x100 chunks where it would not match tile grid
BUT why does it matter?
When what is loaded or unloaded you won’t even see?
I could load 5 tiles off screen or line of 100 pixels in which 5 tiles only fit and some empty space

So it would just check for EVERYTHING in that area
Meaning chunk would need to be bigger than biggest object that would be loaded

thaz what i thought…it doesn’t matter idd.
But u may need something to refer too for assigning ID…and the scene grid tile size is there.
Btw it was a stupid question.

As you see this draws grid out of few variables with shape painter
All i need from it now is to give each cell ID and so it will be converted to chunk system
Nothing more nothing less
And now i could check if x pos of platyer or camera or whatever
Against if pit is to the left right up down or diagonal from its position
And depending on that i would load chunk by its ID
Now that i think of it i don’t even need IDs i could kinda sorta set IDs of chunks to their X and Y pos


…yep…that is wath i was thinking above…
better to not assign an ID if possible…
next steps are allyours… :smile:

i guess this way developers are bonded to think which tile size to use before starting a project but as long as it works i think it worth it…

thanks @Keith_1357 …sound advice…i’ll try that out when I get a chance!

1 Like

@ZeroX4 …it looks like you’ve thought this through more than me and thanks for showing your great work. After a commented … i thought doh…yeah it doesnt need to be radius, just based on whether it’s on screen or not!. Chunks …i need to research this a bit more in order to be clear on it. My objects are all different shapes and sizes and i don’t know if a system of chunks would work…i’ll give this more headspace next week!