-
Posts
5283 -
Joined
-
Last visited
Reputation
2631 ExcellentConverted
-
Location
In a simplicial complex.
-
Modder
http://forums.kleientertainment.com/user/237781-simplex/?tab=idm
Badges
-
Visited by the Title Fairy
Couldn't be Simpler
-
Don't Starve Together
Contributor
-
hint Lua Performance: arrays
simplex replied to Maris's topic in [Don't Starve Together] Mods and Tools
Checking whether a value evaluates to true (as in "if x then") is indeed marginally faster than an equality check, but whether or not throwing a negation (as in "not x") in the mix offsets that or not may very well depend on the phase of the moon and whether the gods have decided the day is in your favor. When we get to *that* kind of minutiae and of such small differences, will it ever be at all relevant? You're more likely to get a different output due to hardware differences than due to any fundamental characteristic of the Lua virtual machine. -
An Idiot's Guide to Growing Custom Facial Hair
simplex replied to Ealish's topic in [Don't Starve Together] Mods and Tools
And oh, @SageOfLegend, could you post in this thread instead? I don't want to feel responsible for derailing this thread. @JoeW , @ImDaMisterL or some moderator seeing this, could you move the posts (starting from this one) from this thread to that one? Again, just to avoid cluttering this guide. -
An Idiot's Guide to Growing Custom Facial Hair
simplex replied to Ealish's topic in [Don't Starve Together] Mods and Tools
Could you try the command at the end of my previous post? (I had posted it as a new post, but the forums glue recent posts together) -
An Idiot's Guide to Growing Custom Facial Hair
simplex replied to Ealish's topic in [Don't Starve Together] Mods and Tools
If you type the command 'dir' from the same folder, are anim.bin and build.bin listed in the output? Sorry for asking you to perform such simple checks, I'm just puzzled about the issue since the path/filesystem related code hasn't changed in ages, so I'd just like to discard anything obvious first. @SageOfLegend Try the command 'krane . whandler_beard'. This is an alternate syntax (and the one I personally use) where the folder where the anim.bin and build.bin are located is given instead of their paths directly. -
An Idiot's Guide to Growing Custom Facial Hair
simplex replied to Ealish's topic in [Don't Starve Together] Mods and Tools
@SageOfLegend Could you try the same command with './anim.bin' and './build.bin' instead of just 'anim.bin' and 'build.bin' and tell me if it works? -
hint Lua Performance: arrays
simplex replied to Maris's topic in [Don't Starve Together] Mods and Tools
Huh. Indeed it's rather strange that pairs could be faster than ipairs, even if marginally, over large arrays. If anything, since pairs performs checks to see if there are hash elements and since all of the luaX_next functions are in different compilation units (preventing inlining, thus hindering locality of reference), I'd expect pairs to be universally slower. But anyway, indeed this is only relevant as trivia. Though I'm not sure I agree with the claim that "in most practical cases no loop (in Lua) is that tight that I need to consider the cost of the iterator itself", at least if this is to be taken as a general claim. If we're talking about pairs vs. ipairs then sure, it's irrelevant, but a numerical for can be significantly faster than ipairs iteration for simple "foldl" operations, such as summing an array, computing its minimum, etc. But ok, unless one's implementing a numerical linear algebra or scientific library in pure Lua (and why would they?), this kind of code shouldn't be a bottleneck. And you did say "in most practical cases" and "I need to", so I guess I'm needlessly nitpicking. And oh, since we're talking about Lua performance: why doesn't Don't Starve/Don't Starve Together use LuaJIT? -
hint Lua Performance: arrays
simplex replied to Maris's topic in [Don't Starve Together] Mods and Tools
Aw, you didn't test table indexing! One of my favorite pieces of trivia about Lua is that table indexing with string keys is actually faster than indexing with numerical keys, even if that number falls in the array key range (though in this scenario the performance difference is very small). They're virtually identical when a table has no hash part. In my system which one had the best average runtime changed between benchmarks, due to the performance being so close (the difference in runtime is of about 1%, one way or the other). If you check their C implementations under Lua 5.1.5, you'll see that the operations performed by luaB_next (pair's generator) and ipairsaux (ipairs's generator) are basically the same. They are both defined in lbaselib.c, though reading luaB_next will take you to lua_next (lapi.c), which eventually will lead you to luaH_next (ltable.c). And oh, @Maris, the cost of computing the length of a table (as in '#t') is roughly proportional to the logarithm of its size. Also note that the header of a for loop (such as 'for i = 1, #t do') is only evaluated once, so the cost of computing a table's length there is much smaller than the cost of actually running the loop, even if it's empty (for sufficiently large tables). -
World Gen Data and Mod Changes
simplex replied to Ipsquiggle's topic in [Don't Starve Together] Mods and Tools
@Ipsquiggle This is only fringe-related to this topic, but is there a way to obtain a shard name from a shard id at the Lua level? The engine level log prints show the engine has that info, but I haven't found any way to access it from Lua. -
World Gen Data and Mod Changes
simplex replied to Ipsquiggle's topic in [Don't Starve Together] Mods and Tools
@Ipsquiggle If I may ask, what's your current schedule? I mean, how is your time currently divided between the worldgen data and modding API changes discussed here, bug fixing DST and working on Through the Ages? I ask mostly to have a feel for what kind of request is reasonable or not. -
World Gen Data and Mod Changes
simplex replied to Ipsquiggle's topic in [Don't Starve Together] Mods and Tools
Try AddTaskSetPreInitAny(function(task_set_data) local task_names = task_set_data.tasks --// Do stuff with task_names, but note this must be done within this function. end) -
World Gen Data and Mod Changes
simplex replied to Ipsquiggle's topic in [Don't Starve Together] Mods and Tools
We use custom world and world network entities, so adding a preinit wouldn't even be necessary. There are certainly workarounds, but the major concern is user transparency: having a worldgen option which does nothing (because there's code overriding the override) feels off and glitchy. I'd say this is a low priority request, but a relatively simple one (due to not requiring affecting other game subsystems) to be worth it. -
World Gen Data and Mod Changes
simplex replied to Ipsquiggle's topic in [Don't Starve Together] Mods and Tools
@Ipsquiggle I just remembered a request: could you allow for some override options in levels being hidden from its customizationtab in server creation? For example, U&A requires rain to be set to "always"; it doesn't actually rain in U&A, this is just an element of how we represent the static mechanic and make it relate to vanilla prefabs. Changing rain to anything other than "always" will in fact break the mod, so having that be a spinner in customizationtab is really bad. The issue is, now that level overrides are in a key-value dictionary instead of an array of tuples, the simplest solution (adding support for an optional 'hideinfrontend = true' entry in the tuples themselves) is no longer available, so a custom scheme is necessary. Maybe an optional 'hiddenoverrides' array of override key names added to level data, which is checked by customizationtab to exclude certain override options from the frontend, but ignored by everything else in the game?