No Time To Play

Tag: programming

A brief guide to Pygame

by on Jun.01, 2017, under Gamedev

For a web developer moving into games, HTML5 was a natural first choice. Doubly so for a Linux user who wanted his games to run on other operating systems without much fuss. But browser compatibility wasn’t so great either (it still isn’t even in 2017), and many people don’t like playing games in their browser, for all the convenience it brings.

Having just discovered the joys of Python, and happening to like a game made with it — called Monsterz — the Pygame library was an obvious choice. It’s ported to all the major platforms, well-documented, and very easy to use while still powerful. I remember seeing complaints about the Pygame community online, but my experience has been good.

One downside is that up until the recent revival Pygame only worked with Python 2.7, but then it’s what Mac users get by default; I’ll try to keep my code forward-compatible in case you have version 1.9.2 or newer. I was also surprised to see just how many Pygame functions I use in practice: over seventy! And that’s still only part of the API.

If you happen to be on Linux or Mac, you already have Python installed, but Windows users need to get a suitable runtime from python.org; either way, you also need to install the library, either through a package manager or directly from pygame.org. Make sure you get compatible versions for both.

(continue reading…)

2 Comments :, , more...

Game loops, input and sound in HTML5

by on May.25, 2017, under Miscellaneous

When I first started making games in what wasn’t yet known as HTML5 — not widely, anyway — about the easiest way to make a realtime game was to call a function every, say, 50 milliseconds with setInterval() and hope that would be enough time to process a frame: Javascript engines weren’t all that fast yet either. Worse, native support for video and audio was just being added to browsers, as for input, I didn’t trust myself to handle keyboard events so they would work consistently across browsers, so the mouse it was.

Needless to say, we’ve come a long way. Rhyme not intended.

In the first part of this guide, you’ve seen how to do graphics using the 2D canvas, which provides benefits of expressive power, speed, low memory and simplicity compared to the DOM. But graphics are just one aspect of games, and while other programming interfaces deal with everything in one place, HTML5 is broken up into multiple APIs you can use independently. This time, let me show you what I use to set up a game loop, accept input from the player and play sound. We’re going to focus on realtime games, because they’re conceptually simpler, but also more interesting.

(continue reading…)

2 Comments :, , more...

Brief guide to the 2D canvas in HTML5

by on May.18, 2017, under Gamedev

I started making web games using the 2D canvas API in 2009, early enough that people still went “I can’t believe it’s not Flash”. A year or two later, everybody and their dog was making canvas-based games, so mine weren’t special for long, but oh well. On the plus side, my skills are still entirely relevant eight years down the road — a lucky break in this world where we all have to run as fast as we can just to stay in place.

The canvas API isn’t exactly huge or obscure, and the Mozilla Developer Network covers it well. It can still be daunting to learn from scratch, especially if you don’t yet know what you’re going to need in actual game development.

As it turns out, I only ever use about two dozen fields and methods of the canvas element’s 2D context; you may be able to make do with even fewer. Of course, that’s just for the graphics — setting up a game loop and accepting input is another story.

(continue reading…)

1 Comment :, , more...

When sprite scaling meets free roaming

by on Apr.27, 2017, under Gamedev

As of spring 2017, it’s been nearly five years since my first shot at a first-person engine with eight directions based on sprite scaling, inspired by a certain 8-bit classic. At the time I wasn’t aware of any newer game made in the same style; in the mean time, the aforementioned classic was ported to modern platforms and even got a spiritual successor. It took me until the winter of 2015 to try again myself. Still not with a strategy game, mind you — in fact I tried for a roguelike, probably with Necklace of the Eye fresh in mind. Never got around to explaining why it fizzled out, either; a mistake I’ll rectify below.

Point is, after 16 more months it was time for yet another take on the concept. And as it turns out, third time’s the charm.

(continue reading…)

1 Comment :, , more...

Weekly Links #148

by on Nov.27, 2016, under Gamedev, News

