Jul. 23rd, 2014 10:59 pm
davidn: (Jam)
Recently I've been redoing Track the T pretty much from the ground up, to make it less technically hideous and add a few features it's needed for a while.

My new Google Maps route plotter works perfectly, apart from Braintree Station which is in Spain.


Dec. 30th, 2013 07:19 pm
davidn: (rant)
I've spent some time experimenting with Tomcat hosts in the lull between Christmas and New Year, and today I bring you this stunningly pointless application:


It is the eBooker! You can feed it a file in TXT, DOC, DOCX or RTF format, and it will extract the hidden subtext of it (i.e. draw out random phrases). You can also post the results directly to your Twitter account and fulfill your ambitions of becoming a curious spambot.


Sep. 14th, 2013 12:19 am
davidn: (savior)
As alluded to elsewhere, I ordered a Raspberry Pi! I'm hoping to use it as a home server and perhaps experiment with some automation. Here is a picture of our two new computers running side by side.

Even though you know it's a miniature computer when you order it, it's amazing how tiny it is when you take it out of the box - it's a computer that would have been regarded as a ninja PC just nine or ten years ago on a circuit board the size of a box of chewing gum. It runs off a micro-USB cable - fortunately I had one in the form of my Windows phone charger.

I work a lot with Linux at work, but I hadn't set a Unix-based system up from first principles before and was fairly daunted by the prospect. They provide you with a good amount of assistance, though - you download an image of the OS on to an SD card (the default is a customized version of Debian) and then it does most of the basic setup for you. Wireless networking was the one major hurdle to get over, because you have to find a compatible USB dongle or be prepared to spend ages going through the Linux drivers - fortunately, by coincidence, the local hardware shop had one of the models that was said to work straight out of the box, a D-Link DWA-131.

Of course, "out of the box" has a very different definition on Linux from the one it has on Windows, and I was confused by the number of options and utilities for setting it up, especially as I was trying to get it to connect to our antiquated WEP network with a space in its SSID. On the day I got it I didn't have much luck with the instructions for setting up the /etc/network/interfaces file, but I ran some command line iwconfig things that I copied from the Internet and that seemed happy enough.

To get it to connect on startup - as well as feel that I was using a middleman that knew what he was doing - I downloaded the wicd tool, and that was all very impressive, but it produced a connection that was inexplicably down about half the time - it would be absolutely fine for a while, then would drop all connections and wouldn't respond to ping for five minutes, then continue as if nothing had happened. I imagine there must have been some sort of conflict with another networking service there - so I uninstalled that and had another go of the /etc/network/interfaces file, where I realized that my mistake was removing the "auto wlan0" line, believing it to mean "attempt to automatically set up this device" and not "connect this device on startup".

So I installed a lightweight HTTP server, nginx (which is pronounced "llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch") and wrote a little monitoring page to verify that I could leave it running uninterrupted.

Like any other heartbeat monitoring page, this prints a randomly-oriented banana every time it finds that the service is still reachable. Through this (including a couple of negative tests where I turned the server off and then on again), it looks - so far - like the connection is stable.

The next step, I think, will be to install PHP!
davidn: (rant)
Running Free is my latest candidate to put through Clickteam's XNA runtime! I've settled on this as a first target to complete due to its small size - the entire game is basically made up of just a level selector and gameplay frame that handles everything, so changes only have to be made to a very small area.

I was once again impressed by how quickly I could just change the application's build type to XNA for Windows and hit the Export button, going through the level select menu and everything without any problems whatsoever... though the physics of the game were completely broken when I first started it up. After some investigation, I found that this was due to an isolated but fairly severe mathematical error in the expression-evaluating code where the Min() and Max() functions wouldn't return the right values under certain circumstances. (Max(-30, -1.0), for example, is 0 - where were the beta testers!) But having fixed that myself for the time being, and then having fixed a further error caused by me getting the implementation for Min() wrong in a different way when I patched over it, the game ran exactly as it did in the EXE version, and was ready for reworking for the Xbox.

