Image
  • Writing
    • Andy Gavin: Author
    • About my Novels & Writing
    • All Writing Posts
    • The Darkening Dream
      • Buy the Book Online
      • Sample Chapters
      • Reviews
      • Info for Reviewers
      • Press Coverage
      • Awards
      • Cast of Characters
    • Untimed
      • Buy Untimed Online
      • Book Trailer
      • Sample Chapters
      • Reviews
      • Info for Reviewers
      • Press Coverage
      • Awards
      • Cast of Characters
    • Scrivener – Writer’s Word Processor
    • iPad for Writers
    • Naughty Dark Contest
  • Books
    • Book Review Index
    • Favorite Fantasy Novels
    • Andy Gavin: Author
    • The Darkening Dream
      • Buy the Book Online
      • Sample Chapters
      • Short Story: Harvard Divinity
      • Reviews
      • Info for Reviewers
      • Press Coverage
      • Awards
      • Cast of Characters
    • Untimed
      • About the Book
      • Buy Untimed Online
      • Book Trailer
      • Sample Chapters
      • Reviews
      • Info for Reviewers
      • Press Coverage
      • Awards
      • Cast of Characters
    • Naughty Dark Contest
  • Games
    • My Video Game Career
    • Post Archive by Series
    • All Games Posts Inline
    • Making Crash Bandicoot
    • Crash 15th Anniversary Memories
    • World of Warcraft Endgames
    • Getting a Job Designing Video Games
    • Getting a Job Programming Video Games
    • Naughty Dark Contest
  • Movies
    • Movie Review Index
  • Television
    • TV Review Index
    • Buffy the Vampire Slayer
    • A Game of Thrones
  • Food
    • Food Review Index
    • Foodie Club
    • Hedonists
    • LA Sushi Index
    • Chinese Food Index
    • LA Peking Duck Guide
    • Eating Italy
    • Eating France
    • Eating Spain
    • Eating Croatia
    • Eating Vietnam
    • Eating Australia
    • Eating Israel
    • Ultimate Pizza
    • ThanksGavin
    • Margarita Mix
    • Foodie Photography
    • Burgundy Vintage Chart
  • Other
    • All Posts, Magazine Style
    • Archive of all Posts
    • Fiction
    • Technology
    • History
    • Anything Else
  • Gallery
  • Bio
  • About
    • About me
    • About my Writing
    • About my Video Games
    • Ask Me Anything
  • Contact

Archive for Ruby

Round 1 Winner Selected!

Jan17

I’ve official “sold” all 100 tickets in ROUND ONE of the Naughty Dark Contest. So I fired up the Ruby interpreter and asked it to compute the appropriate pseudorandom number, which turned out to be 6.

Counting from zero − I’m such a programmer − this turned out to be a ticket owned by Dorothy Beecher of New York!

She chose the following for her prize: A signed copy of The Darkening Dream!

Ain't it dreamy?

But just because ROUND ONE is finished, doesn’t mean you can’t win. Check out the rules and get submitting, round two is open. As soon as it sells out another 100 tickets, there will be yet another drawing. And the special prizes are available to anyone, anytime!

Which speaking of, Markus Grundnig of Austria is our latest special prize winner, having gone for the gusto and earned 25 tickets! He chose to get a signed copy of his (and my) favorite Naughty Dog game, Crash Bandicoot 2: Cortex Strikes Back.

Signed Crash 2 before heading East toward Austria

Crash 2, besides being the most painful year of my life (1997), represents IMHO the pinnacle of Crash gameplay. Some might enjoy Warped’s crazy vehicles (and they were fun), but I for one, like the classic platforming intensity of Cortex Strikes Back. Having cleaned up the crappy Crash 1 save system, revamped the technology, and smoothed the gameplay, Cortex really shines. Although don’t get me wrong, it’s a real close call.

Related posts:

  1. Special Prize Winners
  2. Announcing the Naughty Dark Contest
  3. Crash for Charity
By: agavin
Comments (20)
Posted in: Contests, Darkening Dream, Games
Tagged as: Crash Bandicoot, drawing, Naughty Dark Contest, New York, Pseudorandom Numbers, Ruby, The Darkening Dream

Website Upgrades Coming

Nov06

Since I’m waiting for both my line edits on Untimed and my proofreading on The Darkening Dream, I’m researching website construction. I have to morph, upgrade, or supplement this blog with a genuine author website and I can’t bring myself to hire someone to do it given that I’ve written far bigger and more complex websites and apps. It’ll just annoy me to no end to not be able to control it all myself. But at the same time, old school coding the whole thing manually (I’d probably use Ruby on Rails for that) is overkill and probably too much work.

