Author Topic: 2.42.7 bugs/questions  (Read 7376 times)

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
2.42.7 bugs/questions
« on: July 03, 2006, 12:15:16 PM »
2.42.7
questions on energy management:

if I set the day/night cycle to 1000
and
Sun comes up if nrg < 1000000
[sun forced down not enabled]
and
start with a total energy or ~ 750000 ...
the sun is indeed 'forced up' until energy rises above 1000000.
then, the 1000 dy/night cycle seems to come into play.
so far, so good.
this is what I would expect.

however ...
if I try the same with
Sun goes down if nrg > 1500000
[Sun forced up not enabled]
I find it cycles 'around' the 1500000 setting ...
in as little as a single cycle ...
up, down, up, down, up, down ....
with the day/night cycle seeming to never
be allowed to come into play.

here's what I expected:
that if I set
Sun goes down if nrg > 1500000
and
Sun comes up if nrg < 1000000
that the energy would stay between those values ...
the sun forced down at 1500000 ...
the day/night cycle working in this area ...
the sun forced to rise if energy  fell below 1000000.
however ...
I again find it cycles 'around' the upper 1500000 setting ...
the sun rising/setting at nearly every cycle.
 
what am I misunderstanding here?

attaching the zipped sim where it does this ...
cycles around that upper setting.
it uses a MultiVeg and some bots
that circle clockwise ...
I can provide those if you need them ...
although I guess you can snag their dna.
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
2.42.7 bugs/questions
« Reply #1 on: July 03, 2006, 12:22:49 PM »
while experimenting with this Energy sim  ...
got:
Error. This array is fixed or temporily locked.
had the energy graph open
including the error.zip

if I get time later today ...
will run it thru VB ...
but I'm not very good at debugging unless
it points it out directly.
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
2.42.7 bugs/questions
« Reply #2 on: July 03, 2006, 12:46:39 PM »
oops!
in that sim ...  2427CW
change the veg/nrg per cycle to something less than 200 ...
I was using 20 but forgot to alter it and resave.
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
2.42.7 bugs/questions
« Reply #3 on: July 03, 2006, 01:18:40 PM »
The nrg limts sound liej they are working correctly.  When the sim nrg cross the 1500000 sun down threshold, the sun is forced down and the day/night cycle is paused.  When it drops below this limit, the normal cycle is allowed to continue.   You probably have the autotroph nrg/cycle set so that when the sun is up there is a sizable net nrg increase in the sim so even one cycle of sunlight will push the nrg back above the limit, forcing the sun down again and exhibiting the single cycle oscillation you describe for up to 2000 cycles (1000 cycles of sunlight) and then nightime will arrive and the sim nrg will go down until dawn.

The locked array thing is a bug with the re-dimensioning the Shots array.  Not sure yet why it has started happening - I didn't touch the code, probalby timing related - but I think the locking has to do with a routine lower down on the stack accessing the array while it is re-dimensioned higher up the stack.  It's timing dependent and dependent on the number of shots.  Once a sim reaches a stable high water mark on shots, it won't happen since the array size won't need to be further increased so if you hit the bug, you shoudl hit it pretty early in a sim.

I will post a buddy drop once I have a solid fix, probably Wednesday.
Many beers....

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
2.42.7 bugs/questions
« Reply #4 on: July 03, 2006, 01:42:29 PM »
Quote from: EricL
The nrg limts sound liej they are working correctly.  When the sim nrg cross the 1500000 sun down threshold, the sun is forced down and the day/night cycle is paused.  When it drops below this limit, the normal cycle is allowed to continue.   You probably have the autotroph nrg/cycle set so that when the sun is up there is a sizable net nrg increase in the sim so even one cycle of sunlight will push the nrg back above the limit, forcing the sun down again and exhibiting the single cycle oscillation you describe for up to 2000 cycles (1000 cycles of sunlight) and then nightime will arrive and the sim nrg will go down until dawn.
well ... I am having trouble seeing that ...
even with nrg/cycle set to 10.
with the day/night cycle disabled ... it certainly doesn't happen ...
as it is then always daylight between the upper/lower settings.
and with it enabled ...
it's as though the day/night cycle is reset to Sun Up every time
it drops below the upper limit ...
whereas it would be nice to have it be Night when comng 'down'.
it doesn't appear that the day/night count is independant ...
but is somehow reset by the sun up/down setpoints.
iow ... if I start a new sim with the day/night cycle set to 1000 ...
that 1000 doesn't begin to be counted until I go above the lower
energy level that is forcing the sun to be Up.
I can't tell if that happens when coming down from the upper limit ...
that should force the sun down.
 
