Lachlan's misadventures in games programming

Friday, 3 February 2012

Button Bar

2/03/2012 05:36:00 pm Posted by Lachlan No comments
Short post:
Logic on the button bar works! You can now click a button and it will execute a script from a file.

(Slightly later more info edit)
I've added else's to the script interpreter. I also added a couple of "status" user fields that I can store information about features on. So now, the blue button can make a platform go up and down by being attached to the following script file being called on button_down:



i 0
f_1 status1
if_equal
f_1 motion = "m -19 0 0 -1000"
f_1 status1 = 1
else
f_1 motion = "m -19 500 0 1000"
f_1 status1 = 0
end

Wednesday, 1 February 2012

Button Bar

2/01/2012 06:22:00 pm Posted by Lachlan No comments

I've added buttons. They can be programmed, and with tomorrow code will work.

There can be any number of them (well, up to 254 anyway). They can be created within the game with commands like
Game add_button "Button_Down_Pic.png" "Button_Up_Pic.png" "ButtonDownScript" "ButtonUpScript"
This is  important so I can make levels work.

But, in a bit of a rush - so expect update soon.

Monday, 23 January 2012

Logical Script Interpreter

1/23/2012 12:55:00 am Posted by Lachlan , , , No comments
I've finally added some logic to my script interpreter "Puppet Master"

OK. Script interpreter is a bit of a misnomer. It more can accept commands for classes (like the game, the player or a platform), and change variables in classes. So, for instance, the following would change the platform f_1's x1 to 10
f_1 x1 = 10
I've taken the laziest reasonable possible approach to making this into as much of a language as I need: I've tacked on a basic stack - like on a reverse polish notation calculator (see http://en.wikipedia.org/wiki/Reverse_Polish_notation). So whenever I get a value from somewhere (like getting f_1 x1), it now drops it on the stack, which goes up to 6 numbers - for really no good reason other then it was simple to code and won't take much memory.


However, this still left how to put "literals" on the stack. So - if I wanted to directly put the number 5 rather then part of another one. This would violate the relatively simple parser which looks for an object name (defaulting to the puppetmaster itself if it can't find it), then the member and triggers/sets/looks at the variable. So I added 5 basic commands to the puppetmaster that simply say the type of literal you want. So to add the literal integer "234" to the stack, you would go
i 234
I'll add some arithmetic and other commands soon to allow better use to be made of the stack.

Now - how I'm handling the very basic logic (which I'll extend as need be): I've got two commands that deal with it: if_equal and endif_equal takes the top two elements off the stack, uses boost::lexical_cast<std::string> to compare them, and if equal keeps going. If not, it increases the new variable inactive_blocklevel by 1. In general, if  inactive_blocklevel = 0, the program processes the line as usual. However, if its any greater, it  will ignore any lines other then the ifs (which will increase it again, to allow nested ifs), and end (which decreases blocklevel by 1, meaning that if its gone back to 0, code will be running again). The point of this is that it can allows ifs inside of ifs. It doesn't allow the possibility of elses at the moment though - its a really fairly simple method of parsing that will do its job in this program. I'll be adding more versions of if to make up for the lack of else.

Edit: 3/02/2012
Turns out lacking else is very limiting. Hence, I added it - and it was simpler then I thought. All I did is after checking for end and if_equal's when inactive_blocklevel > 0, I added a further check that if inactive_blocklevel = 1 and the command was else, drop the inactive_blocklevel. And, vice verca, increase it if inactive_blocklevel = 0.

At some stage, I will have to write down the details of the scripting language. But it is mostly simple, and is very limited in power. However - its adequate for its job of describing the logic inside levels, and would probably continue to serve for any other games I make with a modified version of this engine. It is a bit limited by my abilities from when I started writing it though and I would probably do it different if I'd started now. But refactoring is the root of all unfinished indie games.

As you may have noticed as well from the picture, levels can now have backgrounds. This took a little longer then expected, but works well.

I'm going to start adding some of the buttons soon. I might add another function to allow BASIC style subs to be called - or at least extend the load script from file function so I can have multiple functions in a file to prevent needing to have stacks and stacks of files for a single level. I hope to have a level in two files - one of scripts, and the other of the level. GFX/Sound will be stored separately.

Also need to code the stuff to make a teleporter work as it's needed extensively in the later puzzles. But have to work out priorities. Still need to code the stuff to turn Jack into a sprite rather then a white box, for instance. Or do a few of the levels as mockups after I add buttons. We'll see. Just - the more engine I do before doing levels, the less I'll have to redo levels.

Still trying to figure out when to aim for a release. Considering aiming for mid to late February - depending if a couple of other commitments arise or not. Would prefer earlier but unsure if it's tenable. Either way, the foundation is slowly being laid.

Monday, 9 January 2012

Linux Support

1/09/2012 06:43:00 pm Posted by Lachlan , No comments

I've successfully got Jack to compile and run on Linux (screenshot below).


As I've got no familiarity with linux C++ development, I went for the Code::Blocks IDE which I found more then passable. I compiled on Mint-Linux as it has been my distro of choice, bearing similarities to both Debian (with use of APT for packaging) and Ubuntu (from whence it originally came) but somewhat lighter. I ran it inside Virtual Box.

I spent a decent chunk of time recompiling and getting headers and libraries etc. as the repository had old ones. I also spent a significant amount of time fixing up the little things that VC++ lets you get away with. And file names. I had to fix a lot of file names in #include's due to Linux's case sensitivity.

I also made some progress with the memory leak: I got tools to find it. I've installed Visual Leak Debugger which seems to work fairly well - but missed the majority of the leaks. I recompiled SDL with Visual Leak Debugger (which was more "fun" - see http://stackoverflow.com/questions/8782561/compiling-c-code-with-vld) but then it worked perfectly. And dumped pages and pages of allocated memory going to SDL surfaces and the like. Whoops.... that'll be a fix job for a little later.

Moving Platforms!

1/09/2012 12:59:00 am Posted by Lachlan , , , No comments


Three pieces of news for Jack:

1) I have a memory leak the size of the titanic. Specifically, in the editor, probably in the gui stuff. I'll have to fun around with some duct tape to fix it later. And quickly. The editor has always gone blank after a little while. Thought it was a little bug. Until I checked the task-manager to find my little game had "borrowed" more then half of my RAM, and I was completely out. Really needs fixing.

