Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Illustrated Adventure Survival Guide for New Rustaceans and Natives of Rubyville

515 views

Published on

OSCON 2017

Published in: Engineering
  • Be the first to comment

  • Be the first to like this

Illustrated Adventure Survival Guide for New Rustaceans and Natives of Rubyville

  1. 1. text-based adventure game > > > > > >help
  2. 2. > you are in a dark forest
  3. 3. > you are in a dark forest > > you see a light in the north
  4. 4. > you are in a dark forest > > you see a light in the north > > you have a map
  5. 5. > you are in a dark forest > > you see a light in the north > > you have a map > > what do you do?
  6. 6. > you are in a dark forest > > you see a light in the north > > you have a map > > what do you do? > > look at map
  7. 7. > you are in a dark forest > > you see a light in the north > > you have a map > > what do you do? > > look at map > > does not understand “look at map”
  8. 8. > you are in a dark forest > > you see a light in the north > > you have a map > > what do you do? > > look at map > > does not understand “look at map” > > look around
  9. 9. > you are in a dark forest > > you see a light in the north > > you have a map > > what do you do? > > look at map > > does not understand “look at map” > > look around > you are in a deserted field. There is a sharp rock.
  10. 10. Game architecture WARNING: I am not an expert!
  11. 11. # not real code, don’t judge me playing = true while playing ask “What do you want to do next?” parse user input perform action based on user input if user dies or game ends playing = false end end
  12. 12. def play puts "Welcome to #{@map.title}" puts "What would you like to do? (Enter 'help' to see a list of commands)" parse_choice(gets.chomp) while @playing break if !@playing puts "What now?" choice = gets.chomp parse_choice(choice) end end Ruby
  13. 13. fn main() { let player = player::Player::new(vec![], 1, 1); let map = map::Map::new("Great Rust Adventure", rooms); let mut game = game::Game::new(player, map, true); while game.playing { game.play(); } } Rust
  14. 14. Ruby
  15. 15. this might seem like a weird simile, but…
  16. 16. Ruby is great. Rust is great. In different ways.
  17. 17. Another Rust talk at OSCON today! “Rust for non-Rust Developers” 5:05pm - Ballroom G
  18. 18. @_lbaillie

×