if I were to set the day/night cycle to some very large value ...
might this give me a chance to see if it's working?
is there any limit?

maybe I'll be able to look at the code sometime this week ...
and see if I can finger out how you are doing this.
that's the only way it will make sense I guess ...
if I can somehow 'see' it.

if you've got a sim where you have observed it working ...
please zip it so I can see ... and believe.  

tanks
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
2.42.7 bugs/questions
« Reply #5 on: July 03, 2006, 02:04:34 PM »
if the sim nrg level triggers a threshold, the day/night cycle is paused.  if it is daytime with 500 cycles to go with you exceed the sun down threshold, once the energy drops below that you will still have 500 cycles to go until normal sunset.  If you pop back up again after only one cycle, then once you drop down again you will have 499 cycles of daylight to go, etc.
Many beers....

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
2.42.7 bugs/questions
« Reply #6 on: July 03, 2006, 04:00:44 PM »
well ...
perhaps that's how it happens ...
but I have yet to 'see it' do so.
mostly it just cycles and cycles and cycles ...
and I never do see the day/night cycle take control.

now why wouldn't one want to enforce nighttime ...
and actually begin the 500 [or whatever] cycles of night ....
once the upper energy level setpoint is reached?
and force sunrise in the same way at the lower setpoint?
that would avoid all that cycling around the setpoints.

or at least do so when one has the day/night cycling disabled ...
as it is always daytime with it disabled, is it not?
so as soon as the energy drops below the upper limit ...
we are back to full sunlight ...
which pushes the energy back up ...
and there we go with the blinkin' sun again.

with day/night cycle disabled ...
it would be nice to have the upper setpoint force the sun to set ...
and remain set until the lower setpoint forced it to rise again ...
and remain up until past the upper energy setpoint once more.
just like a sump pump works, ya know?
rather than all that cycling around either setpoint.

with day/night cycles enabled ....
well ... whatever ...
but it seems to me that even then ...
the correct status ...
sun up or down ...
and the cycle count ...
should be reset at that point as well.

can you steer me to the code/subroutines where this takes place?
or give me some variable names that I can search for?
I'd like to play with it a little bit ...
if for no other reason than to learn a little more about
how you have set it up, so it makes sense to me.

tanks
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
2.42.7 bugs/questions
« Reply #7 on: July 04, 2006, 01:01:24 AM »
From your description of what you are seeing, the feature is working as I intended though what I intended may of course, not be ideal or meet everyone's needs.

You suggest several new/different  options:

1) triggerring actual night (or day) early (if using day/night cycles) when the sun set threshold is reached (and vice versa) in effect speeding up time instead of pausing it
2) single toggle sun up and sun down "sump pump" thresholds which set the sun when the sun set nrg threshold is reached (and vice versa) but don't revert back to the previous sun state until and unless the other threshold is crossed

Both of these are viable, interesting and easily implementable.  I just didn't do it that way though adding the code to do so would be easy.  My thinking was simply to override whatever the regular sun state is, day/night cycles or not, while the nrg is above or below the speciifc threshold.  Then once the nrg comes back in line, resume whatever was happening (either perpetural daylight or carry on the sun rise/set cycles where we left off).  That's all the code does today.  If you want I could easily add the options you suggest in the next drop.

The interesting code to look at is in the feedvegs() routine in the Vegs module.
Many beers....

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
2.42.7 bugs/questions
« Reply #8 on: July 04, 2006, 08:57:46 AM »
yes ...
I understand your thinking with the overide ...
and yes, it does seem to function as intended ...
although a little difficult to 'see' as one never
knows for sure where the original rise/set sequence
is in it's timing when coming back out of 'overide' ...
and if in the 'wrong' phase ...
does result in this 'cycling' about the setpoint(s) ...
at either 'end', btw.
iow ... there are two systems attempting to control
whether the sun is up or down, and at times they
are in conflict. imo. ime.
to me, this results in 'interferring' or taking control
away from me as experimenter if I am trying to set
up a 'energy sim' in an effort to 'balance' forces
of energy in/out, with various bots, nrg/cycle,
costs, etc ... as my variables.
iow, I want control of all the variables.
I can't get consistant results, as my experimental
'system' keeps changing on it's own.

