Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Yandex, Yahoo!, Google, Bing

Members: 0
Guests: 10
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » LoP Codebase » a couple newbie questions abo...
Forum Rules | Mark all | Recent Posts

a couple newbie questions about time
< Newer Topic :: Older Topic > lop1.40

Pages:<< prev 1 next >>
Post is unread #1 Jul 4, 2011, 4:05 am
Go to the top of the page
Go to the bottom of the page

rinlek
Fledgling
GroupMembers
Posts5
JoinedApr 30, 2011

i'm using lop 1.40 and i have 2 questions about time withing this code.

first, how do you slow down the time in game, i want to make my game so that 1 day real life is 2 days in game. the current setup goes way to fast. i've tried to play around with the code, but nothing i've done seems to work.

second, how do i adjust the system time the mud shows when you type time?

thanks for any help
       
Post is unread #2 Jul 4, 2011, 7:55 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
JoinedJul 26, 2005

To modify how fast the time is in the game take a look at the time_update in timeinfo.c it is called in update.c if you want to see how often it is called. If I was going to slow it down Id just add a new int that it counts up every time and just once in awhile for it allow it to get to the normal time_update.
I think it still more or less does stock smaug time updating which is about something like one day every 15 mins or so. Been quite awhile since I looked into it lol.

Well it uses the normal system time, but I tossed in something in comm.c in the main function to modify it a bit to show EDT.
   current_time = ( time_t ) now_time.tv_sec;
   current_time += ( time_t ) TIME_MODIFY; /* Increase it to EDT */

mud.h has this
#define TIME_MODIFY          0 /* Done in seconds, Modifies current_time to what you want the time displayed in */

So it isn't actually affecting it, but it gives you a way to modify it easier if needed. So if you want it to add an hour change TIME_MODIFY to 3600 (is 60*60) Hope that helps.
       
Post is unread #3 Jul 5, 2011, 5:55 am
Go to the top of the page
Go to the bottom of the page

rinlek
Fledgling
GroupMembers
Posts5
JoinedApr 30, 2011

i was able to adjust the system time thanks to what you posted remcon but i can't seem to find the spot in timeinfo.c or update.c to adjust the passage of time in game. would you be able to tell me what line to look at or show me the code i need to find please?
       
Post is unread #4 Jul 5, 2011, 1:33 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
JoinedJul 26, 2005

Its the time_update function its only real function is to increase mud time. Ill post in example code later
       
Post is unread #5 Jul 5, 2011, 5:05 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
JoinedJul 26, 2005

Found in timeinfo.c
/* update the time */
void time_update( void )
{
   AREA_DATA *pArea;
   DESCRIPTOR_DATA *d;
   WEATHER_DATA *weath;
   MONTH_DATA *month;
   DAY_DATA *day;
   char *hmessage;
   int mday = 0, mmonth = 0;

   switch( ++time_info.hour )
   {
      case 5:
      case 6:
      case 12:
      case 19:
      case 20:
         for( pArea = first_area; pArea; pArea = ( pArea == last_area ) ? first_build : pArea->next )
            get_time_echo( pArea->weather );

         for( d = first_descriptor; d; d = d->next )
         {
            if( d->connected == CON_PLAYING && is_outside( d->character ) && is_awake( d->character ) )
            {
               weath = d->character->in_room->area->weather;
               if( !weath->echo )
                  continue;
               set_char_color( weath->echo_color, d->character );
               send_to_char( weath->echo, d->character );
            }
         }
         break;

      case 24:
         time_info.hour = 0;
         time_info.day++;
         time_info.wday++;
         if( ( hmessage = show_holiday( ) ) )
         {
            for( d = first_descriptor; d; d = d->next )
            {
               if( d->connected == CON_PLAYING )
                  ch_printf( d->character, "%s\r\n", hmessage );
            }
         }
         break;
   }

   update_sunlight( );

   if( !( month = get_mdata( time_info.month ) ) )
   {
      bug( "%s: invalid month!!!!", __FUNCTION__ );
      return;
   }

   for( day = first_day; day; day = day->next )
      mday++;

   if( time_info.wday > mday )
      time_info.wday = 1;

   if( time_info.day > month->days )
   {
      time_info.day = 1;
      time_info.month++;
      give_interest( );
   }

   for( month = first_month; month; month = month->next )
      mmonth++;
 
   if( time_info.month > mmonth )
   {
      time_info.month = 1;
      time_info.year++;
   }

   /* Shouldn't be to bad to save it each update */
   save_timeinfo( );
}

The ++time_info.hour is where it is increasing the hour on the mud and it does so everytime time_update is called. You have a few different things you can do but the easiest way is to just change the amount of time time_info.hour is updated or you can even add in another part in time like mins and just up a min each time it is called and then update the mud hour every so many mins till you find the time you like. Just watch how fast the hours go by and if you went with 2 mins before an hour passed then it would be an hour passing half as fast. etc.... Let me know the kind of way you want to go with it and if you need some extra help I'll help out.

Another way is changing in update.c
find
   if( --pulse_point <= 0 )
   {
      pulse_point = number_range( ( int )( PULSE_TICK * 0.75 ), ( int )( PULSE_TICK * 1.25 ) );

      auth_update( );  /* Gorog */
      time_update( );
      weather_update( );
      char_update( );
      obj_update( );
   }

change it to this
   if( --pulse_point <= 0 )
   {
      pulse_point = number_range( ( int )( PULSE_TICK * 0.75 ), ( int )( PULSE_TICK * 1.25 ) );

      auth_update( );  /* Gorog */
      weather_update( );
      char_update( );
      obj_update( );
   }

   {
      static int pulse_slowtime;

      if( --pulse_slowtime <= 0 )
      {
         pulse_slowtime = number_range( ( int )( PULSE_TICK * 1.75 ), ( int )( PULSE_TICK * 2.25 ) );
         time_update( );
      }
   }

for example that is. You can change the multiplying or just go with some other range etc....
       
Post is unread #6 Jul 10, 2011, 5:51 am
Go to the top of the page
Go to the bottom of the page

rinlek
Fledgling
GroupMembers
Posts5
JoinedApr 30, 2011

this is what i was looking for, thanks for the help remcon. your a life saver.

btw lop is one of the best codebases i've seen.
       
Post is unread #7 Jul 10, 2011, 3:40 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

Yeah LOP is a really good codebase. Plus Remcon is really helpful. I like the fact that he took alot of the broken systems and fixed them up. I use alot of things from his codebase in my own. I also plan on using LOP as a base for a naruto or bleach mud when I finish the current project I am working on.
       
Post is unread #8 Jul 10, 2011, 7:57 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
JoinedJul 26, 2005

Thanks, glad it is being enjoyed in part or in whole. :)
       
Pages:<< prev 1 next >>