Simulator rewrite
#11
I think rev 1227 is about as much as I'll be touching the redstone simulator. I'll be adding a new function, SimulateInChunk(), to the other simulators; a simulator can decide whether it wants the old-style global simulation function or the new-style per-chunk simulation function; the redstone simulator seems too complicated for me to convert at this moment.

So you can wait for a bit longer if you want to see how that will turn out, or you can start tinkering with the redstone sim rightaway Smile
Reply
Thanks given by:
#12
I decided to rewrite the fire simulator first, since it is one of the easiest. Also, of course, I'm gonna upgrade it a bit. It will have a setting, how aggressive to make the fires. And I'd like to try an option unlike the vanilla - when a fire burns out a block, that block will be replaced by a new fire block. This will probably make fires really aggressive, but I guess that's realistic (mueheheheheBig Grin )
Reply
Thanks given by: NiLSPACE
#13
yea a better fire simulator would be usefull since right now if you start a fire in for example a jungle... you are screwed..
Reply
Thanks given by:
#14
(03-01-2013, 05:16 AM)xoft Wrote: I decided to rewrite the fire simulator first, since it is one of the easiest. Also, of course, I'm gonna upgrade it a bit. It will have a setting, how aggressive to make the fires. And I'd like to try an option unlike the vanilla - when a fire burns out a block, that block will be replaced by a new fire block. This will probably make fires really aggressive, but I guess that's realistic (mueheheheheBig Grin )

Yeah, that will be pretty cool.

Also, I download the code, i'll start looking into the redstone simulator to see what I can come up with, but I'll wait before I commit anything until you have a chance to develop a simulator. I'd like to follow the same code standards that you are doing in the other simulators.
Reply
Thanks given by:
#15
Finally I'm getting some results! I wasn't able to tweak the parameters of the fire simulator to any realistic levels; but at last I seem to have hit the sweet spot with the algorithm.

The fire simulator currently has these parameters:
BurnStepTimeFuel - how long it takes for a fueled fire to step into next stage (there are 16 stages to a fire, by its metadata)
BurnStepTimeNonFuel - how long it takes for a non-fueled fire to step into next stage
Flammability - the chance of neighbors catching on fire
ReplaceFuelChance - the chance that a fuel block, upon being consumed will be replaced by a fire block instead of an air block

Setting high flammability has produced some forest fires that my pyromaniac inner devil danced around:
[Image: hugefire.png]
(This is about 10 seconds after starting the fire Smile )

Setting low flammability provided the vanilla effect of fire dying out rather than spreading. It's good for the server, but not so good at reality.

I'll play some more to establish a good set of default values, then commit the code. And I still need to check if the fuel replacement code works and how that works out.
Reply
Thanks given by:
#16
maybe you can also add that if there is water nearby the fire will spread slower.
Reply
Thanks given by:
#17
Done, committed. Go play with fire, children Smile

It could be added, yes, but for now I like it enough as it is. If I'm touching it again, it will be to implement fire going out when it's raining.
Reply
Thanks given by: NiLSPACE
#18
Floody fluid simulator has been converted, too. Interestingly, it was easier than the fire simulator Smile

I tried to do some benchmarks to compare, how the direct chunk access influences the simulator speed, but was unable to measure any meaningful data, everything was too low, too close to the margin of error. I guess we won't know if it's good until we try to convert the redstone simulator.
Reply
Thanks given by:
#19
Sand simulator has been converted.

Also, I finally implemented that blocks falling on torches / rails etc. break into pickups. I even noticed that some blocks get overwritten by the falling block (sand falling on top of tall grass will remove the tall grass block), so that is implemented as well. Some blocks, such as half-slabs, cause all sand falling through them to convert into pickups, so I made sure that works, too.

It only needs some volunteer testers to test out all the possible combinations and if I forgot a combination, update the cSandSimulator functions:
Code:
/// Returns true if a falling-able block can start falling through the specified block type
static bool CanStartFallingThrough(BLOCKTYPE a_BlockType);
    
/// Returns true if an already-falling block can pass through the specified block type (e. g. torch)
static bool CanContinueFallThrough(BLOCKTYPE a_BlockType);
    
/// Returns true if the falling block rematerializing will replace the specified block type (e. g. tall grass)
static bool IsReplacedOnRematerialization(BLOCKTYPE a_BlockType);
    
/// Returns true if the specified block breaks falling blocks while they fall through it (e. g. halfslabs)
static bool DoesBreakFallingThrough(BLOCKTYPE a_BlockType);

And wait, there's more! I even added an "InstantFall" mode, in which the simulator doesn't create the falling entities, but instead makes the sand fall immediately (just like it was in the old versions of MCServer). The point of this mode is to have less strain on a server if it is too burdened.

Now I've gotta document all the new parameters in the wiki...

Done.

That means I've run out of simulators to rewriteTongue I'm not rewriting the ClassicFluidSimulator, that one's gonna go very soon, so there's only redstone left. Since Keyboard seems to have started working on mob AI, I guess I'll try converting the redstone simulator.
Reply
Thanks given by: NiLSPACE
#20
sand dropped on half slabs should break. but they should not break if the halfslab is a top-half slab. also sand breaks [mossy]cobblestone walls, Anvils but i think that is a bug becouse those blocks are not implented yet. further Signs, flower pods, levers, Wooden buttons, trapdoors, tripwire hooks, all rails should convert the sand into pickups
Reply
Thanks given by:




Users browsing this thread: 16 Guest(s)