2)
I HAVE MOVING PLATFORMS!
I can type a little string in, and a platform will follow the orders. For instance:
W 5 M 100 0 50 0 X 3 R 0 0 -50 0 X 4 R 100 0 50 0
would:

  • Wait five second
  • Move to (100, 0) at a velocity of (50, 0)
  • Wait 3 seconds, then put another wait 3 seconds at the end of the queue
  • Move to (0, 0) at a velocity of (-50, 0), and put an identical move at the end of the queue
  • Wait 4 second , then put another wait 4 seconds at the end of the queue  
  • Move to (100, 0) at a velocity of (50, 0) , and put an identical move at the end of the queue
  • Wait 3 seconds...
Its a really simple script. The idea is that there are really 4 commands: Wait (w) , Move (m) , Wait and Repeat (x) and Move and Repeat (r). Wait and Move commands just disappear after running. The repeating versions add themselves to the end of the queue. So - if I wanted a platform to move between two platforms, then move back and repeat, I would use 2 move and repeat commands, and they would just keep moving.

In absolute fairness, they are not entirely coded. I need to now code the behaviour of the actors attached to the platforms (or touching them) so it is predictable.

3)
I'm considering setting a release date for an Alpha - giving me an absolute definitive time goal. I'm considering either the end of January, or midway through February. Problem is, whilst code is reaching completion (or at least approaching it slowly. I find it difficult to judge...), nothing else is - save for most of the design of the levels. And I'm really not sure how long it will take to use my crappy level editing tools to make my designed levels a reality. And I have no sound or music (or programming for such). And haven't programmed graphics beyond coded rectangles. May not need much work on graphics though - as I have done most of it (I think) in a blueprint style that will look similar to my last post, with a dock on the bottom with large, multicoloured, vector drawn, half top down buttons.

4*
Current code stats:

Files 75
Lines 6072
Statements 3549
% Branches 23
% Comments 3.1
Class Defs 34
Methods/Class 9.71
Avg Stmts/Method 6.6
Max Complexity 46
Max Depth 9+
Avg Depth 1.93
Avg Complexity 2.9
Functions 12


