Rosten Posted December 11, 2013 Share Posted December 11, 2013 Just about anyone who's done minecraft modding knows about chunk loaders, basically they keep a "chunk" (a certain area, it might have been 16x16 if i remember correctly) loaded at all times, regardless of whether a player was near it or not, because if you have machines operating, and your far away from it, the "chunk" won't be loaded, and thus won't work, basically i'd like to have something like this for don't starve, because, well same reason you'd want them in minecraft. Link to comment https://forums.kleientertainment.com/forums/topic/30342-mod-request-chunk-loaders/ Share on other sites More sharing options...
squeek Posted December 11, 2013 Share Posted December 11, 2013 (edited) In Don't Starve, loaded/unloaded entities are referred to as awake/asleep. You can disable entities from sleeping on a case-by-case basis by doing:inst.entity:SetCanSleep(false)By default, the only entities that are disabled from sleeping are: TheGlobalInstance, forest, maxwellphonograph, minimap, player, walls, and the world.If you turn on debug rendering (press backspace), you can see the entity count and the number of awake entities in the top left. Entities are automatically slept once you are a certain distance away from them. If I remember right, the sleep distance is determined by a number of factors (hardware you're running, version you're running, other stuff?).EDIT: Also, components can catch onsleep/onwake by defining the functions:function YourComponent:OnEntitySleep()endfunction YourComponent:OnEntityWake()endSee growable, combat, periodicspawner, playerprox, sleeper, spawner, stretcher, teamattacker for examples.Prefabs can do the same thing:inst.OnEntitySleep = function() endinst.OnEntityWake = function() endSee bee, beebox, beehive, bunnyman, cavelight, cavespiders, deerclops, evergreens, exitcavelight, hound, houndmound, lureplant, mosquito, penguin, penguin_ice, rabbit, slurtlehole, spider, spiderden, tentacle_pillar, walrus, walrus_camp, and wasphive for examples. Edited December 11, 2013 by squeek Link to comment https://forums.kleientertainment.com/forums/topic/30342-mod-request-chunk-loaders/#findComment-387870 Share on other sites More sharing options...
Rosten Posted December 11, 2013 Author Share Posted December 11, 2013 In Don't Starve, loaded/unloaded states are called awake/asleep. You can disable entities from sleeping on a case-by-case basis by doing:inst.entity:SetCanSleep(false)By default, the only entities that are disabled from sleeping are: TheGlobalInstance, forest, maxwellphonograph, minimap, player, walls, and the world.If you turn on debug rendering (press backspace), you can see the entity count and the number of awake entities in the top left. Entities are automatically slept once you are a certain distance away from them. If I remember right, the sleep distance is determined by a number of factors (hardware you're running, version you're running, other stuff?). Would there be a way to make a structure keep all entities within a radius of it awake no matter what? Link to comment https://forums.kleientertainment.com/forums/topic/30342-mod-request-chunk-loaders/#findComment-387876 Share on other sites More sharing options...
Silentdarkness1 Posted December 11, 2013 Share Posted December 11, 2013 This would inevitably increase lag on a lot of systems. Link to comment https://forums.kleientertainment.com/forums/topic/30342-mod-request-chunk-loaders/#findComment-387877 Share on other sites More sharing options...
Rosten Posted December 11, 2013 Author Share Posted December 11, 2013 This would inevitably increase lag on a lot of systems.Thats sort of inevitable, loading more areas, or rather entities, at once takes up more cpu thus making it more lag inducing, it does the same thing in minecraft, so why wouldn't it here? Link to comment https://forums.kleientertainment.com/forums/topic/30342-mod-request-chunk-loaders/#findComment-387879 Share on other sites More sharing options...
Silentdarkness1 Posted December 11, 2013 Share Posted December 11, 2013 If the mod does get made, then it should be noted, is all i'm saying. I wouldn't have a problem with this(I think) Link to comment https://forums.kleientertainment.com/forums/topic/30342-mod-request-chunk-loaders/#findComment-387881 Share on other sites More sharing options...
squeek Posted December 11, 2013 Share Posted December 11, 2013 (edited) Would there be a way to make a structure keep all entities within a radius of it awake no matter what?Depends what you're trying to do. I've also had no real experience in messing with this sort of stuff, so you'd have to experiment to see what works. For example, I'm unsure if asleep entities would be included in a TheSim:FindEntities() call. If they are included, then you may not need to keep all entities awake (for example, if you had a machine that picked up nearby stuff, then the stuff that's being picked up wouldn't necessarily need to be awake). So, yeah. Can't give a definitive answer. Ideally you'd always want to try to keep as few entities awake at a time as possible. Edited December 11, 2013 by squeek Link to comment https://forums.kleientertainment.com/forums/topic/30342-mod-request-chunk-loaders/#findComment-387887 Share on other sites More sharing options...
Rosten Posted December 11, 2013 Author Share Posted December 11, 2013 My goal here is to make things such as spider farms and actual farms and bees and such work while you're away Link to comment https://forums.kleientertainment.com/forums/topic/30342-mod-request-chunk-loaders/#findComment-387909 Share on other sites More sharing options...
squeek Posted December 11, 2013 Share Posted December 11, 2013 (edited) In looking around a bit more, forcing something to never sleep shouldn't really be necessary. Tasks will continue when an entity is sleeping, so you can use that to continue functionality while asleep. See the periodicspawner component for an example of something that can be used to only spawn things when the entity it is a component of is 'offscreen' (meaning asleep); take a look at the component's variable 'spawnoffscreen' and how it's used. Edited December 11, 2013 by squeek Link to comment https://forums.kleientertainment.com/forums/topic/30342-mod-request-chunk-loaders/#findComment-387911 Share on other sites More sharing options...
squeek Posted December 11, 2013 Share Posted December 11, 2013 My goal here is to make things such as spider farms and actual farms and bees and such work while you're away Meaning what? Which parts of those things currently don't work while you're away? Regardless, though, keeping the entities awake is probably the least efficient method and should be avoided if at all possible. There's no reason to actually spawn bees and have them move around offscreen if it's possible to simulate their effects without them actually existing. Link to comment https://forums.kleientertainment.com/forums/topic/30342-mod-request-chunk-loaders/#findComment-387915 Share on other sites More sharing options...
Silentdarkness1 Posted December 11, 2013 Share Posted December 11, 2013 ^ @squeek is on to something here. Link to comment https://forums.kleientertainment.com/forums/topic/30342-mod-request-chunk-loaders/#findComment-387918 Share on other sites More sharing options...
Rosten Posted December 11, 2013 Author Share Posted December 11, 2013 Meaning what? Which parts of those things currently don't work while you're away?Regardless, though, keeping the entities awake is probably the least efficient method and should be avoided if at all possible. There's no reason to actually spawn bees and have them move around offscreen if it's possible to simulate their effects without them actually existing.Thats an interesting idea, what im saying is, since, say in a spider farm, if the entities are sleeping, e.g the pig/bunny houses and spider den, no pigs spawn, no spiders spawn, there's nothing to fight each other, so nothing drops, i like your bee idea though Link to comment https://forums.kleientertainment.com/forums/topic/30342-mod-request-chunk-loaders/#findComment-387919 Share on other sites More sharing options...
squeek Posted December 11, 2013 Share Posted December 11, 2013 Thats an interesting idea, what im saying is, since, say in a spider farm, if the entities are sleeping, e.g the pig/bunny houses and spider den, no pigs spawn, no spiders spawn, there's nothing to fight each other, so nothing drops, i like your bee idea though Combat may make things a bit difficult, and may require entities to actually be awake. That'd require more focused testing and experimentation. However, beeboxes already do the simulation: when a beebox sleeps, it starts accumulating honey on its own with a period of TUNING.BEEBOX_HONEY_TIME. See prefabs/beebox.lua's onsleep and stopsleep functions (lines 95-107). Link to comment https://forums.kleientertainment.com/forums/topic/30342-mod-request-chunk-loaders/#findComment-387921 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