Bro u really understand chatgpt
Ahh i get you now!!
Instead of selecting the Layer and having to have a bunch of different options, i can create a check the same way we exclude objects.
We create a group where objects inside will be culled no matter the layer.
That should be easy to add, ill work on that soon!
yes, I donāt know if that was already the caseā¦ Itās an extra option, just to refine the deletion of objects, an extra sort that would be done by the layer or layers concerned.
In some cases, you could place objects to be deleted by putting them all on a different layer instead of creating a group of objects.
Why would you do this? Because you can change the object layer during the game. So an object can have an instance transferred to another layer, e.g. ādeleted objectsā. This allows you to filter and give additional possibilities.
In the conditions we would then have āthe buffer zoneā, the object group and the layer.
The thing is, off the top of my head i cant think of how to integrate layers in that way, where you can just pick which ones without creating a bunch of fields, id have to really think about it.
What i can do which would give you exact same result, is filter trough a simple Boolean.
We already have that system in place with the Excluded Objects checking if a boolean is set to trueā¦ ao all i have to do is crack it open and make all objects on all layers be able to be culled.
Then the objects you dont want to be culled you put in a group to be Excluded.
If you change your mind and want that object to be deleted mid game, you can simply set their Excluded boolean to False and they will be culled.
If you set it to true mid game, they will be excluded again.
That i can possibly do easily and give it to you in an hour or so, after im done with what im doing right now
Thereās no hurry, itās just to move the project forward so that it can be used by as many people as possible.
Thank you for your work.
Ahh i thought you needed it for something, ill think it over then on how to implement a Layer Filter for more options.
Heres the download link to the Version with Save States already set up and ready to use!
Cullbuffer defines a zone around the camera, a thickness?
Yes.
CullBuffer at 0 is exactly the size of the Camera, any object off camera will be culled.
If you put a negative number, like -100, now it will cull objects 100 pixels inside the camera, youll see objects actually being culled in real time as you walk around.
I recommend setting it up to around 100 to 300.
If you make it 0 for example, youll see still see objects being culled on the edge as you move, and the faster you move the more youll see it, thats because to make it better for performance, i added a limit to how many objects can get culled at once, so having a little breathing room on your buffer is good
Perfect !
So also when it recreates the objectsā¦
āif (objectLayer !== āā) continue;ā between the quotes you can put another layer or a variable to choose the layer? Empty is the base layer, right?
If im not mistaken āā means Base Layer, for example, when you choose a camera in GDevelop with an expression, like CameraCenterPosition(āā, 0), that means Base Layer and Camera 0, if you do CameraCenterPosition(YourLayer, 0) that selects the layers called YourLayer
You can mod the script and it should work, but it will should also only be able to select one layer at a time, so i wouldnt change that.
The mod needs to be to have target objects depending on their layer, not target the layer itself
Alsoā¦ Did you run it trough a translator or something? Why is it French?
Yes, I ran the text through a translator, Iām French, I understand a bit of the code but when in doubt I translate the comments anyway
Hereās the Layer option, CAUTION I havenāt checked how it works. The option applies to all layers by default. To apply only to one layer, simply enter the name in the āCullingLayerā variable instead of āApply to Allā.
Dont just throw code around, test that it does what you want and then post it, i run stuff non stop and test as much as i can, i never just make something and then share it without testing, because 99% of the time it needs adjusting
Youāre right, Iām going to test it. When I tried it, I noticed that the camera didnāt move, so I couldnāt move it to test the codeā¦
You had to send objects outside the zone, I wanted to move the camera with the zone.
- While the object is culled, you can still reference its data, for example, you can still use events like āat Object.X() and Object.Y()ā even while they are deleted
This was a lie it seems, i should of tested this better, it dosent work like thisā¦
I could make it so that we can access this data trough variables by storing the information in variables that we can then call to use in this mannerā¦
But im not too sure on performance dips and thats the whole point of this, its to increase performance, if we start working against the performance gains then theres no point to using this.
So for now im not adding this feature in untill i can properly test how to make it work in a simple and efficient way.
I donāt think you understood my message. It has nothing to do with the layer code I want to test.
The problem is that when your event is activated the camera canāt move!
When I deactivate it, the problem is solved, I can move it in all directions with the keyboard keys.
In your code thereās a part that blocks the camera.
My previous post wasent a reply to you, i was just stating something about the script.
Also, regarding this locking camera thing, my script does nothing like that, i dont think you know how to work with layers and camerasā¦
I just tested it, i created an object in a different layer, set the camera to follow it, and it works just fineā¦
If you make a Player in a different layer, setting the camera to follow it and then wondering why the other layers arent moving its because each layer has multiple cameras, if you want multiple layers to follow the same object, then you need to create events that tell the different cameras in different layers to follow the same object.
Hi, I canāt do it, thereās always a problem with the layer or the camera.
Dont worry, when i have the time ill add in a layer select
Hey, this is awesome, I wish I would have seen this post sooner. Thank you so much. I was looking through it and trying to figure out how to target multiple layers for culling, is this possible yet?