but that part is ok ...
the auto day/night cycle thing ...
I rarely use it anyway.
but the idea of using rise/set ...
and auto costs ...
to contol the sim as a whole is wonderful.
so here's where I have a problem ...
I had assumed when the day/night cycle is 'disabled' ...
(which is what I want to use) ...
that I could  then simply use the energy setpoints to control
the low and high limits of energy in the sim ...
that they did then indeed 'override' any rise/set cycle.
the 'low' one works fine ....
ie ... when below the setpoint, the sun is 'on'.
as energy increases and we go above the setpoint ...
no problem, the sun is still 'up', as with the day/night
cycle disabled, it's default is ON, eh?
and when the energy reaches the upper limit setpoint ...
the sun is forced down. wonderful!
but ... as soon as the energy drops back below that high limit ...
on comes the sun again, as this is the 'default' ...
sun always up.
and there I am stuck ... cycling about that point.
that's fine if that's what one wishes to do ...
but that could also be accomplished by bringing the low
and high setpoints close together.
so, although I don't like how the day/night cycle, when enabled,
works, imo, against the energy setpoints at times ...
that's ok. I can live with it.
but ... with day/night cycles disabled ...
the high setpoint does not allow the energy to come back
down below that upper limit.
that's what I was looking to do ...
and how I expected it to work.
that ... I would like to see.

will take a look at that feedvegs() routine

hey ... the energy graph is great!
watching it over a period of time ...
one can see if the 'system' is gaining/losing as a whole ...
and use this to adjust nrg input via vegs to 'fine tune' the sim.
this is exactly what I had hoped to be able to do ...
and this feedback is a great tool.
now if I could actually control this sun up/down thing ...
and have it consistantly do the same thing as a function
of energy alone, not as a function of time of rise/set ...
and get a stable sim going as a benchmark ...
then I can begin to see how altering costs affects it.

this is what I am looking for ...
a way to have control ...
ie ... be able to alter one variable at a time and monitor
the results on the 'system' as a whole.
the sun rise/set thing as it is ...
tends to take that control away.
that's my take, anyway ...
where I'm coming from ...
if you get my meaning ...
catch my dritft.

hey ...
DB is evoloving wonderfully ...
and has regained my attention ...
and I am once again excited with playing ...
to the detriment of getting out and doing the
things I should be doing, I should add ...
like gardening and fishing and being outdoors
enjoying the summer!!!!
is DB a blessing or a curse?
a little of both, I imagine.

thanks again for all the work ...
great stuff.
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline Griz

  • Bot Overlord
  • ****
  • Posts: 608
    • View Profile
2.42.7 bugs/questions
« Reply #9 on: July 04, 2006, 05:38:02 PM »
ok Eric ...
here's the routine.
I have a few questions ...  
as I don't know what all these variables do ...
and what others one might also have to consider ...
~~~

Code: [Select]
' gives vegs their energy meal
Public Sub feedvegs(totnrg As Long, totv As Integer)
  Dim n As node
  Dim t As Integer
  Dim tok As Single
  Dim depth As Long
  Dim daymod As Single
  Dim Energy As Single
  Dim body As Single
  Dim FeedThisCycle As Boolean
  Dim OverrideDayNight As Boolean
    
  Const Constant As Single = 0.00000005859375
  Dim temp As Single
  
  FeedThisCycle = True
  OverrideDayNight = False
ok. the following two portions of code are used to 'force' the sun up or down.
SimOpts.SunUp and SimOpts.SunDown are set to True (non-zero)
by checking the boxes for the upper and lower thresholds, yes?
Code: [Select]
  If SimOpts.SunUp Then
    If TotalSimEnergyDisplayed < SimOpts.SunUpThreshold Then
      FeedThisCycle = True ' Sim Energy has fallen below the threshold.  Let the sun shine!
      OverrideDayNight = True
    End If
  End If
  If SimOpts.SunDown Then
    If TotalSimEnergyDisplayed > SimOpts.SunDownThreshold Then
      FeedThisCycle = False ' Sim energy has exceeded our threshold.  Let the sun set!
      OverrideDayNight = True
    End If
  End If
