jump to navigation

NumGame August 2, 2008

Posted by blueapple in Other.
add a comment

A friend tried to explain the concept of a game he had played somewhere, but couldn’t recall where. And as it’s not that easy to come up with something to google for (“rotating squares game?”), he asked me if I could create something silmilar for him. Sure.

He explained that there were supposed to be nine squares in a 3×3 formation with the numbers one to nine. And you could apparently rotate four 2×2 squares (Those at the corners). The goal was to return a scrambled board to its orginal state where the numbers appeared in order.

So this is what I threw together last night.

I named it NumGame in lack of a better name.

It is still a prototype though, but the basic features are there. Scrambling, rotating and solving. The squares are even animated when moving.

Looks cooler in action though.

I’m thinking of putting some cool plasma effect as backround to make it more interesting (and even more confusing).

Harder than it looks. Heh.

The binary is pretty much ready to be released, I just have to pack it down and upload it. I’ll post a link in the next post.

BlueBPM July 31, 2008

Posted by blueapple in Other, Projects.

Yet again I’m sorry for the recent lack of updates, but it’s summertime, so I guess it’s okey for this time. I haven’t really had any time to work on either Hydro nor Boteria lately. But that will change when the rain and snow starts falling from the skies.

Even so, I have something to give you at least. It is something I hacked together over a day when being annoyed of not knowing the BPM (beats per minute) of a song when programming my drum machine. And voila, BlueBPM was born.

Not much of a screenshot, heh.

This thing is often found in metronomes and drum machines (not mine though), where you tap a button to the music and it gives you the BPM. Quick and without any hassle. Not that I did a very big search for any existing ones for the computer, but the ones I found required me to install big and ugly applications which is not what I want for a small task like this.

Here’s the download link: BlueBPM-1.0.zip

Small hint: Click the BPM panel and you’ll get to see the about box.

Update July 3, 2008

Posted by blueapple in Hydro, Other.
add a comment

Hey again!

I’ve reached 20% mark on Project Euler, or at least I had before they released the 200:th problem. Now I’m back at 19% again with 39 problems solved. And I must say that I have learned a lot about Haskell, but I am now starting to run out of problems which can be solved in ten minutes.

Worth noting is that I have not solved them in order. The most difficult one according to the websites ranking system is 120 and the one with the highest ID being 145.

Also, I am preparing to release a small demo of Hydro. I just need to sort out a few bugs and maybe create a fun map or two. The ones I’ve got now aren’t that fun to play, as they were just made to test things out.

Project Euler June 24, 2008

Posted by blueapple in Other, Programming.

I’ll have to admit it, Project Euler has got me hooked for the last few weeks. It all started with a friend asking me for help regarding a math problem. It didn’t take long before we had figured it out, but I was interested where he got it from, as it involved writing a program to generate the solution.

Project Euler, he said.

To summarize the whole thing: It is a website which presents various (At the time, 199) math/programming problems. Once you have submitted the correct answer, you’ll be given access to a forum thread where people post their solutions and thoughts about the problem. In some cases, there is even a pdf-file explaining the problem (and how to solve it efficiently). You’ll be amazed how some people solve the problems. Me sitting there, proud of my 100 lines of code and seeing a solution in two lines that generates the solution five times as fast. But one learns a lot.

I saw this as an opportunity to learn Haskell too.

Haskell is a standardized purely functional programming language with non-strict semantics, named after the logician Haskell Curry.

Wikipedia: Haskell (programming language)

It is quite different from C++ (or any imperative programming language). But not different in a bad way. One of the cool things with it is what is called “lazy evaluation”. It allows one to declare something which is not computed until it is needed. So you can declare a list of all primes, or a list of the whole Fibonacci sequence (which is infinite). And then, the element you want will be computed only when you need it.

Now, I’m still a beginner with Haskell. But I’m learning more each problem I solve. I would recommend using Project Euler either as a tool to learn a new programming language or just to give you exercise with one you know. It’s a fun challenge, can you make it to100%?

Bacteria and Bots June 10, 2008

Posted by blueapple in Boteria.

Ah, yet another lame attempt to make a cool name: Bot + Bacteria = Boteria.

This project started to grow in my head a couple of weeks ago. I’ve always enjoyed playing various “programming games”; which are games that allow the programmer (gamer) to write an A.I. and then watch it fight other programmers’ A.I.s.

A programming game is a computer game where the player has no direct influence on the course of the game. Instead, a computer program or script is written in some domain-specific programming language in order to control the actions of the characters (usually robots, tanks or bacteria), which seek to destroy each other.

Wikipedia: Programming Game

My favorite has become Grobots (Pronounced “grow-bots”). It is described as

[..] a game in which robots eat, fight, and reproduce under the control of programs written by the players.”

And that is basically what’s to it. The fascinating thing about it is the complexity of the A.I. that can be written. Take for example the side Flower by Tyson Hoffman. It tries to position it’s cells in the shape of a flower and quoting Hoffman:

It [Flower] forms rings, which grow from the center this means the outside can be damaged, but still have a viable center.

Here’s a picture of it:

