Home » Python » Python: PyWeek 32: Lil Miss Vampire

About Shannon Behrens

Shannon -JJ Behrens
Catholic, father of eight, open source enthusiast, Python, JavaScript, Ruby, Scala, Go, etc. programmer.

Python: PyWeek 32: Lil Miss Vampire

TL;DR A world that scrolls infinitely in any direction, an RPG-like UI, and simple, real-time fighting.


My younger kids and I built this entry for PyWeek 32 based on the theme “Neverending”.

The key innovations are:

  • It has a neverending world. As the player walks along, it picks up tiles and places new ones invisibly. It uses an LRUDict to remember the last million tiles you’ve seen. This matches real life in that if you go back to a place after 20 years, it’ll look different than when you first saw it.
  • The user interface was inspired by Super Mario RPG, but the fighting mechanics are purposely realtime. It’s a lot like if you were playing Street Fighter, but all you were allowed to do was use a fast punch, a slow punch, or block. It’s a little bit like roshambo.

The code:

  • The code is pretty pleasant. I made use of lots of new features in the latest Python, and I built a pretty decent developer experience.
  • It’s built on the excellent arcade library which has exceptionally good documentation, tutorials, and examples.
  • I used type annotations everywhere, and I enforced them via mypy. I made extensive use of `typing.NamedTuple` which gives it a nice, immutable, well-typed flavor.
  • I used black to format the code during check-in.
  • There are extensive unit tests for the models. And there are git hooks to keep everything sane.
  • Running `make iterate` will reformat the code, run mypy to enforce types, run the unit tests, and then launch the game.

Here’s the GitHub page with more details.

Published on Web Code Geeks with permission by Shannon Behrens, partner at our WCG program. See the original article here: Python: PyWeek 32: Lil Miss Vampire

Opinions expressed by Web Code Geeks contributors are their own.

(0 rating, 0 votes)
You need to be a registered member to rate this.
Start the discussion Views Tweet it!
Do you want to know how to develop your skillset to become a Web Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. Building web apps with Node.js
2. HTML5 Programming Cookbook
3. CSS Programming Cookbook
4. AngularJS Programming Cookbook
5. jQuery Programming Cookbook
6. Bootstrap Programming Cookbook
and many more ....
I agree to the Terms and Privacy Policy
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments