Subject: "CF Performance" Previous topic | Next topic
Printer-friendly copy Email this topic to a friend CF Website
Top General Discussions Gameplay Topic #24457
Show all folders

ZulghinlourFri 17-Apr-09 12:17 AM
Member since 04th Mar 2003
9792 posts
Click to send email to this author Click to send private message to this author Click to view this author's profile Click to add this author to your buddy list
#24457, "CF Performance"


          

So I continue re-factoring code to make this a smooth running beast. One of the benefits I've seen already is that TICKS actually happen closer to when they should (between 15-45 seconds). Just one of the things I'm now keeping an eye on.

I've added in goals & validation around all functions in our update_handler() function (this basically is what runs the game). If any function exceeds the goals I've set all the IMPs get notified, so we can go make appropriate changes. As of now, the majority of functions have a target goal of 0.03 seconds, there are a few that do the most grunt-work that have a target goal of 0.25 seconds (like mobile_update() which does various things to every mob/character in the game every 4 seconds, and char_update() which is the function that takes care of the TICK for every mob/character).

Right now my hope is to keep the goals less than 0.25 seconds, and add new functionality as necessary to meet those goals.

I know of about a dozen or more things that don't meet these goals right now, and I'm slowly working through them.

So long, and thanks for all the fish!

  

Alert | IP Printer Friendly copy | Reply | Reply with quote | Top

Reply FYI:, Daevryn, 24-Apr-09 01:27 PM, #10
Reply RE: FYI:, Isildur, 24-Apr-09 02:04 PM, #11
     Reply RE: FYI:, Daevryn, 24-Apr-09 02:24 PM, #12
          Reply Mmmm...Thunderdome (n/t), Zulghinlour, 24-Apr-09 02:46 PM, #13
          Reply What language would you use? /nt, Rodriguez, 24-Apr-09 05:13 PM, #14
          Reply Probably C#, Daevryn, 24-Apr-09 05:20 PM, #15
               Reply Dude, N b M, 24-Apr-09 07:58 PM, #16
                    Reply C (n/t), Zulghinlour, 24-Apr-09 08:09 PM, #17
          Reply Two bits enter, one bit leaves! nt, vargal, 25-Apr-09 05:06 AM, #18
Reply I sort of posted about this several years ago., Dallevian, 18-Apr-09 12:05 PM, #9
Reply Thanks Zulgh, definitely noticed the improvement. n/t., TheDude, 17-Apr-09 09:34 PM, #8
Reply Another thought, Dwoggurd, 17-Apr-09 04:25 AM, #4
Reply RE: Another thought, Zulghinlour, 17-Apr-09 12:43 PM, #5
     Reply Re, Dwoggurd, 17-Apr-09 06:05 PM, #7
Reply RE: CF Performance, Isildur, 17-Apr-09 12:30 AM, #1
     Reply RE: CF Performance, Zulghinlour, 17-Apr-09 12:34 AM, #2
          Reply RE: CF Performance, Asthiss, 17-Apr-09 01:53 AM, #3
          Reply RE: CF Performance, Isildur, 17-Apr-09 12:44 PM, #6

DaevrynFri 24-Apr-09 01:27 PM
Member since 13th Feb 2007
11117 posts
Click to send email to this author Click to send private message to this author Click to view this author's profile Click to add this author to your buddy list
#24549, "FYI:"
In response to Reply #0


          

I spent most of last night on some fairly mindless refactoring of a handful of things that don't run very fast into equivalents that run faster. Some of these things happen at the tick, some more often.

I don't expect any of it to have near the impact that the stuff Zulg has done to this point did, but that code should be live soon-ish and we'll see. I figured it made sense to start with the things I knew how to do and knew really should have been done a different way.

  

Alert | IP Printer Friendly copy | Reply | Reply with quote | Top

    
IsildurFri 24-Apr-09 02:04 PM
Member since 04th Mar 2003
5969 posts
Click to send email to this author Click to send private message to this author Click to view this author's profile Click to add this author to your buddy list
#24550, "RE: FYI:"
In response to Reply #10


          

Any idea on what's causing the frequent crashes? Bug introduced w/ Zulg's recent performance fixes?

  

Alert | IP Printer Friendly copy | Reply | Reply with quote | Top

        
DaevrynFri 24-Apr-09 02:24 PM
Member since 13th Feb 2007
11117 posts
Click to send email to this author Click to send private message to this author Click to view this author's profile Click to add this author to your buddy list
#24551, "RE: FYI:"
In response to Reply #11


          