Hello, everyone. Today, for only the second or third time in three years, this newsletter contains no actual links. Apologies. In my defense, I did keep working on Adventure Prompt, after coming up with a game idea that can properly showcase the engine’s specific features. A big selling point of the system is the ability for authors to employ many text adventure tropes just by setting some properties on objects. And it’s surprising how much can be done that way. Scenery/portal objects (they can double as doors that lead elsewhere) were trivial — just another application of exits. Vehicles took only 100 lines of extra code in the interpreter (though that was a 20-25% increase), and the only recent addition to the editor, apart from more documentation. I could have crammed a minimal scripting language in that much space… but that would have shifted the burden on authors. Which is the opposite of what an authoring system is for.

Easy stuff will be easy no matter what. The trick is making the hard stuff easier as well.

Next: to do some more refactoring before adding what little is left (reading material and hidden object reveal, mainly), and then to see about fleshing out that demo game, because while the map and puzzle structure came easily, I had a hard time thinking of descriptions. And that’s supposed to be my specialty.

See you next time, hopefully with more exciting news. Be well!

Leave a Comment :, more...

Birth of a shoot’em up

by on Sep.15, 2016, under Gamedev

I don’t remember whether I played They Started It before or after coming up with the concept for Laser Sky. I had been toying with the Pyglet game library, pondering what sort of game it might be suitable for, and a shoot’em up was the most obvious choice. Not that the world needs yet another game about blowing stuff up. But making a sequel to Attack Vector and getting it right for a change is an old dream of mine, and any excuse to learn a promising new technology is a good one. The big problem was choosing a theme. And like the first time around, nothing I came up with seemed to have legs. Even a briefly considered idea for a cute’em up fizzled out (though that’s definitely worth revisiting). Moreover, it began to dawn on me that coding a sprite-scaling engine on top of a 2D library backed by OpenGL was kind of ridiculous. The new game had to be a good old-fashioned scroller… but then it couldn’t be a sequel to Attack Vector.

screenshot-20160914

In the end, the concept for Laser Sky came to me almost fully-formed during a walk in the park. Trouble is, it involved vector graphics, and that precluded the use of an engine optimized for sprites. So, back to HTML5 it was. The first order of business was dusting off the game microframework I developed two years ago for the original RogueBot. (Which of course revealed a bug, duly fixed.) Making a ship move around the screen, and some basic enemies come at it, was easy enough. Then it was time for them to interact.

(continue reading…)

1 Comment :, , , , more...

Weekly Links #134

by on Aug.21, 2016, under Miscellaneous, News, Opinion

cover-thumbHello, everyone. For once, I only have my own bad mood to blame for the shortness of this newsletter. As promised three weeks ago, my latest book, Make Your Own Programming Language, is live on Leanpub. It’s only of interest to programmers, especially those with a taste for retrocomputing and retrogaming. But you know my opinion: piecing blocks together in GameMaker is still programming, whether you realize it or not. And game design works best when you have at least a trace of process, as opposed to banging things together until they stick. So give it a try.

In unrelated news, all everyone’s been talking about lately is No Man’s Sky. That’s also the case of Michael Cook, who brings it up as an example of the language we use to discuss procedural generation. And you know… I couldn’t help but notice the fatigue of many reviewers when they mention how many millions of billions of planets there are in that game, and how they’re never going to see the vast majority of them. Which fortunately doesn’t really matter…

I guess the creators of No Man’s Sky forgot that the original 8-bit Elite was originally planned to have 282 trillion galaxies, or 2 to the power of 48 (presumably another byte was going to be used for the planets in each galaxy). And never mind that it would have made the artificiality obvious, especially on a home computer from the 1980s. But visiting 2000 star systems is a plausible goal for the determined player — there are just enough of them to make for a huge playground, yet few enough that you can actually remember some of your visits afterwards… and care. While enough content to fill millions of galaxies (a sizable chunk of the observable universe) just sort of blends into an amorphous mass. A statistic, if you will.

As an aside, let me underscore again than an 8-bit computer from the early 1980s, with just 64 kilobytes of RAM, could easily have handled a procedural universe on a scale comparable with the one in No Man’s Sky (if a lot less detailed). What exactly are we doing with a million times more memory and computing speed?

Leave a Comment :, , more...

Weekly Links #131

by on Jul.31, 2016, under Miscellaneous, News