So I read this Professional WordPress book yesterday and today to see if it would be reasonable to just extend WordPress. I think it is. A few plugins and some custom theme programming will probably do the trick. The problem is that I host on wordpress.com and they don’t allow you to install extra plugins (they have some installed by default) or add any PHP code. So I’ll have to migrate to a self hosted server. Maybe Media Temple VPS? Rackspace? Research. Research. Research. Anyone have any suggestions/experience with the good hosting platforms?

And I have to teach myself PHP, so I grabbed the bird book. PHP is one of those popular but slightly icky languages like PERL and JAVA that I’ve never been very partial to. It’s like Ruby, but 100x uglier and more primitive. I am a LISP (and Ruby) guy after all. Oh well. This is easy peasy programming, so I’ll just suck it up. Using something like WordPress will make my life much easier maintaining the site as it’s choke full of content management features. If I program it myself I have to go and code everything manually, which really isn’t very efficient.

I even wonder if one of these newer WordPress themes/frameworks like PageLines Platform isn’t a good idea. Anyone use one?

More to come as I get into it.

Related posts:

  1. The hits keep on coming
By: agavin
Comments (7)
Posted in: Technology
Tagged as: Andy Gavin, Author Website, blog, Darkening Dream, Languages, PageLines Platform, PHP, Plug-in (computing), Programming, Rails, Ruby, Ruby on Rails, Untimed, Website, WordPress, wordpress.com

Lispings ala John McCarthy

Oct25

Yesterday, John McCarthy, the inventor of the LISP programming language passed away. It’s been a bad month for computer guys. First Steve Jobs, then Dennis Ritchie, creator of C, now McCarthy.

LISP was one of my early great loves in programming languages. I learned it first in college (prepping for an AI course). Perhaps it was the intensely well written “LISP Bible” Guy Steele’s Common LISP: The Language or Paul Graham’s mind opening On Lisp. Then at MIT my advisors were Patrick Winston (author of LISP) and Rod Brooks. No surprise I took to it. From Paul Graham I learned that programing languages didn’t need to be static, but could become fluid langages shaped to the specific domain or your task. From Rod I learned to roll my own. 

For nearly two decades I was a diehard LISP advocate. I even forced all my programers to code three Crash Bandicoot and four Jak & Daxter games in custom LISP dialects that I wrote the compilers for. This started with our fighting game Way of the Warrior (Rod Brooks voices a character in the game) where I used MacCL to create a LISP syntax state machine to pcode compiler. Then from Crash Bandicoot a much more elaborate language for coding all the gameplay objects called GOOL. In Jak & Daxter I went full on crazy and wrote a native compiler for an object oriented full featured Scheme language called GOAL. We wrote 98% of four Jak & Daxter games in it, including the vector unit assembly.

One of the interesting things about LISP is that it’s actually a pretty easy language to parse, interpret, and compile. This isn’t actually an accident as the S-expression syntax was initially chosen for it’s machine regularity (in those early days of underpowered mainframes). Newer languages are syntactically much more complicated. Ironically most normal programmers, being human, seem to find the more complicated syntax easier and the “simple” S-expression syntax confusing (being backward much of the time to normal human convention). I always found it unambiguous, but go figure. It’s also precisely this regularity that makes the awesome macrology of LISP possible and has allowed the language to remain relevant despite its advanced age.

But by the mid 2000s I started doing the kind of programming I used to do in LISP in Ruby. It’s not that Ruby is a better language (although it is a good one), but mostly it was the momentum factor and the availability of modern libraries for interfacing with the vast array of services out there. Using the crappy unreliable or outdated LISP libraries — if they worked at all — was tedious. Plus the LISP implementations were so outmoded. It was very hard to get other programers (except a couple enthusiasts) to work that way. And ugh, those old CMCL and ACL Garbage Collection code/algo’s were (at least when I last used them in 2006) so awful. In ACL I’d get these LispMachine-like multi-hour GCs.

Ruby had a great book (I put big stock in that) and struck a decent compromise. It’s type system and object model are better (or at least more modern) than Common LISP anyway. The syntax is more inconsistent, and the macro model nowhere near as good. In Ruby you can manually build up strings and feed them into the interpreter, which is equivalent to simple backquote. But you can’t easily do the kind of cool nested constructions that are trivial in LISP.

But it turns out. Libraries and implementation matter a lot. Momentum too. Ruby has momentum, people supporting it who aren’t older than me (and I’m not a young programmer anymore, started in 1980!) Still, you can feel lots and lots of LISP influence in all the new runtime typed languages (Ruby, Python, etc). And 30 years later, listeners still rule! Using a language without a listener is like walking without legs. I pity the C, C++, Java only type programmer.

If you liked this post, follow me at:

My novels: The Darkening Dream and Untimed
or the
video game post depot
or win Crash & Jak giveaways!

Latest hot post: War Stories: Crash Bandicoot

Related posts:

  1. Making Crash Bandicoot – GOOL – part 9
  2. So you want to be a video game programmer? – part 4 – School
  3. So you want to be a video game programmer? – part 5 – The Method
By: agavin
Comments (20)
Posted in: Technology
Tagged as: Artificial intelligence, ArtificialIntelligence, Dennis Ritchie, John McCarthy, Lisp, McCarthy, MIT, Patrick Winston, Paul Graham, Programming, Ruby

So you want to be a video game programmer? – part 5 – The Method

Sep11

…CONTINUED from PART 4. Or start at Part 1.

This post is presents an algorithm of sorts for learning to program. It applies not only to the fundamentals, but to all aspects, including the acquisition of small component skills. Thirty years after learning, I still follow the same basic procedure. To tell the truth, modified, it works for leaning most things.

Step 1: Goal. Invent some manageable goal that excites you (in a later context as a profession “excites” is often replaced/supplemented by “need”). My first program was a text-based dungeon master (see here). If you want to be a video game programmer, there’s nothing better than a game. If it’s one of your first programs, make it damn simple. Copy some REALLY REALLY old and simple game like anything from before 1981 (Pong, Breakout, etc.). Truth be told, using text only for a couple weeks/months might not be a bad idea. Graphics just complicate matters. They’re awesome — and you’ll need them soon enough — but first the fundamentals, like variables, flow of control, scope, etc. Any individual task should take no more than a few days. If your goal is bigger than that, subdivide.

Step 2: Environment. All programming is done in the context of some environment, and you must learn about it. You need to start with a simple one. In my case it was mostly AppleSoft BASIC. For learning interpreted is good. Some decent starter environments today are Python, Ruby, Flash, Lua. DO NOT START WITH A LANGUAGE LIKE C. I will elaborate on this environment question in a separate full post, as it’s a large topic and highly religious for programmers.

Step 3: Research. This means reading. If you don’t like to read, either learn to or find yourself a new career. I’m serious. Reading separates the Neo Cortexs from the gibbering marsupials. I’m serious. Be a New Cortex. Your love of reading must be so extreme that you can stomach slogging through 900 page Library Reference Manuals (maybe not at first). Programming is full of details.

Step 4: Theory. Get out a pad of paper, a text file, Evernote, or whatever. Design what you are going to do. Later, you might or might not skip this step (and do it in your head), but it’s useful for the beginning programmer. You don’t need to write out the entire program, but you should design your data-structures and modules or functions. If it’s one of your first programs, you should hardly HAVE data-structures. You might instead write down the modes and loose flow chart between them.

Step 5: Code. Actually try coding your program. This is best done in an iterative way. My advice is generally to start with creating your core data-structures, and then the functions or methods that support them. Test each of these individually. Interpreted languages with a listener are the best because you don’t have to write test suites, but can just test the components as you go at the listener. Time spent debugging individual functions and groupings (say all the methods that belong to a data-structure) pays for itself 100-fold. I still do this. The less code you are testing, the easier it is to spot and find bugs. If you know that your functions are reliable (or semi-reliable) they provide robust building blocks to construct with.

Step 6: Debug. See above in “code” because they are heavily intertwined. Coding and debugging happens together in small loops. Again. The less NEW code you have to debug, the better. Debugging is hard for novices. Do not write an entire big program and debug it all at once. If you are using a language that syntax checks, check each function after you have written it. Fix the syntax errors (typos) and then test and debug the single function (or component of a program). Baby steps. Baby steps.

Step 7: Iterate and improve. Just keep adding things to your program to get it to where you want. Add a new feature. Improve an old one. Rip out some system and replace it. Add graphics. Upgrade them. Try to keep each of these changes as small as possible and test after each change. The longer it has been since it ran, the harder it will be to make it run.

_

I can not emphasize how important baby steps are. They are the key to avoiding fatal frustration. I have a law that helps define the size of subtasks: DO NOT EVER LEAVE THE COMPUTER IF YOUR PROGRAM DOES NOT RUN. You can take a piss or stretch. That’s it. I lived by this rule my entire programming career. You can’t always follow it, but try. Get your ass back in that chair. Mom wants you for dinner. Shrug. Your co-workers call you for a meeting. Snarl. I always think of a program like a car engine. You can sometimes merely tune it up, but a lot of times you have to take apart the engine to fix/add something new. That time when the engine is apart (the program does not RUN!) is very important, and should not be very long. If it is, you are not subdividing your tasks enough. I write all sorts of custom code to allow the engine to run again (even if in a half-assed way) while big changes are going on. These intermediate constructs are intended as throw-aways. But they save time. Having your program broken, writing more than a couple hours of new code that has not been tested, is a recipe for disaster. You could easily reach the point where you have no idea where the problem is. If you test in small bits as you go debugging is MUCH easier. Bugs are perhaps 80% likely in the most recently stuff. It’s the smoking gun you goto (haha) first.

You can do a lot with ASCII graphics!

A starter example of this whole process: My first game was a text based D&D type RPG game. I wanted to include a number of “cool” (to a 10 year-old) encounters. So I structured it as follows: There was the “character.” This was to be just a number of global variables (this is long before object oriented programming) like G (gold), HP (hitpoints) etc. I wrote a couple “methods” (functions – but they didn’t have names in BASIC, just line numbers) like “takes a hit.” This subtracts from HP, and if <= 0 branches to the “you are dead” part of the code (not really a function in those days). Then I wrote a number of “encounters.” These were the main flow of control in that program. It popped from encounter to encounter. They might be like: You have met an orc. draw orc on screen with text graphics (aka print statements). present options: “attack,” “run,” “use magic,” etc. wait for input and apply logic. If you are still alive send the player back to the main navigation loop (the place that doesn’t have a particular encounter).

That’s it. I expanded the program by doing things like: Adding more encounters. Adding resurrection as a pay option when you died. Adding an actual map to the main loop. Moving the “combat” logic from individual encounters into a function. Then adding to the character attributes like strength and dexterity which influenced combat. Beefing up character creation. Etc etc. These are all tasks that can individually be accomplished in a few hours. This is key. It keeps your program running most of the time. It provides good feedback on what you are doing.

The entire above “goal” -> “debug” loop can be repeated endlessly. Example: “add a save game.” You now have to save and restore the state of your player (various global variables). But to where? Disk presumably in those days. So you crack the BASIC manual and read about file I/O. First you go simple. There is one save game. It’s always named “adv.sav”. You write a function to open the file and write the vars into it. You examine the file to make sure it put them there the way you want to. You write another function to read the file. You add options to the game menu to call these functions. Then test.

Next baby step. Allow multiple save games. You add “filename” (or save slot or whatever) to the load/save functions. You hardwire it to something and test again. Then you add interface to the game’s main menu to specify which slot. You test that.

Iteration is king! Good luck.

_

Parts of this series are: [Why, The Specs, Getting Started, School, Method]

If you liked this post, follow me at:

My novels: The Darkening Dream and Untimed
or the
video game post depot
or win Crash & Jak giveaways!

Latest hot post: War Stories: Crash Bandicoot

Related posts:

  1. So you want to be a video game programmer? – part 3 – Getting Started
  2. So you want to be a video game programmer? – part 2 – Specs
  3. So you want to be a video game programmer? – part 4 – School
  4. So you want to be a video game programmer? – part 1 – Why
  5. Making Crash Bandicoot – GOOL – part 9
By: agavin
Comments (78)
Posted in: Games, Technology
Tagged as: Andy Gavin, BASIC, Breakout, Computer program, Control flow, Data structure, Debugging, Game programmer, Languages, Learning, Programming, Programming language, pt_career_advice, Python, Ruby
Watch the Trailer or

Buy it Online!

Buy it Online!

96 of 100 tickets!

Find Andy at:

Follow Me on Pinterest

Subscribe by email:

More posts on:



Complete Archives

Categories

  • Contests (7)
  • Fiction (404)
    • Books (113)
    • Movies (77)
    • Television (123)
    • Writing (115)
      • Darkening Dream (62)
      • Untimed (37)
  • Food (1,483)
  • Games (100)
  • History (13)
  • Technology (21)
  • Uncategorized (16)

Recent Posts

  • Robo Eats – Szechuan Place
  • Providence Chef’s Table 2022
  • OOToro Double
  • Robo Eats – Anarbagh
  • Fred loves N/Naka
  • Major Major Major
  • Far East – Beijing Tasty House
  • Home Sweet Spicy Home
  • Quick Eats – Bafang
  • Quick Eats – Peking Restaurant