One of the most dramatic changes that had to be made was in orientation - Running Free was originally laid out to be viewed on the iPhone vertically, while widescreen televisions are decidedly horizontal. Because programmers are lazy by nature and tend to choose the path that involves the least work now and in the future, I wanted to go with an approach that would let me keep the original level layout file, and just change how I was interpreting it so that the levels were drawn in a different way.

True to the laziness theme, I never actually wrote a level editor for this game - the level layout is done on a grid in an Excel spreadsheet, and there's a small Java program that reads it and produces a long string that looks something like:

Level=?                                                       322221          6  * 4          6    4          6    4          6    4    322222X    4    6    E!    4    6          4    6*        *4    6          4    6          4    6     @    4    988888888887                                                                                                 ?

...along with a couple of other fields that store the level name, par flips/time, and so on. The game then chews through each character in order and places the corresponding tile at the next horizontal position, starting a new row when it reaches the designated LEVEL_WIDTH.

To lay out the level horizontally, the game needed to jump about a bit in the string instead of reading it from start to finish - more specifically, it needs to act as if it's read down the first column (every X tiles, where X is the length of a row) and output it as if it were a row, then start on the next one, like this:

And a quick check in Excel gives us the formula MOD(X;5)*3+(FLOOR(X/5;1)) to do this on the 3x5 set of tiles that I mocked up there. Translating this in to MMF is easy enough - you set the "next tile" to point to that instead of just increasing it by 1 each time.

Hmm. Well, it would have worked if I had remembered to replace the numbers "5" and "3" in my test formula with the actual width and height of the levels...

Which produces this. And this frilly specimen isn't as far off the mark as it might first appear - those little border tiles are represented by numbers in the level string, the number indicating which side of the square to place the border (laid out like a backwards numeric keypad - 3 draws a square on the bottom right, 7 on the top left, 6 with two squares on the right hand side...) To complete the new layout, those sides also needed to be translated.

As you can see, this technique doesn't technically rotate the level - it actually mirrors it diagonally. Therefore, I also had to adjust what "initial gravity direction" meant, as well as reversing the flag for telling the game that the player should start running clockwise. (This is fortunate because the first time I wrote the engine, I somehow got the names for "clockwise" and "anticlockwise" consistently wrong all the way through, so you could say that they're now finally correct).

And now the re-orientated game runs fine. Work on the interface will come next - it's strange to make the game feel more awkward after the immediacy of touch control, but now everything has to be done without the benefit of a mouse!
davidn: (rabbit)

Inspiration is such a strange beast. It's great to have it back in some form after being away from MMF for a while, but I feel I'm going to have to announce once again that all the projects that I've been promising to finish for ages are now on hold because I'm busy making a completely new game once more. The new prototype has been granted its own folder now - surely the mark of some confidence.

I really love the idea, and I'm really happy with how the look is coming out - apparently I have suddenly learned how to draw things to an acceptable standard - but this game is still a bit of a mystery in that I'm still not sure where to go with it or what strategy really exists. You can roll around, learn how to align yourself and eat the flowers - is that what the game's going to be? Are puzzles with multiple sheep necessary or desirable? What other elements do there need to be - platforms you can only use once, gates that only work in one direction? Which ones of these make the game interesting and not overly restrictive?

Potential names: Sheep Roll, Sheep Tumble, Tumblesheep, Tumblemunch, Rollysheep, Fat Sheep, Chirpy Chirpy Cheep Sheep. (I'm amazed enough that "Sheep Roll" doesn't produce a game on Google already...)

Sheep Roll

May. 31st, 2012 10:38 pm
davidn: (prince)
Here - roll a sheep around!

Sheep Roll - from an original modernist poetic composition by [ profile] ravenworks. Tumble the fat sheep around and eat the flowers by planting him face down on them. As usual, I'm not really sure what the greater point of this game is yet, but perhaps one will come to me.

I can say that I thought that sketching this out would be easy - but once I'd got going, the finer points of sheep-rolling mathematics proved to be a major obstacle! I first had to work out how many different frames of animation I needed, and then spent the evening writing up all the permutations of angles, frames and directions that were needed to allow full movement (I was hoping that a pattern would emerge, but none did).

If anyone else wants to do a game involving a dice-like movement like this, perhaps my lookup list would be useful (if I hadn't chosen such a rubbish format for it):

Lookup list )
davidn: (prince)
This is absolutely fascinating (disclaimer: this might not be very interesting)

