Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Arrrr Me Hearty! Sailing the Seas of DRb in a Shoe

Arrrr Me Hearty! Sailing the Seas of DRb in a Shoe

You insouciant scalawags will share the experience of a lifetime as you play a game built atop DRb and Shoes based generally upon the phenomenon known as Spaceteam! Except with Pirates!!

Join us as we skirt the treacherous shoals of DRb, learning techniques that will allow you to navigate it like you were born on the high seas!

Dig for the buried treasure of Rinda to discover the mysterious secrets of the RingProvider and TupleSpace!

Storm the fortress of Shoes and learn about it’s secret trapdoors and avoid the dungeons!

Team up with your fellow attendees to plunder the high seas and avoid the Curse of the Live Demo! Yarrrr….☠

Davy Stevenson

November 09, 2013
Tweet

More Decks by Davy Stevenson

Other Decks in Programming

Transcript

  1. ARRRR ME HEARTY! Sailing the Seas of DRb in a

    Shoe Davy Stevenson Eric Hodel Rein Henrichs @davystevenson @drbrain @reinh RubyConf 2013
  2. Why Rinda? Flexible Automatic discovery No explicit destination? Throw it

    in the tuplespace Farmhouse and Roosting Birds at Dusk by Trey Ratcliff
  3. Why Shoes? Needs some love and attention Perfect showcase for

    distributed code Support non-web Ruby development! Freestyle Converse by Daniele Margaroli
  4. Preparation Install jruby (1.7.4-6 all should work) Install shoes4 $

    git clone https://github.com/shoes/shoes4 $ git checkout 7d0a1ee $ gem build shoes.gemspec $ gem install shoes-4.0.0.pre1 $ alias shoes4='/path/to/shoes4/bin/shoes' Install pirate_game $ gem install pirate_game
  5. DRb RMI for Ruby Written by Masatoshi SEKI require ‘drb’

    Remote objects act like local objects It’s “Ruby Throated” Tuesday! by MrClean1982
  6. Remote Array Server array = [] # share the array

    DRb::DRbServer.new nil, array # print the URI (we let DRb pick) puts DRb.uri # wait for ^C DRb.thread.join
  7. Remote Array Peer # create remote array reference remote_array =

    DRbObject.new_with_uri ARGV.shift # append to remote array remote_array << "a" remote_array.push "b", "c"
  8. Remote Array Peer # create remote array reference remote_array =

    DRbObject.new_with_uri ARGV.shift puts remote_array.join ", " # => a, b, c
  9. Rinda Linda for Ruby Model for distributed programming require ‘rinda/

    tuple_space’ Stores tuples with arbitrary data write, take, read Quasicabinet by Aranda\Lasch
  10. Tuple Space # blocking operation with template @ts.take [:button, "Keel",

    (now...now + 30), nil] # writing a matching tuple unblocks @ts.write [:button, "Keel", Time.now.to_i, DRb.uri]
  11. Shoes Created by _why Simple cross- platform GUI toolkit for

    Ruby Shoes4 is an all- Ruby rewrite Still under active development Blue Power! by Éole Wind
  12. Shoes Manual Layout Input elements Drawing Animate / Move /

    Events http://shoesrb.com/manual/Hello.html
  13. Display Issues Not all movement methods have been implemented on

    all types of objects Can move, but not displace Width/height =( Show/hide/toggle missing =(
  14. Animations Animations run in parallel Need to manually manage them

    start, stop, remove PROTIP™: Separate drawing from animation
  15. pirate_command PirateCommand.generate => "Swab the Poop Deck" PirateCommand.action => "Batten"

    PirateCommand.thing => "Main Sail" PirateCommand.exclaim => "Ahoy" PirateCommand.exclaim! => "Shiver me Timbers!"
  16. Game Architecture? Does exactly what the GM instructs Game Master

    Game Handles all logic Issue cmds to game, game sends response
  17. Layout Generation GM sends each game their bridge and list

    of all bridge items my_items all_items my_items all_items direct DRb
  18. Action & Response watch for button click on button click

    [:button, ‘Keel’, timestamp, from] write take (blocks) watch for actions take (blocks)
  19. Action & Response watch for button click [:button, ‘Keel’, timestamp,

    from] take (blocks) watch for actions take (blocks)
  20. Action & Response watch for button click watch for actions

    take (blocks) write [:action, ‘Keel’, timestamp, from]
  21. Action & Response watch for button click watch for actions

    take (blocks) [:action, ‘Keel’, timestamp, from]
  22. Enough Jibber Jabber Let’s get to the important parts GAME

    TIME Shut up you fool! by Andre Vandal
  23. Preparation (again) Install jruby (1.7.4-6 all should work) Install shoes4

    $ git clone https://github.com/shoes/shoes4 $ git checkout 7d0a1ee $ gem build shoes.gemspec $ gem install shoes-4.0.0.pre1 $ alias shoes4='/path/to/shoes4/bin/shoes'
  24. RingServer Someone needs to run a ringserver $ ring_server But

    not too many Try not to screw it up We are working on it
  25. Game Master Only one needed per game Pick a good

    name If GM crashes, game is stranded =(
  26. Find Your Game ISSUE: If join fails you will not

    receive an error message and will enter empty disconnected pub =(
  27. Pirate Pub Chat with your friends in the Pirate Pub*

    *Yes, you have to click the ‘Send’ button. No keybindings?!? =(
  28. Pirate Pub ISSUE: At the moment the GM needs to

    trigger each stage. Future development should switch over to Spaceteam-like mechanism where each player indicates that they are ready to proceed
  29. Sail the High Seas Keep the ship afloat! Work together

    to man the ship Beware of bad weather!
  30. Access Control List Deny or allow by IP address and

    range Difficult to manage No privacy
  31. drbdump tcpdump for DRb Message sends Message latency Message allocations

    Colorful toy trucks parked together in rows by Horia Varlan
  32. Running Basic drbdump Summary of 10,000 messages drbdump -q -n

    -c 10000 Listen only on loopback drbdump -i lo0
  33. Basic Statistics 1508 total packets captured 0 Rinda packets captured

    56 DRb packets captured 30 messages sent 26 results received 2 exceptions raised
  34. Message Statistics Messages sent min, avg, max, stddev: call (1

    args) 10 sent; 3.0, 6.2, 19.0, 6.7 allocations; 0.285, 1.479, 7.258, 2.171 ms