Time is Ticking (gadget for windows vista/7)


Looks of gadget on desktop, in according pane, and on it's settings screen.

So I've randomly found out that Windows 7 (and Vista too) gadgets are written in HTML+JS+CSS.
Next thing I did was writing my own gadget. So this comes.

'Time is Ticking' is a minimalistic stopwatch. As such, it's purpose is to allow measuring for how long you were doing (or not doing) specific thing. Can be motivating.
Gadget can be considered optimized (does operation and a redraw once per second when on, is entirely idle when off), features customizable backgrounds with ability to specify your own (navigate to %USERPROFILE%\AppData\Local\Microsoft\Windows Sidebar\Gadgets\TimeIsTicking.gadget\image and add 160x32 PNG images to be able to chose them by-name in settings), and is pretty nice-looking overall.
For best experience it is recommended that you have font Dejavu Sans Mono installed, so digits would display appropriately.
To avoid accidental triggering, pause\restart buttons require double-clicking them to react.

Download

CPP – [busy] sleep() function via time.h

As you may know, there are multiple ways to create a sleep\delay function in C++.
These may appeal more or less to you depending on system and libraries available.
The following short function uses functionality of time.h header, which makes it useful for cases when dos.h is missing and you do not want to include windows.h just for a single function.

void sleep(int ms) {
	clock_t target = clock() + ms;
	while (clock() < target) { }
}

AS3: MinimalFramework


Trivia: Compiled SWF seen on this image takes less space than an image of it.

I made this tiny "framework" some time ago and successfully used it for a handful of jam games, including those with size restrictions (such as Pipe10).

Structurally it is inspired by FlashPunk, and includes a 04b03 lookalike font compressed into 1.3KB worth of data.

See code (Gist)

GameMaker: Dungeon generation


Fairly big, fairly maze-y, has some rooms, and takes little time to generate

This is a small update to my 2010 dungeon generator example.

The main change is that it now treats high values of "cut dead end" parameters correctly, no longer placing unconnected rooms even if there's enough space to allow that.

Also there's now a small demo on how to use the resulting data, placing some walls and a player to wander around as.

Download GMK

Update: Also see this post about this approach to dungeon generation.

GameMaker: Surfaces and scrollable content

In some cases, a moment comes when you need to display specific content in a area smaller than itself, thus requiring scrolling.

GameMaker does not support 'clip rectangle' type of command for its reasons, however it is easy to 'clip' area to be drawn by using an 'buffer' surface to draw content in, before drawing that to screen.
Attached example illustrates sample implementation of such.

Most often, content of such would be text. And maybe an image. Or two.

Since images would require a bit more code, example does simple and efficient - long long text is rendered into a surface, which is later drawn into an other 'buffer' surface to display it as part of window on screen.
Also there is a scrollbar, which obviously can be improved, if it needs to serve purposes other than displaying position of 'window'.

Download

HTML5+JavaScript: Tiled background cache


Not much of informative demonstration, but is cross-platform and shows performance.

If you've noticed, multiple systems are better at drawing single large images than lots of small ones.
Same applies to HTML5, meaning that filling a 640x480 canvas with 40x40 images using two for() loops is not exactly a good thing to do each frame.

Common solution to this problem is to create a 'cache' image that would hold a tiled version of image to be drawn easily.
That means drawing image W*H times only once in a while.

However, actually you can do even better than this.

Continue reading

Minecraft: Automating creation with WorldEdit


Possible future candidate for an adventure map

From my point of view, creating a tool, that would perform your desired action efficiently, is often better than just doing mentioned thing.
In last few days I've developed a small tool that translates given commands into series of WorldEdit plugin commands, and provides simple interface for writing dynamic scripts that modify world contents, even without having access to server to be able to import JS scripts.
Since game handles input nicely, a single message can be sent every 200..300ms, meaning that subset of commands needed to change selection bounds and perform desired operation over it often takes less than a second to perform, in comparison to minute-measured time needed to do same manually.
This opens rather interesting perspectives of automating creation of typical structures, as well as making it possible to push procedurally generated content into game easily.
Yesterday I've spent some time to port part of RPG05's dungeon generator for use with this, and this is the result.

Continue reading

Love2d: Platformer engine


Looks nice enough, right?

In free time of last days I've been developing earlier mentioned thing in Love2d, which is platformer engine.
One provides a simple framework for games that use combination of aligned tiles and dynamic objects.
As well it adds a easily modifiable system to load levels from strings, giving freedom for implementing level editors.

You can download a compiled version here or watch discussion thread on official forum here.