Decorators in Python

I know this might not be quite as worthwhile as my other material (I do not deny that even THAT isn’t very worthwhile), but I’ve stumbled upon something so ingenious that I have to post about it. Actually, it isn’t as amazing as it sounds. It’s just somebody that explained Python decorators on Stack Overflow. And that, he did quite well. I’m writing a little text adventure in Python for fun (and for learning purposes). A simple text adventure allows me to step back from all the API junk and programming techniques I might learn or have to use elsewhere and instead focus on getting my code right and researching new ways. I’m also reading an intrudoctory paper on event-driven programming by Stephen Ferg that has opened my eyes (I’m practically reborn).

Anyway, decorators! Scroll down a bit for the epic explanation. In my case,  I wanted to have a simple prompt function which then passes its result to the prompt method for the room/level. Not so easy if you call the prompt function in main(). Hmm…

http://pastebin.com/0JXQhmNY

Thank you e-satis!

PS. I can’t properly paste Python code. Stupid Wordpress…

Tags: , , , , ,

No Comments


Spacesim - Cruisin’ (navigational aspects)

Disclaimer: Hardcore space sim content, reader discretion is advised!

In the case of a sandbox game, a great chunk of the time in the artificial space universe the player will spend flying from point A to point B somewhere in space. Hence why that aspect of the game is pretty crucial, since the player might get bored over time when repeating that task, regardless of whether or not there is a comprehensive autopilot function visible to the player. That’s one of the problems we’ll notice once we want to break up the “big” game atoms into smaller pieces. Breaking up that chain reveals that a great deal of repetition is present, which can’t be broken up by a waterfall design. So making flight least painful or boring as possible is important! Unless the aim of the game is to bore you to death.

The concept of space flight differs a lot from game to game. It’s also linked to the objects in space are arranged - whether you travel from one star system to another, or from one section to another inside a big star system, or even just “random” sectors in space connected through some kind of gates or whatever, that all defines the layout of your star systems or sectors, etc. . Whatever we’ll choose, it’ll fundamentally define the way the game is played. Instead of choosing one right in the beginning, I’d like to discuss that first.

I’d like to briefly describe some layouts/concepts which come into question and point out the one concept I like the most right now. Disclaimer: All those concepts revolve around star systems with no objects moving around the sun(s)/planets/etc., i.e. “unrealistic” systems.

1. The gameplay-relevant sections are star systems which are divided into sectors according to the position of planets, stations etc. (one other way to divide the star systems is into equal rectangular sectors, however that’s pretty inconvenient in my opinion and doesn’t suit my image of the game) The means of travelling between objects inside the system consist of acceleration gates or rings (or whatever they’d be called) that would convey ships from a relevant sector to another. Travelling from one star system to another is done using jump gates and/or worm holes, whose positions are independant of those of the remaining stellar objects. In case of acceleration rings, the disruption of one portion of the ring system would be possible, thus allowing pirates to disrupt these and camp at those acceleration lanes. (People who have played Freelancer are familiar with the concept of “lane hacking”)

system_concept1

2. The relevant sectioning is done in space sectors. Space sectors are small chunks of important space, arranged in a matter possibly independent of logic of any kind ;). Travelling inside those sectors would be no big deal as distances aren’t big. Jump gates interconnect all space sectors.

system_concept2

3. The concept I favor the most is kind of a compromise. I just see it as the best way to include some interesting gameplay mechanics and get some action going. The gameplay-relvant space portions are star systems, which are again divided into sectors of different size adjacent to stellar objects or inside formations etc. (asteroid fields/rings, dust/gas clouds, scrap fields, rock formations of other origin). The means of flying from one sector to another would consist either of a “in-system jump drive” or, again, acceleration gates. However, travelling from one star system to another requires the space ship to be far enough from the gravitational influence of the sun(s) and planets, meaning that one would need to get to the system’s far end (depending on its size, the “far end” can vary :D) to use the inter-star jump drive. Parallel to #1, pirates would eventually be able to stop ships by disrupting acceleration lanes or the ship’s in-system jump drive along the path.

system_concept3

Discuss. :)

Tags: , , , , , , , , , , , , ,

3 Comments


In the name of Linus, the community and the FOSS games…

HAH! You expected comprehensive update, didn’t you? I fooled you well into thinking that, huh? Not yet, you will get your comprehensive update on the matter - not too soon, though.

I recently supported OpenGameArt.org with a few submissions I dug out from the ancient catacombs that is my textures folder - some of which were supposed to get into a CS map called de_southernfrance (hence the sf_ in the beginning of the file name) a friend made, others were supposed to get into a Sauerbraten map I wanted to make or something else. I still have to upload a bunch of other old textures, though. I’m even thinking about subscribing to OGA with 5$/month. What about you?

In other news, I use identi.ca now, kind of… It’s like Twitter, but without the suck. I’ll use it for my FOSS moments I guess.

Stay sharped.

Tags: , , , , , , , , ,

8 Comments


Evening C7 jam

So imagine you’d have this funk band in some smoky pub playing after a nice midday meal. They’d consist of a keyboard player, who’s kind of new to the whole concept of the band, this bassist, who got a little tipsy now, and the drummer would do his daily job. After having had lunch, they decide to start gently, so they start with the following jam I have titled “Simple Times”.

simple-times

Creative Commons Attribution-ShareAlike license 3.0

I finally got around jamming something as a whole with my keyboard, my bass and my drum machine. Just for the record though, I mainly play bass guitar, so the keyboard part sounds a bit clumsy.

No Comments



SetPageWidth