GrayScale – dev log #1

grayscale - after

I’ve been posting couple of GIFs around the internet from my GrayScale game but never explained how each thing works. This post was originally written at Snowkit.org. It is a good place to start, if you’re reading this then you would find some luxe-related things interesting. In fact I think I managed to create/discover at least one interesting thing about luxe that I wanted to share with you (physiiiics).

I won’t call myself an expert in programming and this post is in no way a tutorial on “how to do things“. With luxe you can find your own way of coding. I’m just sharing what I discovered and had fun with

Quick intro

GrayScale is a small game I made for GameBoy Jam last year. It was made in HaxeFlixel but I wanted more control over my code and be able to easily create lots of enemies with different abilities. After few hours of googling I stopped by a thing called “Component Entity System” and finally found luxe engine (and so far I love it!). You can read more about the project itself on my blog.

Movement & “fixed time rate

Movement is the core gameplay in here, you can walk, run, dash and jump-attack. I organized each type to extend from one Mover component so each kind of mechanics share the same base (which is really thin so far). With components it’s easy to make characters controlled by player or AI and make them move by similar rules. I can make new enemies that walk around and dash-attack the same way that player does. Movement can be basically used for moving any kind of objects around the world. This way I could use it to move projectiles, doors, platforms etc.

Continue reading »

GrayScale – Re-making from scratch

collisionsTest2

Some time ago I decided to keep updating GrayScale. It was created using HaxeFlixel, which is great for quick prototyping small games. Maybe it’s my limited knowledge of that framework but I discovered that It gave me too much problems while developing. Adding new enemy means lots of copy/pasted code or strict inheritance.

Next I found out that it tried to do most of the work for me. It’s usually not a bad thing, but when something goes wrong or when you start seeing performance issues on slower machines, you can’t quickly find what seems to be a problem. Another bad thing is that it laggs horribly while recording a video, I’ve seen at least 2 letsplayers who had issues with my game.

Then I found luxe engine.

Component entity system would solve my problems with creating new enemies/abilities. Direct GL calls everywhere (OpenGL/WebGL). No Flash. Plus I could add fancy GLSL shaders into the game, like explosion shockwave or changing colors in runtime without using thousands of different sprites.

Luxe engine enforces programmers to do most of the job, but thats OK with me. I have more control over what I’m creating. I define how physics work, how collisions are calculated in tile-based world.

Box learned a new trick - Stomp

Continue reading »

1GAW – #4 Simon says

simon_prev_head

Press Enter to let Simon talk… and then follow his word.

This Simon says prototype was fun to create. There’s a lot of event based movements and 2 custom components. One for making buttons clickable and another to make them shine for a bit when Simon says.

If you’re new to the Luxe engine, I’d like to introduce the config.json file. With this little beauty you can make changes to your game world without needing to re-build the whole code. In this example I used it to set width & height of the game but also to change colors of Simon’s buttons, as you can see in the image above.

Continue reading »

Twitter widget refresh

I couldn’t find anything in the Twitter Embedded Timelines documentation that would let me set refresh interval so I made my own. At first I thought I could simply reset the iframe’s src attribute, which usually would reload frame’s content. But Twitter’s widget didn’t had src attribute.

I found a solution. It’s really quick and dirty one, but it works. You can get and modify it to your needs. I’ve only tested it with list’s timeline.

Continue reading »

setTimeout with reference to object

The problem

Calling setTimeout or setInterval from an object can be sometimes problematic. The timers are executed outside of your object’s context. You loose reference to your object and can only work with global variables. this suddenly points to window instead.

Solution

I’ve found out that there are plenty of ways to achieve it only after I published this post online. You can use whichever you suits your needs.

  1. using closure
  2. bind(this);
  3. Immediately executing function expression

But first lets see what we’re working with. For all three methods we’ll use the same object, only one function will look different. We’re creating new object of type Person with name Steven and make him say his name after the delay using setTimeout.

// Create new 'class'
function Person(name_)
{
  this.name = name_;
}

// Say whats my name after 2 seconds
// we plug in the reference to `this` person
// with variable named `self`
Person.prototype.whatsMyName = function()
{
  // This one will fail silently with an empty log
  setTimeout(function(){
    console.log(this.name)
  }, 2000);
}

// Define Steven and call him!
var stev = new Person('Steven');
stev.whatsMyName();

Continue reading »

Floating Islands (update 2)

09 - Hr1Z55y

Islands are finally done – for now. I’ve managed to finish this project and pass an exam with the highest grade (It was my project for university). You can check the walkthrough video below.

My job was to use all UDK’s sample content to create something extraordinary with one rule: “Make two paths from point A to point B, one with obstacles”. You can tell that jumping on the rocks supposed to be the harder route, because it requires you to jump. There’s another, much longer route by the stairs.

I’m not done with this project yet! UDK is great tool to quickly set-up your world with sample assets. But you know whats better? Unreal Engine 4. Floating Islands are going to be my bachelors degree project so if I’m gonna make improvements to this world, I’ll need to change my tools. I’ve already played around with UE4 before getting started with UDK and I can already tell, that thanks to my little experience with both tools, I am able to re-create the whole project with much more efficiency then if I were to keep on improving it in UDK alone.

Watch

Screenshots

Pixel Sprite Generator

pixelspritegenerator

Recently I’ve found this interesting Pixel Sprite Generator. You can create procedurally generated sprites on the fly. It uses ala 2D array of values to draw solid outline, “soft” body or an empty pixel. Provide just one mask and get milions of variations.

I can see it being used in rougelike games, besides procedurally generated levels: enemy sprites, weapons, items, EVERYTHING.

It is written in JS so I couldn’t help but port it over to Haxe!

JS version draws on canvas and Haxe on openfl.BitmapData. Enough talking, go check live example if you’re not yet excited:

Live Example (keep refreshing that thing for new sprites!)

Commits