Mostly no (I know where things are crashing, but not what went wrong at some indeterminate point or process before that to cause it) though I have a theory or at least an observation I need to remember to talk through with Zulg at some point.

I swear, if I had a year and nothing to do I'd rewrite CF in a "modern" language just to get away from C's Thunderdome style of memory management.

  

Alert | IP Printer Friendly copy | Reply | Reply with quote | Top

            
ZulghinlourFri 24-Apr-09 02:46 PM
Member since 04th Mar 2003
9792 posts
Click to send email to this author Click to send private message to this author Click to view this author's profile Click to add this author to your buddy list
#24552, "Mmmm...Thunderdome (n/t)"
In response to Reply #12


          

n/t

So long, and thanks for all the fish!

  

Alert | IP Printer Friendly copy | Reply | Reply with quote | Top

            
RodriguezFri 24-Apr-09 05:13 PM
Member since 30th Jan 2005
367 posts
Click to send email to this author Click to send private message to this author Click to view this author's profile Click to add this author to your buddy list Click to send message via ICQ
#24553, "What language would you use? /nt"
In response to Reply #12


          

nt

  

Alert | IP Printer Friendly copy | Reply | Reply with quote | Top

                
DaevrynFri 24-Apr-09 05:20 PM
Member since 13th Feb 2007
11117 posts
Click to send email to this author Click to send private message to this author Click to view this author's profile Click to add this author to your buddy list
#24554, "Probably C#"
In response to Reply #14


          

But that's mostly personal familiarity/preference.

Also, if Visual Studio pisses me off, I can swear at Zulg.

  

Alert | IP Printer Friendly copy | Reply | Reply with quote | Top

                    
N b MFri 24-Apr-09 07:58 PM
Member since 29th Sep 2005
444 posts
Click to send email to this author Click to send private message to this author Click to view this author's profile Click to add this author to your buddy list
#24555, "Dude"
In response to Reply #15


          

What is cf actually written with, and what languages are compatible with it.

I am actually delving into C#, all the dif browser languages, Vstudio, SQL, etc..., for work

  

Alert | IP Printer Friendly copy | Reply | Reply with quote | Top

                        
ZulghinlourFri 24-Apr-09 08:09 PM
Member since 04th Mar 2003
9792 posts
Click to send email to this author Click to send private message to this author Click to view this author's profile Click to add this author to your buddy list
#24556, "C (n/t)"
In response to Reply #16


          

n/t

So long, and thanks for all the fish!

  

Alert | IP Printer Friendly copy | Reply | Reply with quote | Top

            
vargalSat 25-Apr-09 05:06 AM
Member since 07th Apr 2004
384 posts
Click to send email to this author Click to send private message to this author Click to add this author to your buddy list
#24557, "Two bits enter, one bit leaves! nt"
In response to Reply #12


          

nt

  

Alert | IP Printer Friendly copy | Reply | Reply with quote | Top

DallevianSat 18-Apr-09 12:05 PM
Member since 04th Mar 2003
1620 posts
Click to send email to this author Click to send private message to this author Click to view this author's profile Click to add this author to your buddy list
#24492, "I sort of posted about this several years ago."
In response to Reply #0


          

http://forums.carrionfields.com/dc/dcboard.php?az=show_topic&forum=6&topic_id=15243

I knew the ticks were coming slower.

Thanks Zulgh, youdaman.

  

Alert | IP Printer Friendly copy | Reply | Reply with quote | Top

TheDudeFri 17-Apr-09 09:34 PM
Member since 20th Sep 2005
283 posts
Click to send email to this author Click to send private message to this author Click to view this author's profile Click to add this author to your buddy list
#24489, "Thanks Zulgh, definitely noticed the improvement. n/t."
In response to Reply #0


          

nntt

  

Alert | IP Printer Friendly copy | Reply | Reply with quote | Top

DwoggurdFri 17-Apr-09 04:25 AM
Member since 20th Jan 2004
668 posts
Click to send email to this author Click to send private message to this author Click to add this author to your buddy list
#24461, "Another thought"
In response to Reply #0


          

Several big functions may not fit 0.25s (a pulse time?).
Did you guys consider splitting them into several smaller pieces and spear across different pulses within a tick?
For example you could update all characters and mobile hps at a tick front and move mobiles in the next pulse. Then update weather and area repops in a consequent pulse, etc?
While, certainly, some things can't be split, I think there are opportunities where you could actually do different updates in different pulses even if it implies slightly changed game mechanics (different != bad).

  