If you want to have a look at it’s source code, check out Hoffman’s wiki, located here.

It is sad to see that the popularity of Grobots has declined a lot, though. I believe it is partly because of the scripting language used. It is an implementation of the language Forth. The more popular games use C-like languages (Robocode – Java, Robot Battle – Mix of Basic, C and JavaScript).

Although, the concept of Grobots beats all the “robot-on-robot” type of games with horselenghts, the language makes it unattractive. So I decided to give it a shot: mixing the concept of Grobots with a more inviting scripting language.

What language to use then?
The choice stood between Python, Lua, GameMonkey, AngelScript and creating my own.

Creating my own would take ages and would not be even close to what the other mentioned has to offer.

AngelScript and GameMonkey both use a C-like syntax, while Python and Lua have a more BASIC-like (atleast Lua).

Lua and Python are big and well-known, they have been proven to work numerous times, both by amateurs and professionals. GameMonkey and AngelScript on the other hand are relatively small, compared to Lua and Python, and are not as widely spread.

I went for Lua. Why? I did already have some experience with it and the others just didn’t work the way I wanted them to when I tried them. A big tip if you choose to use Lua in a project is to checkout the LuaBind project which makes the process of binding C++ (classes etc.) to Lua a breeze in comparison to doing it without.

Now, after a few evenings (and nights) I’ve got bots flying around, following and bouncing of each other.

The blue circles are “sensor shots” which are used by the bot to get a list of objects in range.

This is what an update function can look like at the moment.

last_sensor = 0
last_seen = 0
e_id = -1

function update(me)
    if e_id == -1 then
        if me:getTime() - last_sensor > 30 then -- Scan for a target every 30:th update
            bots = me:useSensors(0.5)
            last_sensor = me:getTime()

            if bots:getSize() > 0 then -- There was a bot in range
                e_id = bots:getAt(0):getID()
        if math.mod(me:getTime(), 3) == 0 then -- Use the sensors every third update
            bots = me:useSensors(1) -- Full strenght (0..1)

            if bots:getSize() > 0 then
                i = 0
                while (i  60 then -- It's been more than 60 updates
                e_id = -1                                   -- since we last saw the target,
                me:setEnginePower(0)                  -- let's find a new one.

Now that I see it, it looks almost more unattractive than Grobots’ code.

But step through it line by line, it is quite logical after all and this is after only a few days of work (Things will change, it is by no means final).

As always, here is a video:


The two bigger bots use the A.I. posted above, notice how they get stationary when they lose their target (e_id = -1). And also, I disable the drawing of sensors in the middle of the video.

We’ll see where this leads. (Skynet anyone?)

Yellow Flowerpot June 1, 2008

Posted by blueapple in Hydro.

Hey all, sorry for the recent lack of posts. But here is something to show you that I’m not dead (yet):

I decided to keep the yellow rectangle (but I’ll probably change its color) as a “virtual” flowerpot. It’s much easier to guide water into it rather than into a one-pixel thin tree.

Hide! It’s a Tree! May 6, 2008

Posted by blueapple in Hydro.
add a comment

Hey all.

I have been thinking of new things to implement into Hydro. A few of the ideas are: new particle kinds, eye candy, a cool interface or multiplayer support. I went for the eye-candy this time.

What I wanted to do was to get rid of the ugly goal (the yellow rectangle), and put something that actually “needs” water.


One of the thing I wanted my trees to do was to scale and “evolve” once they got water. Sprites would mean a lot of work and wouldn’t quite blend to the “artistic style” of this projects (i.e. pixels), but a “pixel-tree” would and that’s what I chose. I started to read about fractals and especially the type called L-Systems, which basically are objects generated by pre-defined rules. For example:

turn 40 degrees
move x pixels
decrease x

As a branch of a tree in most aspects looks lite the tree itself, just scaled down, it can be modeled by a recursive function, such as the one above.

Now, I haven’t implemented it into Hydro just yet, but here are some screenshots and a clip of what I’ve come up with this far.

And a short clip of it in action:


I believe this will look quite good when it’s “in the game”, we’ll see about that in a few days.

Steam Movie May 4, 2008

Posted by blueapple in Hydro.
add a comment

Here’s something to eat some popcorn to.


YouTube did once again ruin the quality of the video, this time with a quite devastating effect: You can hardly see the steam particles, which is a shame, because they are what I was trying to show in the video.

But check it out and try to mentally mix it with the screenshots.

Hydro Update 1 May 3, 2008

Posted by blueapple in Hydro.
add a comment

I present to you…steam!

The red line you can see is the “thing” that makes water boil.

This feature will allow more complex and fun levels to be built.

I’m quite satisfied by the visual appearance of the steam (atleast in motion, the stills doesn’t quite capture the charm of it). At this moment, I do not have any video available for you, but be sure that one will come.

Thoughts on maps May 3, 2008

Posted by blueapple in Hydro, Programming.
add a comment

When coding something like this (Hydro), early in development I’m not really interested in developing tools. I want to get the “thing” done (or atleast close too), not waste time making leveleditors and such. Therefore, I looked around for alternatives this time.