Category Archives: Code

Posts about Code.

Code, Glorious Code!

0
Filed under Code, Ludum Dare

The vast majority of my projects seem to erode quite badly with bitrot, so I’ve taken all my LudumDare entries – including incomplete and unreleased ones – and splattered everything that I have of them up on github.

This includes:

  1. LD11 – GEvOlve
  2. LD15 – Moons of Subterrane
  3. LD16 – derelict_
  4. LD17 – Yargh!
  5. LD18 – T.I.T.A.N
  6. LD19 – Germies
  7. LD21 – Thieving Fingers
  8. Mini LD11 – Little Quirks
  9. October Challenge 2011 – Little Quirks

Interesting ones include:

  • Yargh! – which used rather little of SGZ2D’s functionality, and did the vast majority of it’s logic in Lua.
  • T.I.T.A.N – which uses it’s own unique little SDL powered engine, based on Components and Entities.
  • Germies – which is one file, all C with SDL, and written in seven hours.
  • Thieving Fingers – which is the first to use GLESGAE, and rooted out vast amounts of bugs and things.

T.I.T.A.N, Fingers and the both Quirks projects haven’t been released till now, so feel free to clone, fork, poke and prod :)
GEvOlve is a load of mince… it can be thought of as the wooden spoon entry, as it was the first thing to use what turned into SGZ2D.

One final thing to note, is the main reason all these have been put up is that of bitrot as I mentioned above… Little Quirks has suffered the most, as the release included isn’t the final demo that I had done, which is shown in the screenshots on the project page. This is a shame, as there was a lot of extra logic put in, as well as some actual gameplay. The tileset was also more complete, with a few more interesting tiles of which some were recovered for the October Challenge re-do, but not everything, sadly.
That and I’m more likely to be able to go back to them when they’re in a more workable condition like this!

You can find them all on my github here: https://github.com/stuckie/ludumdare.

7 Days of ActionScript – Day (and Night) Seven

0
Filed under 7 Days of ActionScript, Code, The Quest

I finished my little Sudoku thing the other day.

Day Seven was very productive, though due to starting late, it did drift into late night/early morning!
Although I didn’t get sound done ( or bitmap loading, either.. it was all drawn shapes, ) I did get a lot done, and my little Sudoku game actually worked out fairly well considering I did a crash course in ActionScript within a week.

I’ll put it up soon for a giggle.

One thing that tripped me up a huge amount was variable scoping.
Usually, variable scope is to the current code block.. so if you were to do:

1
2
3
4
5
6
7
8
9
10
void myFunction(const bool inputBool) {
    bool myBool(false);
    if (true == inputBool) {
        bool anotherBool(true);
        myBool = true;
    } else {
        bool anotherBool(false);
        myBool = false;
    }
}
void myFunction(const bool inputBool) {
    bool myBool(false);
    if (true == inputBool) {
        bool anotherBool(true);
        myBool = true;
    } else {
        bool anotherBool(false);
        myBool = false;
    }
}

You wouldn’t have a problem, as anotherBool loses scope in each block.

However, doing something like:

1
2
3
4
5
6
7
8
9
10
public function myFunction(inputBool:Boolean):void {
    var myBool:Boolean = false;
    if (true == inputBool) {
        var anotherBool:Boolean = true;
        myBool = true;
    } else {
        var anotherBool:Boolean = false;
        myBool = false;
    }
}
public function myFunction(inputBool:Boolean):void {
    var myBool:Boolean = false;
    if (true == inputBool) {
        var anotherBool:Boolean = true;
        myBool = true;
    } else {
        var anotherBool:Boolean = false;
        myBool = false;
    }
}

You’d get an error, as anotherBool was declared in the first block.
ActionScript’s variables are scoped to the function.
Which is really flippin’ annoying when you come from a background of coding the first way!

But yes, I’m proud of my little Sudoku game, done in 7 days, in ActionScript, on Linux.
It’s not very fancy or pretty, but it does the job. ActionScript has a rather large amount of support code that I didn’t get anywhere near ( like for Images, the preloader stuff, Audio, etc… ) so maybe I’ll have a look at them next time.

Still, it was fun :)

7 Days of ActionScript – Days Five and Six

0
Filed under 7 Days of ActionScript, Code, The Quest

Day Five was not wholly productive as I found out I had managed to download the 4.1 version of the Flex SDK… they’re up at version 4.6, which added, amongst other things, “native” JSON support.
That was clever of me.
So the few hours I had were spent banging my head against the wall, wondering why stuff wasn’t working, then spending the rest of it downloading the _correct_ SDK. I did at least get some working file utils going, so wasn’t completely wasteful.

Luckily, Day Six has been very productive and I now have my example up and running.
It’s a little Sudoku game. Why? Because Sudoku itself is a relatively straight-forward game with some nice little mathematical fun to it – especially when figuring out a decent solver.
All you need to do is fill a grid with numbers from 1 to 9, and ensure each block has unique numbers, along with each row and column.
Granted, my solver just brute forces it at the moment, but I’ll take simplicity over complexity any day… that and I’ve still got to try and make it look pretty, as all it’s doing is reading an array from a file, fiddling with it, and spitting it back out to another file. Not really game material, eh?

So, tomorrow is effectively my last day on this… and I’ve still to figure out input, displaying graphics, proper event management, playing sounds… at least my shoulder has healed up a bit, and I can work a bit later into the night again.