Alert | IP Printer Friendly copy | Reply | Reply with quote | Top

    
ZulghinlourFri 17-Apr-09 12:43 PM
Member since 04th Mar 2003
9792 posts
Click to send email to this author Click to send private message to this author Click to view this author's profile Click to add this author to your buddy list
#24465, "RE: Another thought"
In response to Reply #4


          

>Several big functions may not fit 0.25s (a pulse time?).

That's why I'm tracking the data...to find out.

>Did you guys consider splitting them into several smaller
>pieces and spear across different pulses within a tick?

Right now, the functions that are causing things to be out of whack are because they are written poorly, and have been easily refactored into the existing infrastructure. If I get to a point where that is not the case, I'll think about it. I agree different != bad, but there are also things to keep in mind like "Will people be able to determine a tick is coming if XYZ always happens here", which used to be the case with some things.

So long, and thanks for all the fish!

  

Alert | IP Printer Friendly copy | Reply | Reply with quote | Top

        
DwoggurdFri 17-Apr-09 06:02 PM
Member since 20th Jan 2004
668 posts
Click to send email to this author Click to send private message to this author Click to add this author to your buddy list
#24481, "Re"
In response to Reply #5
Edited on Fri 17-Apr-09 06:05 PM

          

>but there are also things to keep in
>mind like "Will people be able to determine a tick is coming
>if XYZ always happens here", which used to be the case with
>some things.

Yep. That may be an issue. So it make sense to keep important things (like hp updates) several pulses ahead of less important things (like weather change).

PS. And notice, that I don't propose to parallelize CF code and move to a fancy multi-core Nehalem-based server

  

Alert | IP Printer Friendly copy | Reply | Reply with quote | Top

IsildurFri 17-Apr-09 12:30 AM
Member since 04th Mar 2003
5969 posts
Click to send email to this author Click to send private message to this author Click to view this author's profile Click to add this author to your buddy list
#24458, "RE: CF Performance"
In response to Reply #0


          

Nice. Any idea what the overhead is for the run-time performance checks? Seems like something you'd eventually want to disable once you clean up all the current problem functions. Then just enable it periodically to see if any new ones have started misbehaving.

I hate "back seat coders" though, so I'll shut up now.

  

Alert | IP Printer Friendly copy | Reply | Reply with quote | Top

    
ZulghinlourFri 17-Apr-09 12:34 AM
Member since 04th Mar 2003
9792 posts
Click to send email to this author Click to send private message to this author Click to view this author's profile Click to add this author to your buddy list
#24459, "RE: CF Performance"
In response to Reply #1


          

>Nice. Any idea what the overhead is for the run-time
>performance checks? Seems like something you'd eventually
>want to disable once you clean up all the current problem
>functions. Then just enable it periodically to see if any new
>ones have started misbehaving.

Right now it seems negligible (set a clock_t before calling the function, set a clock_t after calling the function, subtract the clocks and compare against the goal, and report).

I'm actually inclined to leave them in if the overhead continues to prove to be minimal, because I'd rather have some checks in for new code that gets added without having to code review everything anyone checks in, and I'd be curious how some of these functions scale based on the number of players online.

So long, and thanks for all the fish!

  

Alert | IP Printer Friendly copy | Reply | Reply with quote | Top

        
AsthissFri 17-Apr-09 01:53 AM
Member since 26th Oct 2004
191 posts
Click to send email to this author Click to send private message to this author Click to view this author's profile Click to add this author to your buddy list
#24460, "RE: CF Performance"
In response to Reply #2


          

I LOVE YOU ZULG!

(and you other Imms working in the dark and letting Zulg take all the credit )

  

Alert | IP Printer Friendly copy | Reply | Reply with quote | Top

        
IsildurFri 17-Apr-09 12:44 PM
Member since 04th Mar 2003
5969 posts
Click to send email to this author Click to send private message to this author Click to view this author's profile Click to add this author to your buddy list
#24466, "RE: CF Performance"
In response to Reply #2


          

I just meant to put them all in #ifdef blocks so you could enable/disable the whole set en masse without much effort.

But yeah...if the overhead isn't high and if those functions' performance isn't static then having them there all the time is probably the right way to go.

  

Alert | IP Printer Friendly copy | Reply | Reply with quote | Top

Top General Discussions Gameplay Topic #24457 Previous topic | Next topic