How to deactivate anything outside of two views?

There's two players in my game, but the main room is big and with many instances, thus it lags quite a bit at the moment. If i try deactivating (instance_deactivate_region) everything outside of the two players' views (putting the code in the Step events of the player objects), it ends up deactivating EVERYTHING, even player 2, outside of p1's view. How do i make it so that everything inside both player's views (0, 1) stay, whereas everything outside them deactivate? Thanks beforehand.
 

Simon Gust

Member
There's two players in my game, but the main room is big and with many instances, thus it lags quite a bit at the moment. If i try deactivating (instance_deactivate_region) everything outside of the two players' views (putting the code in the Step events of the player objects), it ends up deactivating EVERYTHING, even player 2, outside of p1's view. How do i make it so that everything inside both player's views (0, 1) stay, whereas everything outside them deactivate? Thanks beforehand.
first of all, do you really need to deactivate / activate instances? As you suspected, it costs a lot.
About deactivating, if you leave that process to each player, player 1 will deactivate player 2 before 2 can do his thing and therefore is deactivated forever.
You can have only player 1 do the deactivating jobs for all views.
 

RangerX

Member
What you have to do is to use an Outside View event on each objects that you want "deactivate-able" and then in the event you check if that object is in your views or not.

Also, this thread goes in the programming question. Report your own thread and in the message, ask them to move it.
 

icuurd12b42

TMC Founder
GMC Elder
deactivate outside view 0
deactivate outside view 1
activate inside view 0
activate inside view 1

that should work. make sure it's in the end step of a controller object and not in 2 separate objects trying to do their own thing for each view
 
thanks all u guys for replies, i'll try these out asap. ah this went to the wrong thread then, reported this to be moved to Programming
 
Top