From 66098ede74c603330273861311e589f66b681516 Mon Sep 17 00:00:00 2001 From: Jeff Armstrong Date: Sat, 27 Jul 2013 15:03:59 -0400 Subject: Added the presentationm slides --- presentation/advent.html | 251 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 251 insertions(+) create mode 100644 presentation/advent.html (limited to 'presentation/advent.html') diff --git a/presentation/advent.html b/presentation/advent.html new file mode 100644 index 0000000..c60417f --- /dev/null +++ b/presentation/advent.html @@ -0,0 +1,251 @@ + + + + + +A Text Adventure in Python + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + +
+ + +
+ +
+

A Text Adventure in Python

+

Exploring the Standard Library

+

Jeffrey B. Armstrong

+

Approximatrix, LLC

+
+ +
+ + +

Introduction

+

+
    +
  • Build a text adventure +
      +
    • with only the standard library
    • +
  • +
  • Basic steps to start a game
  • +
  • Introduce some fun Python modules
  • +
+ +
+
+ +

History

+

+
    +
  • Text Adventures/Interactive Fiction +
      +
    • Popular when graphics were a “problem”
    • +
    • Multiple commercial entities
    • +
  • +
  • Still enjoy “cult” following
  • +
+ +
+ +
+ +

Necessities

+
    +
  • Command prompt
  • +
  • Locations to visit
  • +
  • Game file(s) describing our world
  • +
  • Puzzles, items, characters, etc.
  • +
+ +
+
+ +

Command Prompts

+
    +
  • cmd module +
      +
    • Provides “support for line-oriented command interpreters”
    • +
    • Absurdly simple to implement
    • +
    • Might lack some power
    • +
  • +
+ +
+
+ +

Locations

+
    +
  • Room class +
      +
    • Needs an id, name, description
    • +
    • List of connected rooms
    • +
    • List of items in the room
    • +
    • List of NPCs in the room
    • +
  • +
+ +
+
+ +

Persistent Rooms

+
    +
  • pickle +
      +
    • Lets us serialize our rooms easily
    • +
    • Not editable
    • +
  • +
  • Plain ol’ text files +
      +
    • Hand-editable
    • +
    • Implies some arbitrary formatting
    • +
  • +
+ +
+
+ +

Persistent Rooms

+
    +
  • json module +
      +
    • Allows “serializing” our rooms
    • +
    • Hand-editable
    • +
    • Expandable via adding fields
    • +
  • +
+ +
+
+ +

Text Wrapping

+
    +
  • textwrap +
      +
    • Automagically handles our wrapping needs
    • +
  • +
+ +
+
+ +

Data Files

+
    +
  • sqlite3 module +
      +
    • Simple SQL database
    • +
    • Store the entire game in a single file
    • +
  • +
+ +
+
+ +

Data Files

+
    +
  • tempfile module +
      +
    • Make a temporary, working copy of the game
    • +
  • +
  • shutil module +
      +
    • For copying the clean game file to a temp file
    • +
    • For creating our saves
    • +
  • +
+ +
+
+ +

What’s Missing?

+
    +
  • Status Bar +
      +
    • curses module is the key
    • +
  • +
  • NPCs
  • +
  • Puzzles
  • +
  • “Advanced” text parsing
  • +
+ +
+
+ +

Where We’ve Been

+
    +
  • cmd
  • +
  • json
  • +
  • textwrap
  • +
  • sqlite3
  • +
  • tempfile
  • +
  • shutil
  • +
+ +
+
+ +

Want More?

+
    +
  • https://github.com/ArmstrongJ/ +
      +
    • An older, actual adventure named robotadventure
    • +
  • +
  • http://www.pyweek.org/ +
      +
    • A reason to write your own
    • +
  • +
  • http://www.ifcomp.org/ +
      +
    • If you think yours is worthy…
    • +
  • +
+ +
+
+ +

Thanks!

+

@fortranjeff on Twitter

+

http://jeff.rainbow-100.com

+

jeff@rainbow-100.com

+ + +
+ + + \ No newline at end of file -- cgit v1.2.3