Jordan Mechner recently released the long-lost source code for Prince of Persia on the Apple II after having to drag it through several layers of gradually advancing disk drive technology. Along with reams of assembly language with wonderfully descriptive comments like lda #Splat ;yecch, he also unearthed a design document that he sent to the people who worked on the various ports, who dutifully ignored it and messed it up massively instead.

That document is an interesting, understandable look at how the game works underneath - revealing things like the way that all the enemies are actually treated as the same object (named as Shad even though it's very rarely used for Shadowman, as he has now been christened) which is loaded at the start of the level, which is why the levels with the skeleton and Fatty are unique in having no other enemies on them. It's also quite clever how he managed to make the game so fluid - the levels are drawn on a grid but characters only adhere to it when it's absolutely necessary, and it's impressive that he draws parts of the screens that are hidden off the edges of the visible area to keep objects active nearby.

A table near the beginning describes the background graphic sets and enemy types, and it confirms the game's long-standing numbering confusion in that it has three separate levels at the end that are all called "Level 12" - but the biggest surprise for me was that all the levels were actually given names!


Some of these are very obvious, like "Demo", "Tower" and "Cell" - I assume that "Newskel" and "Newmirror" replaced earlier attempts that he had at the skeleton and mirror levels. "Thief" is the level where the shadow steals the potion from you, and "Quad" starts you off in a room with four doors that you have to revisit a couple of times. I was less sure about "Wild" and "Wtless" (though [ profile] rakarr realized that it was short for the level with the "weightless" potion) and am absolutely mystified by why level 8 is called "329". It doesn't physically resemble the number, and its special feature is that you're rescued by the mouse - the release of this design document has created an entirely new mystery of its own.
davidn: (prince)
My latest game has actually been on the App Store since the start of the week, but I waited around a bit before announcing it - I wanted to be able to get the site together along with the Flash version, so it can be fed to the awful cretins on Newgrounds and then distributed further into the Internet in general. So now, at least, I can say - my first iPhone game Running Free is out!

You can try it out in Flash form here, with 15 specially-made levels - the full game on iOS has a further 71. (Why the weird number? Because the winning screen's counted as a level and eight of them fit on a page of the menu.) Your aim is to guide the perpetually running stickman - arbitrarily named Geoffrey by Whitney - around a set of increasingly dangerous sheets of graph paper by using the four arrow keys to change the direction of gravity.

It's evolved quite a bit since the first prototype I put up last year... thanks to everyone who posted there, and... actually, especially [ profile] ravenworks for inspiring me to put this on the iPhone at all, now that I look!

So here it is on the US app store (the in-game link should open it in iTunes in the correct region automatically) - I'd recommend a 3GS/3rd generation Touch or later, as I think it'll perform slowly on earlier devices. If you give it a try, I'd really appreciate any reviews, as they boost my visibility in the store. (Unless you hate it, in which case you don't have to bother.)

The game has no music - here's some.
davidn: (Jam)
I think I might have just spotted an oversight in the iOS exporter's sound code and solved the mystery of how to allow iPod music while a game is running - something which I'm really rather pleased about, seeing as I'm working in a language that doesn't make sense in an IDE I don't understand on a computer I can't use. But I'll have to see if it's verified by someone who has at least one of the above qualifications.

So I've been ploughing ahead with Running Free and adding the few more elements that I wanted - here are some levels played when run through the standard EXE exporter.

I think that the ghost is my favourite bit, especially his "chomp" noise. And he's an all-new one, rather than the sprite from Treasure Tower that I've been using for the last six years.
davidn: (prince)
In August last year, I posted a Flash prototype called Running Free. Some experimentation with Clickteam's iOS exporter led to it being adapted into an iPhone game, and then like most everything I create these days it got left on a shelf after that. But now I've picked it up again and it's looking like it'll be the next game I release - the first on iOS. Then I can adapt it into a Flash demo.

I've been making a serious attempt to do what I utterly failed to with Crystal Towers 2, to get the game into an actual finished state before spooning in the content - in this way, it can be released in the event that I get sick of it. The game's main problem before was that I really didn't like what I'd done with its interface, but after passing my phone around to a few groups of people and seeing how fascinated they all were with the way you could manipulate the gravity, I knew I had to finish it - and after spending some time this week trying to understand the utter tangled mess of events I'd left myself, I've wrestled it into something much more pleasant to use.

In the last post about it, I had a list of possibilities for what the objective of the game would be, and in the end I sort of went for all of them. The idea of collecting stars stayed - in each level, you have to collect three red stars and get to the exit by changing the gravity to guide your blindly running man to where he needs to go. Turning the phone when on the ground changes the direction of gravity in 90 degree increments - to change 180 degrees at once without it interpreting it as a 90 degree turn halfway through, you can either tilt the phone backwards, or pause the game first.

Each screen also has a yellow star, which is usually trickier to get to - and you can earn a blue or a green one for completing a level quickly or within a par number of flips. Collecting stars advances you through the levels - just getting the three standard red stars will open up the next level, but you can skip ahead if you've collected some of the special stars as well.

Other game elements you encounter on the graph papery levels are curves, which force you into changing the gravity and prevent you turning around - and red Xs which I tend to refer to as 'spikes' but my mum called 'barbed wire'. There will possibly be some sort of moving enemy as well, but I'm trying to keep the scope of it down now - every time I try to make a simple game it becomes complicated very quickly.
davidn: (rant)
As usual I can't specify exactly what inspired me to undertake this project, but over the last couple of days I was suddenly driven to enhance the connection between my journal and my personal site (remember when people had those?) The journal has always been on the front page of it, but all that page did was to read the RSS feed and lay it out, so it could only ever display the latest few posts.

My aim was to make my site's impression of my journal much more full-featured, so that - ideally - Livejournal would be made a backend and you could explore the whole thing directly through the site. Livejournal's API doesn't really provide for this, seeming more geared towards clients that will actually draw out all the journal data and keep itself synchronized, so I wrote a parser to do it myself.

Actually, calling it a "parser" is extremely generous - it uses the normal LJ pages as web services, and these are full of Javascript and other extras that make them fairly unparseable, meaning that most of its job is to chew through the page until it finds something that it considers interesting. It does this by looking for pairs of delimiters to find the post title, content, date and so on - if it finds the start delimiter, it returns everything from that point on until it finds the appropriate end delimiter.

<title>davidn: The greatest bug report ever</title>An easy one - just get it out of the page's title tag, and it's always prefixed with "davidn: "

    <div class="b-singlepost-body">
        <div align="justify">Blah blah blah, I'm DavidN and I never shut up</div>
This one is a bit risky - further on than this, the tags change depending on whether the post has tags or comments or not, and I can't just check for a div closing tag because the entries themselves might use them. This only works because I don't tend to have four spaces followed by a div closing tag anywhere in my journal markup.

<span class="b-singlepost-author-date">
    <a href="">2010</a>
    <a href="">09</a>
    <a href="">07</a>
The general position of the date is easy to identify but is in an awkward tangle of links - this fragment gets XML parsed to get the numbers out.

Lists of posts from the months surrounding the current entry are provided through the calendar page (the HTML for which is actually much easier to parse), and navigation is also possible by grabbing the links from the forward and back arrows at the top of each post. Livejournal does this in a rather odd way, sending a "go=next/prev" parameter along with the original ID to redirect you to the new post instead of going to the 'view post' page with the new ID directly - but copying this behaviour worked without problems, as long as I remembered to get the post ID out of the HTML that came in, instead of relying on the ID passed to the page being the actual ID of the post.

Take, for example, this post I made about Red Alert two years ago - the navigation is quite basic and there are a couple of other things I want to do (like replacing all links to my own journal with links to this parsing page as it writes them out), but it gives you pretty much all you need to flick through the journal. It means I can now link people directly to my own site when I mention something I've written in an entry.

I could give out the source if anyone would be interested in doing this themselves, though be warned it looks fairly hideous. Though having said that, it's PHP - what do you expect?
davidn: (prince)
It must be the time of year for miracles - I've just released something, and further, something that isn't a platform game. It's a smaller project, though - it's called FISP, and three of the letters stand for Impossible Sliding Puzzles.

Good luck.

This was a quick project born as a result of Professor Layton 2's final stages, where you're put through a variety of absolutely sadistic puzzles, a couple of which involve sliding awkwardly-shaped pieces around a board. When I gave up on being able to do them, I didn't turn to a walkthrough, and instead - being who I am - wrote a solver to find the solution for me. And a couple of months later, I realized that this was the perfect tool with which to construct my own horrific challenges.

And I remembered about it last week and finally stuck a full game together around it. Go in, slide things around, get in a rage, spread the pain around on Facebook and help me get some advertising revenue.
davidn: (Jam)
In any area of coding, there are some things that you just can't do deliberately, no matter how hard you try. Such as collapsing your level into a black hole when you try to slide a piece:

It's nice that it still recognizes your effort and achievement - however, I'd better go back and try to find the exact point where I managed to break this quite so badly.
davidn: (rant)
I'm not sure when or why this happened, but for the last while the front page of my site had been spitting out raw HTML where the journal entries used to be. It seemed as if the RSS feed had stopped including the characters that needed to be HTML-escaped, though the codes are definitely there when you look at it on Livejournal's side and I couldn't see why they weren't appearing any more when I tried to read it on my site.

I'm not sure what the cause was, but I finally got around it by changing from Magpie RSS, which is lovely and simple, to SimplePie, which is overengineered to an absolutely comical level. It seems to spend layers upon layers of code working through every possibility for every known version of every feed type, so that you have the convenience of using a function called "get_description" and it'll automatically detect whether you want the element called "description" or "content" or "bananas" or whatever it is.

Fortunately, for the specialist possibilities that it hasn't thought of in its 390KB list of if/else statements (like retrieving the number of comments for a Livejournal entry), it's just about possible to work out the route to get there manually by tracing your way down the functions. It does mean that this:


Has now been transformed into this:


But it's a relief to have a front page that actually looks finished again.
davidn: (prince)
After a huge lull, I seem to be entering a new era of enthusiasm and productivity! It'll probably last another day or two. But at least I got another Flash sketch out of it:

Running Free - a mini gravity-switching platform/puzzle game

Almost uniquely among my experiments, this one actually has a title, so hopes are high for it actually becoming something. The idea is that gravity is the only thing you have any control over at all - use the arrow keys to switch its direction and guide the stick figure into collecting the red stars (to be rewarded with nothing happening just now). He'll turn when he hits a wall, but after a gravity change, he'll always continue in the same direction he was going - play about with it for a bit, you'll get the hang of it.

This could turn into a game limited by your number of lives, to collect stars within a time limit, complete levels with a limited number of shifts available - or a variety of all three of those and more. Already I find it quite satisfying to just zoom around, which feels like a good sign.

You can drive yourself mad working out where the sound effects are from if you choose to. (I've just downloaded a new sound package.)
davidn: (savior)
Something that I'd been thinking of doing for a while:

The graphics (the good ones) are taken from Tyrian, but the main idea of this experiment is that the behaviour of the enemies and the level are generated from the music that's playing. I'd had this around as an experiment for a while and had abandoned it because I couldn't get consistent data out of a music file each time it was played, but I suddenly realized that I could do it by reading from the file itself, instead of relying on the current position of the music.

This Flash demonstration just uses one music file (and even then it's a bit of a cheat, as the data is pre-loaded instead of actually read here) but it's already quite fun to zoom around and watch the fireworks. It's going to be interesting to see if I can get appreciably different levels to come out of different songs.

Music shooter (yet another product of my lack of good name ideas)
davidn: (prince)
Watch this!

It's crawling slowly closer all the time... now, all that really remains is to do the ending and some more general touching up to things I've been ignoring like the final boss. Then I'm going to see if Steam are interested.

I am indebted to each and every one of the testers who have gone through this over the last few months - they've really helped make the game what it is now. And of course to J Freude for the better-looking graphics throughout.

You can download the demo here, though it's a bit out of date now.
davidn: (Jam)
I am now at the dizzy height of three levels of procrastination away from my main project, having put Boxplode on hold as well for the moment to see if I could rework Special Agent into a Flash game. It's going quite well, though I have to resist the temptation to just strip out the bits that are slightly awkward to port over - I'm changing the percentage completion into a concept of 'agent points' that can be recorded on the Mochi scoreboards.

I'm not entirely sure whether I should keep the Democratic and Republican bonuses in it, because those words are far, far more loaded than they were at the point when I made the game five years ago - it was an idea that I got from Rise of the Triad, and the bonuses are achieved for sparing use of your handgun and for destroying all the plants on the level, respectively. Although I think, now, that it would be equally appropriate to get the Republican bonus for destroying all health powerups and the Democratic one for standing around for ten minutes without doing anything.

Besides, if anyone complains, as an independent I'm in the enviable position of being able to tell them to get stuffed.
davidn: (skull)
A general question to Apple developers - how on earth have you managed to survive thus far without your head bursting? Having gone through a few online tutorials, plastered my entire whiteboard with all the unnecessary differences from everything else (from the insane bracketed syntax used to call methods, to the most elementary basics like YES and NO instead of true and false) and hacked my way through getting a Back button added to a Split View that loads an RSS feed, I'm convinced that they all wear their hair long to hide the criss-crossing lines of sellotape that they've had to stick on to piece their skulls back together.

Until last week, I used to tell people that "if you know one language, you have a fairly decent grounding in them all". I am now forced to revise that to say "a fairly decent grounding in them all except Objective-C". Everything that I've seen done in it seems to take about three times as long as doing it in anything else, using unnecessarily awkward method names like application:didFinishLaunchingWithOptions and very little reasoning as to why you have to declare things in three separate places, synthesize variables (whatever this does) or why Interface Builder is quite so unhelpful. A particular favourite of mine so far is the way that you log a formatted string, which begins NSLog(@"@%",.

So I took a step back, both in terms of what I was doing and back before the Internet, and have got iPhone Application Development for Dummies out of the library. Previously, I had thought I could just learn anything online, but as I seem to be learning to program from scratch again, the piecemeal tutorials offered by the Internet are just too numerous and chaotic to be helpful. I know that in the back of my mind, even though declaring an array seems so unnecessarily roundabout now, people do get past its seemingly wilful obtuseness and successfully use this - I mean, I've been looking at tutorials on Youtube by someone who sounds like he's 13, and even he seems to just naturally accept what an IBOutlet is and why you have to drag connections from your UIPageViewController elements to your File's Owner.

So far, the book has advised me that "You don't use frameworks so much as they use you" and "it lets the programmer know where he or she is essential", which both sound pretty much like my experience with the Xcode environment so far. I'm fairly confident that by being explained things from the start rather than trying to adapt my existing knowledge to suit the language as I've done with everything else before, I can get on and do something useful with it.

Can I also just take a moment to reiterate that by Christ, Americans are loud? This is the least silent library that I've ever been in. People walk past the desks chatting like they're on opposite sides of the street from each other, some toddler set off the fire alarm a minute ago, and there's someone at the desk down the corridor bellowing his way through an anecdote about window blinds.

(And to those wondering about Boxplode, below - that was done using a framework that sits on top of this language, which abstracts away everything and is significantly less mad than doing it all with Apple's tools.)
davidn: (rabbit)

I've got a game running on the iPhone now (through the slight abuse of an Apple developer account from work). This is Boxplode from last year, which I had stopped working on when I realized how good a mobile game it would make - with Clickteam's iPhone exporter now well on its way, I've been converting it over from its original version and it's already looking pretty workable.

The game's heart, the detection of blocks to destroy and everything, remained exactly the same - what I did to convert it amounted to halving the horizontal size to fit it on the screen, reworking the way that levels were stored and loaded to avoid the use of List objects or the String Parser (creating an editor for them along the way, so that step is much easier now) and changing the controls to make more sense for a touch screen.

Now all it needs is a heap of levels, some presentation improvement, and for me to get my head around the mathematics of doing a touch scroll menu.

Expand Cut Tags

No cut tags

February 2019


Most Popular Tags


RSS Atom

Style Credit

Page generated Apr. 21st, 2019 12:06 pm
Powered by Dreamwidth Studios