Page 1 of 1

Off-screen actors that need remembered?

PostPosted: Fri Jul 26, 2013 4:40 pm
by Deamonboy
I am working on a trade simulation game. 2d top down but i have a problem i have not figured out yet.
there will be other traders moving around the world map that will need their locations direction speed etc..
remembered and actively plotted so they update location properly.

so how do i "minimize" them when they are off-screen/out of view (view range may be less than screen size)
when they are off screen i only need ID, location, cargo, destination, and speed... i think but no sprite or animation
no checking if they want to attack or run(well a simplified quick combat system for them attacking each other)
no worry about their view range.


how can I accomplish switching from Minimum to Full cleanly I am not even sure how to setup such a thing.

I am trying to avoid sudden slowdowns/invisible traders/glitches/ traders popping up seemingly randomly

my biggest concern is how many such traders i would be able to have active at any 1 point due to the size of the planned world it could be in the range of a few hundred.


I appreciate everyone who reads this and has any tips or thoughts I welcome all comments and criticism.
haven't used C since like 1996 so the answer may be obvious but I have lost most of what I knew

Re: Off-screen actors that need remembered?

PostPosted: Fri Jul 26, 2013 5:42 pm
by AliceXIII
define arrays in global script to store all trader data you need, as for where to call them place them in create actor scripts initially then either in draw actor scripts or activation event scripts whichever your more comfortable with, then you could use out of vision event scripts and enable and disable specific events and set the visibility to not draw but allow events

Re: Off-screen actors that need remembered?

PostPosted: Fri Jul 26, 2013 6:06 pm
by Deamonboy
so what I am seeing from what your saying is have a internal switch to swap between on-screen and off-screen behavior

ok so i would need to make them detect when on-screen was MAX_SPEED * 2 away from the screen and toggle

Re: Off-screen actors that need remembered?

PostPosted: Fri Jul 26, 2013 10:51 pm
by AliceXIII
actually much simpler than that you see gE's syntax is like C but gE events activate scripts, When you open an actor's Actor Panel(right click actor) you see the events button when clicked it'll have a drop down menu to select events from you can select out of vision then a script action afterwards that sets the needed data into arrays and triggers a visibility state function(can be found in the functions drop down list) and set it to do not draw but allow events