Is it a book? Is it a piece of software? It is a game? The second edition of Make Your Own Programming Language, that I finished writing today, has a little of all three. Most importantly, it tries to recapture the fun of making the computer follow your instructions, that forgotten quality of programming that used to lure so many people decades ago. It will soon be out to beta-readers, and then I’ll let you know.

In other news, Rock, Paper, Shotgun is running a series of articles on the future of procedural generation, specifically about spinning lore for computer role-playing games. Which would be pretty interesting, except for most roguelikes that would be overkill, while in more conventional CRPGs handcrafted characters, stories and settings are the whole point. Do games that aim to have emerging narratives even need that much detail, especially if it’s ultimately fluff?

Going forward, via Jay Barnson, here’s a Gamasutra article about Chrono Trigger’s Design Secrets, that manages to be useful even though I never played the game. And Jimmy Maher’s history of computer story games has reached the demise of Infocom; check out the quote from Marc Blank, who was stating who knows how long ago what myself and others have been blogging about all spring:

If all of a sudden you can ask any question, but there are really only three questions that are important to the story, you’re either going to spend all this time coming up with answers that don’t mean anything or you’re going to have a lot of “I don’t know that,” which is frustrating. I always suspected it was a dead end. The nice thing about the command-oriented game is that you can come up with a pretty complete vocabulary and a pretty complete set of responses. As soon as it becomes more open-ended — if I can say, “I’m hungry” or “I like blue rubber balls” — how do you respond to that?

To end on a nostalgic note, here’s a blog post about abandoned arcades, and the slow death game cabinets are sentenced to when left exposed to the elements. Thankfully, there is interest in rescuing these old machines as of late, so for the most part arcades are a bit of history we can expect to survive.

Until next time, don’t let the past be forgotten.

2 Comments :, , , , more...

Weekly Links #98: nostalgia edition

by on Nov.29, 2015, under News

It wasn’t three weeks ago that I was linking to a very nice retrospective of the Gabriel Knight games. Well, here’s an even more detailed five-part postmortem of the famous trilogy. Apart from the wealth of technical information in the articles, I can’t help but notice two factors that I think were very important to the success and enduring fame of the franchise: the story came first — and it was a story the writer cared very much about, not just something written on order. Consider that when setting out to make a game.

Speaking of retrospectives, here’s one of Fantasy World Dizzy, my favorite in the series. And while on the topic of adventure games, the incredible Jason Scott just made public a treasure trove of Infocom documents (see here and here). Beyond their value for historians and game designers, it’s worth noting that they did write down all that stuff, and then someone went through the trouble of preserving it. Hooray for thinking of the future.

Last but not least, a moving story about somebody reviving an old Atari 800 and TV set from the same era for a gaming night in the family. Note that both antiques are still working perfectly, over 35 years later, and they’re no less fun than a modern console. A pretty good return on investment, wouldn’t you say?

In unrelated news, from a blogger I haven’t quoted lately comes an article about the importance of software specifications. Which is most welcome seeing how the complexity of modern software is all too often underestimated — and games are some of the most complex apps out there.

Have a nice week.

Comments Off on Weekly Links #98: nostalgia edition :, , more...

Weekly Links #94

by on Nov.02, 2015, under Miscellaneous, News

Oh my. Late again and for once I have no excuse. So let’s get started.

I’m the kind of player who, when sitting down to try out a MMO, spends a lot of time choosing and customizing an avatar. Nightwrath always gets impatient, but come on. Isn’t the avatar supposed to represent me well? This is why this article about dress-up games caught my eye. Not so much the examples they give — Hero Forge is much more to my taste. But that would require going into details. Point is, dress-up isn’t just for kiddies.

Moving on. On the 30th anniversary of the NES launching in the US, we get an in-depth retrospective of the console’s development. And apropos of nothing, here’s a personal history of the text adventure, a thoughtful and informed write-up. Last but not least, it turns out White Wolf has been sold again, from one computer game publisher to another. It remains to be seen what sort of vampire games we can expect this time.

At last we get to a headline actually related to game development. Well, the concept of a complexity budget applies to all software. It just happens that games are often among the most ambitious software projects, and it tends to kill them very dead.

Don’t make that mistake. Keep it simple… son.

Comments Off on Weekly Links #94 :, , , , more...

Posts by date

July 2017
M T W T F S S
« Jun    
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Posts by month