* I don't think it's really news. Hence not counted.

Monday, 12 December 2011

Ideas for art style

12/12/2011 11:54:00 pm Posted by Lachlan , No comments
I've been trying to work out what Jack should look like. Here is one idea:


A blueprint has the joint benefits of being simple to draw, and somewhat unique. I still don't know what the best way to implement switches etc would be. I could always do it as a blue print now, and make it more 16-bit pixelly later.

This is only an idea, which may or may not end up being implemented like this. But it honestly is an idea I like.

Thursday, 8 December 2011

Mighty Ascension of Jack Finished Design?

12/08/2011 12:39:00 am Posted by Lachlan , No comments
I think I've finished the design of the Mighty Ascension of Jack (the final level), though won't know for sure until it is made and playable. Furthermore, this is the last level that I will be designing for now unless any bolts of inspiration hit me, and my efforts now will be focussed on making these levels playable - including sound, graphics and most of all, programming. My design efforts will be largely limited to tweaking the design to better work with the code

The Mighty Ascension finishes now with a squish area with stop signs for timing, a small but elegant teleporter puzzle, a small life and a final subtle teleport. I don't know whether this will be fun or not, but I hope so. The whole bloomin thing, the level that is in scale, about 5 levels worth of level is reprinted below.



Monday, 5 December 2011

The Mighty Ascension of Jack

12/05/2011 11:03:00 pm Posted by Lachlan , No comments
Current status of the Mighty Ascension of Jack (Final Level)
I'm still working on the final level. You can see my latest work sitting on the top above the top red line.

I struggle with puzzle design... Maybe one or two parts to be added - but I do actually like the top bit.

Lets see what happens

Tuesday, 29 November 2011

The Mighty Ascension of Jack

11/29/2011 12:16:00 am Posted by Lachlan , No comments
The Final Level So Far
I'm still working on the final level. I've started working on the next stage. I had a pretty cool idea of what I wanted, but I don't think that I have quite got what I wanted, and that it may not be as much fun as I'd like it to be at the moment.

I think I might need to redo it. I'll see if I can improve it more a bit later.

Sunday, 27 November 2011

The Mighty Ascension of Jack

11/27/2011 02:09:00 am Posted by Lachlan , No comments
Part of (the only designed part of) "The Mighty Ascension of Jack"
I'm playing with the idea of making a big final level for my "Jack is a Fool" thing. Now - it's still my intention that what I release will be only about half an hour long, and only a fairly short game from which I can figure out whether its fun, and probably release it as freeware. It won't have graphics that it would if I turned it into a longer commercial indie game. But anyway. I digress.

Big final level. Portal has a phenomenal final level. In it, you use all the puzzle solving techniques you've used throughout the rest of the game to be able to finish a big epic amalgamation of the puzzles. Something nice and final. I think the idea of ascending to the surface in Portal 2 is brilliant too, and feels good. So - I've been thinking of combining the few styles of puzzles I'm using into one big final level that will have hopefully interlinked puzzles, a couple of checkpoints and something that will hopefully feel like a satisfactory finish even if the game is somewhat short.