now what variable,if any, does unchecking the box "Enable Day/Night" set?
SimOpts.DayNight ???
OverrideDayNight allows the SunUpSunDown to overide day/night cycles  ...
and that you are setting  from within the code.
what I am looking for is the variable that tells us the day/night cycle is checked
as disabled ... and would then allow the Thresholds to be the ONLY factor in
determining whether the sun is up/down ...
a switch that sets the sun if energy goes above the upper threshold ...
and KEEPs is set until the energy falls below the lower threshold ...
where it is reset to have the sun UP until energy once again rises
above the upper threshold ...
and bypasses the day/night cycles if they are disabled.
the routine below, it seems to me ...
is the day/night cycle is enabled ... ie  SimOpts.DayNight  true ...
and we are between the thresholds ...  Not OverrideDayNight
and therefore it goes back to the day/night clock.
Code: [Select]
  
  If SimOpts.DayNight And Not OverrideDayNight Then
      ' Well, we are neither above nor below the threshold or we arn't using thresholds so
      'lets see if it's time to rise and shine
      SimOpts.DayNightCycleCounter = SimOpts.DayNightCycleCounter + 1
      If SimOpts.DayNightCycleCounter > SimOpts.CycleLength Then
        SimOpts.Daytime = Not SimOpts.Daytime
        SimOpts.DayNightCycleCounter = 0
      End If
      If SimOpts.Daytime Then
        FeedThisCycle = True
      Else
        FeedThisCycle = False
      End If
  End If

