R1ncewind Posted September 1, 2016 Share Posted September 1, 2016 Hello there. in DS there an active area around player (about 2 screens to each direction) and everything outside is sleeping, how it works in DST? each player have such "active area" or whole server is active? for example in DS you are able to leave your main base and build small one for summer far away. Since it's will be outside active area, nothing will touch main base. Is it same for DST? Link to comment Share on other sites More sharing options...
DarkXero Posted September 1, 2016 Share Posted September 1, 2016 28 minutes ago, R1ncewind said: Is it same for DST? Yes. However, a difference you may observe depends on if you play as the server, or as a client. The Ents table of the server holds all the entities in it, and they go asleep/awake when players leave/enter the area. Basically DS. The Ents table of clients holds all the entities close to the player, stuff doesn't go asleep/awake, it gets removed/spawned with distance. Link to comment Share on other sites More sharing options...
R1ncewind Posted September 1, 2016 Author Share Posted September 1, 2016 Pretty sad... I had hope about fully active server, since it's dedicated. Is there way to increase active area radius (server setting? ) or it's hardcoded like in DS? Link to comment Share on other sites More sharing options...
DarkXero Posted September 1, 2016 Share Posted September 1, 2016 49 minutes ago, R1ncewind said: I had hope about fully active server, since it's dedicated. Is there way to increase active area radius (server setting? ) or it's hardcoded like in DS? Nope, that area is still fixed. But you can do something like this: AddPrefabPostInitAny(function(inst) inst:DoTaskInTime(0, function(inst) inst.entity:SetCanSleep(false) end) end) And now, once awaken, an entity will never go to sleep. The drawback is that restarting the server will put everything to sleep, then only awaken stuff close to the players. So you would need to rediscover everything, which kind of defeats the purpose of having this. You may think "well, then I will just do" AddPrefabPostInitAny(function(inst) inst.entity:SetCanSleep(false) end) but then the server most likely will not start, and you will have some recursion problems with some entities that use the awake/sleep procedures. So this code won't work. So now you think, but what if I select certain stuff like AddPrefabPostInitAny(function(inst) if inst.components.health then inst.entity:SetCanSleep(false) end end) then well, this would work. Trees and stuff would sleep though. How about checking for the inspectable component? AddPrefabPostInitAny(function(inst) if inst.components.inspectable then inst.entity:SetCanSleep(false) end end) This will awaken pretty much everything. You will have 11000 entities with 10000 awake of them. But you will dunk your server performance really hard. In the end, you can also check for AddPrefabPostInitAny(function(inst) if not inst:HasTag("FX") then inst.entity:SetCanSleep(false) end end) And you will get pretty much all relevant entities, without crashes. The server will take like 5 to 10 minutes of waiting so it can start. But I leave it to you to explore what you can do with this. By the way, you can also do this in Don't Starve single player. Link to comment Share on other sites More sharing options...
R1ncewind Posted September 1, 2016 Author Share Posted September 1, 2016 (edited) Well it's not only about mobs/flowers, it's also about fire and random things like lightning, but thx for idea. I'm also wonder will pathfinding work well if such sleepless animal will be forced to chase player on other side of map . Don't think so. About huge load - i think with your idea i am able to change most important animal's prefabs, so bunch of other entites remain untouched. Don't think that 50-100 animals bring lot of lags, at least in DS. My goal is to make environment which is able to live their own life without player presence. NPC wars, resource gathering, patrols, etc. Edited September 1, 2016 by R1ncewind Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now