So far, I've designed the grand total of what you can see above. In reality, it's about a third of the length as I'd like it to be, and currently has about 3 puzzles in it - linked by the big lift in the middle. I think, once I've finished designing it (at least to some level I'm remotely happy with), I'll call my "designs before programming" a day, and start working towards making them work.

Tuesday, 15 November 2011

Teleporting Levels

11/15/2011 06:54:00 pm Posted by Lachlan No comments
I've been experimenting with an idea for a new mechanic - even though I haven't really done that much with the 'Stop' one. But I got bored with it - so we'll add more as inspiration strikes. My new puzzle mechanic is teleporters. You can see how they will work below:
The idea is that when he's in a teleporter, you'll see a 'ghost' of where he would come out. You push the button, and he will teleport to the other side, in the same direction and speed he went in as if nothing happened - just at a different place. So far, I've designed one Introduction to Mechanic level ("For science. You monster."), one easier puzzle ("Teleprompter") and a very suddenly more difficult level (I think) ("Tower of eternal telefrags"). I may do some more of them.

For science. You monster.

Teleprompter

Tower of eternal telefrags.

A notable limitation is that none of these levels incorporate any of the mechanics (other then being squashed) from earlier levels. I'm going to try to do a couple that particularly combine stop signs and teleporters. I also think that there needs to be a bit gentler of a transition to Tower of eternal telefrags - so adding another level there.

By my (admittedly baseless) estimate, the level designs will have about 21m of Gameplay time. When I actually program them, we'll see whether my estimates are close or way off. I'll probably stop the designing of levels (at least as my primary goal) when I reach about 30m - it should be long enough to discover whether it is fun or not. Either way, I should possibly avoid adding more mechanics, and see if I can make do with the 3 I already have. Though a fourth would be nice....


Count:
9 Actual Puzzles
3 Simple "Introduction to mechanic puzzles"
12 Total
None of them actually work in engine yet - all just designs.


Update 7:48PM
I've come up with a level that is a bit easier, and uses elements from all three groups of level - it's below. It uses bits of other levels just a bit. I think I need a couple more of these

Monday, 14 November 2011

2 New Levels

11/14/2011 07:43:00 pm Posted by Lachlan , No comments
First new level

Second new level
I've got two new level plans done. The first will work, the second may or may not be finishable; I'll verify in the next day or so. Which does mean one thing: I'm back on. Friday featured my last exam for the semester, so now I actually have some time to attempt to get the prototype of Jack out.

So - I'm back to trying to design enough puzzles to make me happy enough to make a prototype. Problem is - I have no idea how hard they will actually be to play. I know I'm struggling designing them as I have no experience in Puzzle design before.

We'll see.

Count:
7 Actual Puzzles
2 Simple "Introduction to mechanic puzzles"
9 Total
None of them actually work in engine yet - all just designs.

Saturday, 5 November 2011

[Non Games] Movember

11/05/2011 11:03:00 pm Posted by Lachlan No comments
Me, on the 30th of Movember. Hopefully.
I'm going to digress slightly off topic today and make a small request:
I'd really love for you to support me in Movember, and donate money for a pretty awesome cause, and for me to grow a pretty awesome moustache*.

If that was enough to convince you - please donate online at http://au.movember.com/mospace/807802

If not - here is the official spiel: 

Hi,

It’s Movember and time to focus on men’s health. To show my commitment, I’m donating my face to the cause by growing a moustache for the entire month of November, and need your support. My Mo will spark conversations, and no doubt generate some laughs; all in the name of raising vital awareness and funds for prostate cancer male depression.

Why am I so passionate about men’s health?
*1 in 9 men will be diagnosed with prostate cancer in their lifetime
*This year 20,000 new cases of the disease will be diagnosed
*1 in 8 men will experience depression in their lifetime

I’m asking you to support my Movember campaign by making a donation by either:
*Donating online at: http://www.movember.com/m/807802
*Writing a cheque payable to ‘Movember,’ referencing my Registration ID: 807802 and mailing it to: Movember, PO Box 60, East Melbourne, VIC, 8002

Funds raised will help make a tangible difference to the lives of others. Through the Movember Foundation and its men’s health partners, the Prostate Cancer Foundation of Australia and beyondblue – the national depression initiative, they are funding world class research, educational and support programs which would otherwise not be possible.

If you’d like to find out more about the type of work you’d be helping to fund by supporting Movember, take a look at the Programs We Fund section on the Movember website: http://au.movember.com/about

Thank you in advance for supporting my efforts to change the face of men’s health. All donations over $2 are tax deductible.  
So yeah - please?

* History will show I've tried in the past. And I've grown a bit of hair above my top lip. But I'll try! I'll spend my afternoons trying to push more hair out - and try not to look like Max Payne in his first games in the process!

Tuesday, 1 November 2011

Temporary Hold of Proceedings

11/01/2011 12:54:00 pm Posted by Lachlan No comments
I'll be around, but not particularly productive with programming until at least next friday (The 11th) - Before then, I have a 2500 word case study on the Carbon Market due Friday (which will probably be made available on Scribd - potentially after further research), Competition law exam on the next Monday, Property law exam on Tuesday and a Civil Procedure exam on Friday. Its unlikely I'll be doing much other then work.

Meanwhile, however, I think after this date, I'll set a deadline to get the 'first taste' version of Jack is a Fool out - and see if it's fun enough to finish and sell.


Lachlan