Favorite Posts

  • I, Author
  • My Novels
  • The Darkening Dream
  • Sample Chapters
  • Untimed
  • Making Crash Bandicoot
  • My Gaming Career
  • Getting a job designing video games
  • Getting a job programming video games
  • Buffy the Vampire Slayer
  • A Game of Thrones
  • 27 Courses of Truffles
  • Ultimate Pizza
  • Eating Italy
  • LA Sushi
  • Foodie Club

Recent Comments

Archives

  • March 2023 (11)
  • February 2023 (11)
  • January 2023 (14)
  • December 2022 (11)
  • November 2022 (13)
  • October 2022 (14)
  • September 2022 (14)
  • August 2022 (12)
  • July 2022 (9)
  • June 2022 (6)
  • May 2022 (8)
  • April 2022 (5)
  • March 2022 (4)
  • February 2022 (2)
  • January 2022 (8)
  • December 2021 (6)
  • November 2021 (6)
  • October 2021 (8)
  • September 2021 (4)
  • August 2021 (5)
  • July 2021 (2)
  • June 2021 (3)
  • January 2021 (1)
  • December 2020 (1)
  • September 2020 (1)
  • August 2020 (1)
  • April 2020 (11)
  • March 2020 (15)
  • February 2020 (13)
  • January 2020 (14)
  • December 2019 (13)
  • November 2019 (12)
  • October 2019 (14)
  • September 2019 (14)
  • August 2019 (13)
  • July 2019 (13)
  • June 2019 (14)
  • May 2019 (13)
  • April 2019 (10)
  • March 2019 (10)
  • February 2019 (11)
  • January 2019 (13)
  • December 2018 (14)
  • November 2018 (11)
  • October 2018 (15)
  • September 2018 (15)
  • August 2018 (15)
  • July 2018 (11)
  • June 2018 (14)
  • May 2018 (13)
  • April 2018 (13)
  • March 2018 (17)
  • February 2018 (12)
  • January 2018 (15)
  • December 2017 (15)
  • November 2017 (13)
  • October 2017 (16)
  • September 2017 (16)
  • August 2017 (16)
  • July 2017 (11)
  • June 2017 (13)
  • May 2017 (6)
  • March 2017 (3)
  • February 2017 (4)
  • January 2017 (7)
  • December 2016 (14)
  • November 2016 (11)
  • October 2016 (11)
  • September 2016 (12)
  • August 2016 (15)
  • July 2016 (13)
  • June 2016 (13)
  • May 2016 (13)
  • April 2016 (12)
  • March 2016 (13)
  • February 2016 (12)
  • January 2016 (13)
  • December 2015 (14)
  • November 2015 (14)
  • October 2015 (13)
  • September 2015 (13)
  • August 2015 (18)
  • July 2015 (16)
  • June 2015 (13)
  • May 2015 (13)
  • April 2015 (14)
  • March 2015 (15)
  • February 2015 (13)
  • January 2015 (13)
  • December 2014 (14)
  • November 2014 (13)
  • October 2014 (13)
  • September 2014 (12)
  • August 2014 (15)
  • July 2014 (13)
  • June 2014 (13)
  • May 2014 (14)
  • April 2014 (14)
  • March 2014 (10)
  • February 2014 (11)
  • January 2014 (13)
  • December 2013 (14)
  • November 2013 (13)
  • October 2013 (14)
  • September 2013 (12)
  • August 2013 (14)
  • July 2013 (10)
  • June 2013 (14)
  • May 2013 (14)
  • April 2013 (14)
  • March 2013 (15)
  • February 2013 (14)
  • January 2013 (13)
  • December 2012 (14)
  • November 2012 (16)
  • October 2012 (13)
  • September 2012 (14)
  • August 2012 (16)
  • July 2012 (12)
  • June 2012 (16)
  • May 2012 (21)
  • April 2012 (18)
  • March 2012 (20)
  • February 2012 (23)
  • January 2012 (31)
  • December 2011 (35)
  • November 2011 (33)
  • October 2011 (32)
  • September 2011 (29)
  • August 2011 (35)
  • July 2011 (33)
  • June 2011 (25)
  • May 2011 (31)
  • April 2011 (30)
  • March 2011 (34)
  • February 2011 (31)
  • January 2011 (33)
  • December 2010 (33)
  • November 2010 (39)
  • October 2010 (26)
All Things Andy Gavin
Copyright © 2023 All Rights Reserved
Programmed by Andy Gavin