wiki:Ruby Client Tutorial

Version 2 (modified by kedwar10, 13 years ago) (diff)

--

Getting Started

This client implements a subset of the features found on the Clojure client. All commands in this client block until completion.

To run the client, open up a terminal and cd to the top level directory and type

bash-4.2$ sh run
irb(main):001:0> 

This script will load core.rb and start the ruby interpreter. To open up a map use the 'ioquake' function with a mapname.

irb(main):001:0> ioquake 'sat'

ioquake should now be running in a separate process. Set the fullscreen option to false in setup if ioquake is maximized. Now hit ` to free the cursor from ioquake. A new quagent can be added by calling Quagent.new (this may take several tries):

irb(main):007:0> q1 = Quagent.new
=> #<Quagent:0xb7696538 @conn=#<TCPSocket:0xb76964d4>>
irb(main):008:0> Quagent connected at socketfd 30.
loaded skill 1 from bots/default_c.c
loaded skill 1 from bots/sarge_c.c
loaded bots/sarge_i.c
loaded bots/sarge_w.c
loaded sarge from bots/sarge_t.c
ev jo 1 quagent


Organization of Code

  • util.rb : general functions.
  • protocol_one.rb : contains the quagent class which interfaces with protocol zero.
  • commands.rb : contains user-friendly wrappers for common protocol zero commands.
  • core.rb : general workbench; load this file when using irb.

Defining Commands


Operating Multiple Quagents


Issues

  • Loading a quagent into the virtual environment sometimes takes several tries.