Combat System Overhaul

Posted by Maleficusu on Fri 15 Feb 2013 04:37 AM — 8 posts, 30,325 views.

#0
Hello everyone,

I'm pretty new to the smaug codebase and coding in general. I have been working for a couple weeks with a group of dedicated builders on my mud to get it both operation-able and presentable to new audiences. The biggest issue now however would be reworking the combat system. I am trying to figure out exactly how to stop the autonomous combat system so that I can rework it into becoming a Manual, give & take sort of system where if i were to type 1 and enter, I would swing at a target for instance. If anyone could help me with that it'd be much appreciated. We are working on Smaug 1.9. Any snippets or info on actually stopping autonomous combat would also be appreciate if you do not know how to recode it personally.
Australia Forum Administrator #1
It's been a while since I looked at the code, but I'm pretty sure that a combat round is initiated on a "tick" based on a timer.

Look at violence_update in fight.c, called by update_handler in update.c.

If you commented out these lines:


  if( --pulse_violence <= 0 )
   {
      pulse_violence = PULSE_VIOLENCE;
      violence_update(  );
   }



Then some or all of the automatic fighting would be removed, and then you could do it manually.
#2
I'm having a problem understanding how to make changes when I'm running the mud locally... the smaug.exe file should make any changes I make in the code, in the mud no? Like, I can delete fight.c and run the smaug.exe again and nothing happens.......
#3
Im not really sure if this is done correctly, but these are the code snippets commented out from 1976 to 2015. However Ive tested it offline on a test character and mobiles and autokill is still active.


}/*
if( --pulse_mobile <= 0 )
{
pulse_mobile = PULSE_MOBILE;
mobile_update( );
}

if( --pulse_violence <= 0 )
{
pulse_violence = PULSE_VIOLENCE;
violence_update( );
}
*/

if( --pulse_time <= 0 )
{
pulse_time = sysdata.pulsecalendar;
char_calendar_update( );
}

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

auth_update( ); /* Gorog */
time_update( ); /* If looking for slower passing time, move this to just above char_calendar_update( ); */
UpdateWeather( ); /* New Weather Updater -Kayle */
hint_update( );
char_update( );
obj_update( );
clear_vrooms( ); /* remove virtual rooms */
}
/*
if( --pulse_second <= 0 )
{
pulse_second = PULSE_PER_SECOND;
char_check( );
check_dns( );
reboot_check( 0 );
}*/
Australia Forum Administrator #4
Perhaps read this:

http://www.gammon.com.au/smaug/howtocompile.htm

You can't just delete a .c file and hope things will change.
#5
Hmm, I'm really not sure I'm understanding this.


So, these lines were commented out in update.c as you suggested.

/*if( --pulse_violence <= 0 )
{
pulse_violence = PULSE_VIOLENCE;
violence_update( );
}*/

However on booting, the fighting is still completely automated; tested on other npcs and on pcs. I feel that I am doing something wrong or simply not grasping the concept. Is there a number I'm supposed to be changing, something I'm supposed to be deleting perhaps? Or would I have to somehow redefine pulse_violence to mean something completely different?
#6
Also I want to note that this is all being tested on an Offline server that runs the Smaug.exe locally from smaugFuss/area if that helps at all
Australia Forum Administrator #7
Did you recompile smaug.exe? The date/time stamp of smaug.exe has to be later than the one of update.c (where you made the changes) or you didn't do that.

The server does not run source code, it runs compiled object code.