• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
  • entries
    22
  • comments
    30
  • views
    42470

Snurtle and My Greatest Contribution to Mathematics, Such That It Was

Sign in to follow this  
Followers 0
jwezorek

1388 views

This summer coming up will be 20 years since the summer after I graduated from college. I'm currently in that golden period in between software jobs -- starting a new one in March -- and, given the free time, have just done something which I have been meaning to do since that summer.
I generated the following image in a non-ad hoc manner, with re-useable software that I developed myself.
hex.png
That year after college I was kind of shiftless. I chose to just not participate in the whole interview circus that normally accompanies one's senior year of MIT and let myself graduate without having plans of any kind for the future. I think that I was tired mostly and was kind of sick of the universe of engineering and all of its hurdles and dog and pony shows, and I think I kind of half-understood that this would be the last time in my life in which it would be possible for me to be totally free of that universe -- until, I guess, retirement.
Anyway, I lived in the slums of Boston -- that is, Roxbury -- with a friend of mine from high school and some roommates we found, one of whom ended going to jail (but that is another story), worked temp jobs, and didn't do much of anything ... except for some reason I became obsessed with aperiodic tilings of the plane and substitution tilings generally and put a lot of effort into coming up with one of my own. I wanted to find, for reasons that aren't clear to me now, an aperiodic analog of the normal regular hexagon tiling.
It's kind of a blur -- I don't really remember where the above came from as a sequence of steps -- but the above is a patch of the best tiling I discovered during this period. It is generated via the following substitutions. The lengths of the sides of triangles and trapezoids are multiples of ?, the golden ratio.
rules.png
As far as I know, the above is original and has not been discussed in the literature but I never was able to come up with local matching rules on the hexagons to enforce aperiodicity.
At that time I did develop software for working on these sorts of structures but what I came up with in retrospect wasn't The Right Thing. This wasn't all together my fault. Those were different times: no GitHub, no free code. If I wanted to output into a vector format it would have to be my own vector format. If I wanted to render that format to the screen I would have to write code to render that vector format to the screen, and so on. Also GUI applications were all the rage and were still new and shiny, so I was biased in that direction. I never really liked what I came up with then, and it wasn't portable anyway; it was a black-and-white Macintosh application in C.
Having the negative example of that project all those years ago made it easy to see what I actually needed: not a GUI application but a programming language. So last week, I wrote one: a little language for specifying recursive structures like the above and rendering them in SVG. I'm calling it Snurtle because it is basically a combination of Python (a snake) and the turtle-based graphics of Logo. I chose Python syntax because I wrote the Snurtle interpreter in Python and thus got tokenization for free using Python's "tokenize" module.
So, for example, the following simple substitution
squares_rules.png
is represented by the following Snurtle script:sub square(n): terminal: poly("bisque", "orangered", 1 ): forward(n) turn(PI/2) forward(n) turn(PI/2) forward(n) nonterminal: rectangle(n) branch: turn(PI) forward(n/2) turn(-PI/2) forward(n/2) square(n/2) square(n/2)sub rectangle(n): terminal: poly("lightskyblue", "orangered", 1 ): forward(n/2) turn(PI/2) forward(n) turn(PI/2) forward(n/2) nonterminal: square(n/2) turn(PI) square(n/2)
yielding
squares.png
which, I think, is self-explanatory except for the "branch" block. Branch blocks tell Snurtle to push the state of the turtle on to a stack and then pop it when exiting the branch i.e. branch works like parentheses operators in L-systems. Also the following Snurtle constructs are not illustrated in the above:

  • flip blocks: similar in syntax to branch above. Tell Snurtle to multiply the angle arguments passed to turn statements by -1. (i.e. flipping them)
  • stroke and fill blocks: similar to "poly" above.

    Anyway, here is my snurtle source code. Usage to generate the above would be:[quote]
    snurtle.py -w -s square -k 500 -m 8 -o squares.html -c "10,10? "snurtle_scriptssquares.snu[/quote]
    where

    • -w : wrap the generated SVG in HTML (so it can be viewed in browser)
    • -s : initital substitution used to kick off the recursion
    • -k : scale factor in SVG output
    • -m : max stack depth before substituting in terminal blocks rather than nonterminal and ending the recursion
    • -o : output filename
    • -c : starting coordinate when generating SVG. (There is also a -d which similarly specifies the width and height attributes of the SVG but I am using the default in the above

      Snurtle is pretty rough at this point, so check back here for updates if you are interested; in particular, substitutions can't currently have more than one argument and I want to make the color, etc., parameters to poly block be optional and maybe allow the user to specify z-order.

      Source

5
Sign in to follow this  
Followers 0


2 Comments


That's really cool! And glad to hear you made it out of Roxbury alive :D

2

Share this comment


Link to comment

Thanks ... and, yeah, living in Roxbury at that time was an experience. I have lots of stories from that time. I was braver back then but to be honest, it wasn't that big of deal after you get settled in.

1

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now