so ... couldn't we then use a routine here ...
or perhaps before the day/night cycle one above ...
to allow the thresholds alone to control the sun,
when the day/night cycle is disabled?
and to then skip the above routine.
ie ...  along the lines of:
(I'm sure I have this messed up but you get the idea ...
with day/night disabled ...
only the thresholds control the sun ....
each switching it on or off ...
until the other resets it.
Code: [Select]
if Not SimOpts.DayNight  Then
  If SimOpts.SunUp Then
    If TotalSimEnergyDisplayed < SimOpts.SunUpThreshold Then
      FeedThisCycle = True ' Sim Energy has fallen below the threshold.  Let the sun  shine!      
    End If
  End If
  If SimOpts.SunDown Then
    If TotalSimEnergyDisplayed > SimOpts.SunDownThreshold Then
      FeedThisCycle = False ' Sim energy has exceeded our threshold.  Let the sun set!    
    End If
  End If
End If

just blindly feelin my way along
不知
~griz~
[/color]
   "The selection of Random Numbers is too important to be left to Chance"
The Mooj  a friend to all humanity
[/color]

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
2.42.7 bugs/questions
« Reply #10 on: July 05, 2006, 11:52:28 PM »
Griz,

I've implemented your suggestions for 2.42.8.  The new code is below.  It replaces the second code segment in your last post.  It's pretty well commented so you should be able to see what I did.  I've also attached the entire Vegs module so you can see the complete routine.  Note that simply using this and trying to compile won't work as the UI is in a different module.

In short, the new var SimOpts.SunThresholdMode is set via the UI and is used to determine what to do when the thresholds are exceeded.  The options in the UI set the var to one of the following three cases:

TEMPSUNSUSPEND - Does what it does today - only suspends the day/night cycles (if being used) whiel the thresholds are exceeded.

ADVANCESUN - advances the sun to dawn or dusk based on which threshold is crossed.

PERMSUNADVANCE - Bascially ignores the dayloght cycles and sump pumps between the thresholds.

To answer your specific question, the var SimOpts.DayNight indicates whether Day Cyles are being used.  It's True if they are and False if not and set via the UI checkbox.  The var SimOpts.Daytime indicates whether it is currently daytime or not.

Let me know if you have further questions.



Code: [Select]
  FeedThisCycle = SimOpts.Daytime 'Default is to feed if it is daytime, not feed if night
  OverrideDayNight = False
  
  If TotalSimEnergyDisplayed < SimOpts.SunUpThreshold And SimOpts.SunUp Then
    'Sim Energy has fallen below the threshold.  Let the sun shine!
    Select Case SimOpts.SunThresholdMode
      Case TEMPSUNSUSPEND:
        ' We only suspend the sun cycles for this cycle.  We want to feed this cycle, but not
        ' advance the sun or disable day/night cycles
        FeedThisCycle = True
        OverrideDayNight = True
      Case ADVANCESUN:
        'Speed up time until Dawn.  No need to override the day night cycles as we want them to take over.
        'Note that the real dawn won't actually start until the nrg climbs above the threshold since
        'we will keep coming in here and zeroing the counter, but that's probably okay.
        SimOpts.DayNightCycleCounter = 0
        SimOpts.Daytime = True
        FeedThisCycle = True
      Case PERMSUNSUSPEND:
        'We don't care about cycles.  We are just councing back and forth between the thresholds.
        'We want to feed this cycle.
        'We also want to turn on the sun.  The test below should avoid trying to execute day/night cycles.
        FeedThisCycle = True
        SimOpts.Daytime = True
    End Select
  ElseIf TotalSimEnergyDisplayed > SimOpts.SunDownThreshold And SimOpts.SunDown Then
    Select Case SimOpts.SunThresholdMode
      Case TEMPSUNSUSPEND:
        ' We only suspend the sun cycles for this cycle.  We do not want to feed this cycle, nor do we
        ' advance the sun or disable day/night cycles
        FeedThisCycle = False
        OverrideDayNight = True
      Case ADVANCESUN:
        'Speed up time until Dusk.  No need to override the day night cycles as we want them to take over.
        'Note that the real night time won't actually start until the nrg falls below the threshold since
        'we will keep coming in here and zeroing the counter, but that's probably okay.
        SimOpts.DayNightCycleCounter = 0
        SimOpts.Daytime = False
        FeedThisCycle = False
      Case PERMSUNSUSPEND:
        'We don't care about cycles.  We are just councing back and forth between the thresholds.
        'We do not want to feed this cycle.
        'We also want to turn off the sun.  The test below should avoid trying to execute day/night cycles
        FeedThisCycle = False
        SimOpts.Daytime = False
    End Select
  End If
  
  'In this mode, we ignore sun cycles and just bounce between thresholds.  I don't really want to add another
  'feature enable checkbox, so we will just test to make sure the user is using both thresholds.  If not, we
  'don't override the cycles even if one of the thresholds is set.
  If SimOpts.SunThresholdMode = PERMSUNSUSPEND And SimOpts.SunDown And SimOpts.SunUp Then OverrideDayNight = True
Many beers....

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
2.42.7 bugs/questions
« Reply #11 on: July 06, 2006, 07:00:05 AM »
It's been crashing on me quite a lot

I tried to run a South Pacific Sim but it has been giving me errors. An already errored sim is attached. I'll try to get one that will crash
« Last Edit: July 06, 2006, 07:00:34 AM by Elite »

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
2.42.7 bugs/questions
« Reply #12 on: July 06, 2006, 07:39:21 AM »
This sim has been 'caught in the act' of overflowing
« Last Edit: July 06, 2006, 07:39:36 AM by Elite »

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
2.42.7 bugs/questions
« Reply #13 on: July 06, 2006, 11:10:05 AM »
Whoops.  I had an operator switched in some overflow protection I added in a previous version in FrictionForces().  Now the overflow will actually be caught.

Link to 2.42.7a is here.  This drop also contains the new incoming energy modes as described previously in this topic.
Many beers....

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
2.42.7 bugs/questions
« Reply #14 on: July 06, 2006, 11:36:57 AM »
I'm getting an incredibly weird bug

Go to 'load simulation' and then exit the window. An error appears. After that all the bots get skewed horizontally in a funny way if you are zoomed in, and it only works for large sizes for some reason.

I've attached a picture of the phenomenon. The eye orbit and squiggle in the bot seems to have been compressed. They look 3D!
« Last Edit: July 06, 2006, 11:38:22 AM by Elite »