[crossfire] Extending apply commands

Mark Wedel mwedel at sonic.net
Sat Apr 30 01:14:21 CDT 2005


Kevin Rudat wrote:
>
     
      Some old discussions suggest 
     
     >
     
       * moving the apply command (text-command, not
     
     >
     
         protocol-command) to the client,
     
     >
     
     
     >
     
       * adding an apply_below to search only the floor,
     
     >
     
     
     >
     
       * adding some more verbs, e.g. 'eat' to search only food. 
     
     >
     
     
     >
     
      Questions:
     
     >
     
     
     >
     
       * Did someone write an apply_below already?
     
     
  Depending how this is done, this is problematic.

  One real problem right now is that objects in the ground are in a specific 
order.  This means that whenever an object on the ground is changed, the entire 
stack of objects has to be resent.  The ideal case would be to not make this the 
case - handle the floor just like the inventory is handled, and let the client 
order the objects as needed - this then means if an object on the ground 
changes, only that object has to change.

  An apply_below on the client side coudl be done, which could just send a list 
of objects (in the order the client knows them at) to the server. Eg, something 
like:

apply <tag1><tag2><tag3>...

  And the apply just stops once it gets one it can actually apply.

  Then, it'd be easy to write a 'bottom up apply' as well as a 'top down' apply. 
  As well as interacting better with the 50 item groupings.

>
     
     
     >
     
       * What if I wrote a patch for adding client_types for a number of
     
     >
     
         applyable things that don't have one?
     
     
  I don't have a problem with that.  Be aware that the client_type shouldn't 
give away any information the player wouldn't know (generally not a problem, as 
most objects are pretty obvious for what they are).

>
     
     
     >
     
      Moving these things to the client:
     
     >
     
     
     >
     
       * Does anyone know why (who decided) when you've got a lot of things on the floor,
     
     >
     
         you can only see fifty of them?
     
     >
     
     
     >
     
         Makes it impossible to search the entire floor (not important enough to
     
     >
     
         worry about? Have any script authors run into this?)
     
     >
     
     
     >
     
         (The limits are implemented in socket/item.c::esrv_draw_look(); 
     
     >
     
         scrolling's in socket/item.c::ApplyCmd().)
     
     
  Preston basically got it right.  There are limits to the amount of data that 
can be sent to the client at once - sending more than that fills up the buffer, 
and the server drops the connection once it gets full.

  The other problem is related to what I mention above - since objects have to 
be in a specific order, it gets to be a problem to try to send the data as 
multiple packets.

  The client/script could of course do the apply to get the next group of items.

  there is also an item in the TODO list to have objects spell over.  Eg, if you 
have a pile of 5000 coins, it'd spill over to other spaces, so that one space 
maybe has 2000 coins, and the neighboring spaces 1000 each (or something like 
that).  This imposes additional load on the server, and almost certainly, has to 
be done on a per different (non mergable) object - otherwise, could have 
problems activating altars.

>
     
     
     >
     
     
     >
     
       * I haven't thought this through completely, but what about a very general apply
     
     >
     
         protocol command:
     
     >
     
     
     >
     
         apply_specific <environments><tag><tag2>...
     
     >
     
                        <client types><type><type2>...
     
     >
     
                        <search string>
     
     >
     
     
     >
     
         player types apply: apply_specific 1 <floor> 0 ''
     
     >
     
         player types apply foo: apply_specific 1 <player> 0 'foo'
     
     >
     
         apply_below foo: apply_specific 1 <floor> 0 'foo'
     
     >
     
         sleep: apply_specific 1 <floor> 1 <savebed> ''
     
     >
     
         drink power: apply_specific 1 <player> 2 <drink> <potion> 'power'
     
     
  But there is no reason that couldn't be done on the client right now.

  IMO, the only reason that some matching/pickup is done on the server is simply 
synchronization issue as Preston describes.  For things like apply, there 
shouldn't be that issue - certainly not for anything in the players inventory. 
The client knows the environments, knows the names, knows client_id types, so it 
would seem to me that could easily be done on the client - client just parses 
the options, and then figures out what item(s) actually match.

  But this would go a bit above with allowing apply to operate on multiple 
objects and stops once it gets one in can apply.



    
    


More information about the crossfire mailing list