[Mod] 4 Seasons [20120709-final][4seasons]

User avatar
qwrwed
Member
Posts: 326
Joined: Sun Jul 22, 2012 20:56
In-game: qwrwed or Nitro

by qwrwed » Post

I got the mod from the board of King Arthur's Server, so it's ok except for 1 missing item (nbu:computer)
Last edited by qwrwed on Mon Dec 10, 2012 15:58, edited 1 time in total.

ERIIX
New member
Posts: 8
Joined: Sun Mar 25, 2012 21:56

by ERIIX » Post

If you're interested, the version I've been maintaining for my server can be grabbed at http://test.eriix.org/4seasons.tar.gz.

To help fight lag on my server, which is rather pitifully weak, I modified the ABM to fire far more often, but with a fairly high inverse chance in order to spread out the load. The result has been a gradual change of seasons without causing periodic lag. If you find your performance needs are different, it is easy to change the settings back for the other balance.

I'm currently working in init.lua.wip on trying to separate out the seasons into different ABMs to further mitigate performance issues (it shouldn't really need to trigger at all for blocks that already represent the current season), but, while disabling the effect of an ABM turns out to be fairly simple (store a backup of the action field, then replace the action field with "function() end"), preventing it from triggering entirely is much more interesting and appears to require some C++ work. I'm still looking into what I need to do in that regard. Free time is limited, so I have no timetable.

mauvebic
Member
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Post

4 ABM's = 4 timers
1 ABM = 1 timer
changing that wont help performance much.

TBH the seasons were never as long as i would have liked, but there's an upper limit to minetest.after() which is why the latest version in my new modpack works manually w/ chat commands.

What i could do is link the seasons to real world wearther conditions (ideally you'd chose the city your servers' in, but you could chose any city). Though i cant guarantee that it would work on win32.

ERIIX
New member
Posts: 8
Joined: Sun Mar 25, 2012 21:56

by ERIIX » Post

mauvebic wrote:4 ABM's = 4 timers
1 ABM = 1 timer
changing that wont help performance much.

TBH the seasons were never as long as i would have liked, but there's an upper limit to minetest.after() which is why the latest version in my new modpack works manually w/ chat commands.

What i could do is link the seasons to real world wearther conditions (ideally you'd chose the city your servers' in, but you could chose any city). Though i cant guarantee that it would work on win32.
4 timers, yes, but not at all equal. I have broken them up so that, once all active blocks have been converted to a single season, there are no blocks matching nodenames for most of the ABMs. This avoids calling into Lua at all for those triggers and allows the Lua code that is called to have fewer branches. (When all active blocks have been converted to the correct season, the ABM called on them reduces to an integer equality and an empty return since it never has to do anything during its own season -- thus avoiding all the string comparisons involved in checking nodes.)

In addition, it can serve to further balance the load so that it is not all happening at once and causing a big stutter. I'm not making real use of that ability, however, since that would require staggering the times a bit, and I have them all using the same interval.

It is, at minimum, running rather snappily both on my laptop and on the $2.95/mo VM I'm using to host a server. In any case, it's easy enough to revert should I need to in the future and it fits with the attempt I'm making to build an API so that other mods I'm working on can have seasonal effects without merging them in.

If you're worried about minetest.after not working for very large values, you could have a look at eriix.longafter in http://test.eriix.org/eriix.tar.gz. I'm not really done with it since I want to give it a way to save how long is left on the various named triggers for loading after server resets -- There's little point in being able to specify an event to occur in 52.3 weeks {0,0,0,0,52.3} if the server is nearly certain to be reset by then. Much of the code deals with the way of specifying time, so you could basically just pare it down to the repeater itself and a basic compare-and-subtract in the time handling bit. I just added the time handler because it was fun.

In other news, I have a newly updated 4seasons on http://test.eriix.org/4seasons.tar.gz. This version has the ABM split and new textures for leaves under both fall and winter.

* User-visible changes:
** The winter leaves have a leafless texture (bare branches and snow) and the node has been modified to be climbable rather than walkable. This behavior can be reverted by setting CLASSIC_WINTER_LEAVES to true in the config section of init.lua and there is an alternate winter leaf texture available as 4seasons_leaves_with_snow.png, though you would need to either replace 4seasons_leaves_winter.png with that or modify the node definition to get that image.
** There is a new texture for fall leaves which is brighter and intended to tile somewhat better.
** There is a new transition behavior available for ice. It has been changed to trigger when it has any air neighbor rather than only when it has air directly above. This creates many strange and interesting ice structures out of waterfalls and may not be something you want at all, so you should test it first on an unimportant world or a world of which you have a current backup. Setting CLASSIC_ICE to false in the config section of init.lua will activate this new behavior.
** The classic '/season pause' has been renamed to '/season stop'.
** A new '/season pause' has been added. This command pauses the automatic advancement of seasons. Once executed, the code will not automatically advance to the next season, but will continue converting blocks to the current season until manually told otherwise. Setting a season manually unpauses, so you don't have to remember if it was paused when choosing a new season.
** '/season unpause' has been added. This is identical to running '/season <season>' where <season> is the current season.
** Default season length has been changed to 61 minutes, which is about 3 days, one hour game-time.

Of course, this is very much a work in progress, and any feedback or ideas for future improvement is greatly appreciated. In particular, with winter allowing you to excavate frozen lakes one layer at a time and climb trees, it seems that all the other seasons are dreadfully lacking... Something to make them all more than just a texture change would be very interesting.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests