language for platform games

My son wanted to produce a game but full on games are a little tough to produce when you’re young. I wondered about creating a small language to create platform games - platforms, ladders, elevators etc. The idea would be to allow people to create their own platform but the different games could all plug together. I figured perhaps there could be simple blocks you could push around and perhaps have zombie figures chasing after you (if desired).

The language looks a bit like this at the moment:

# simple set of 5 platforms with a ladder between each
define x   40
loop 5
    define y   loop * 40
    platform at x, y extend right 100
    ladder at x+rnd(100), y extend up 40

I haven’t written it yet but I quite like designing small languages (and interpreters etc) so that part is quite easy for me. Without going into much detail of the language, does it look understandable? for a school kids etc? Has it been done before? There is a little bit more to the language that makes it extendible etc and I’d be happy to explain and get feedback on that part if anyone’s interested.

Are there any particular advantages of this language over, say, python? Using something like LangScape you can even extend python’s syntax with new constructs.

I was coding in a young age and that could would be absolutely and completely enigma to me back then. Actually… even now I can’t understand the code you posted without thinking about it hard :smiley:

Generally, once you understand loops and variables you don’t need any “special” language, you can as well use existing ones. The problem for a kid, unless I was a weirdo when I was young, is not the syntax but the overall concept.

Not to mention that you might simply need math knowledge to make games (like jumping in a platformer is a cosinus). A kid might not know what cosinus/sinus is, and even if he knows I highly doubt the kid would want to do the things he does in school (calculating lame cosinuses) in his hobby time (on the other hand it might be a nice trick to teach the kid the importance of education in a real life :D).

(I don’t see why you need a cosinus to jump. You jump in the shape of a parabole, not some wave…)

I agree that that language you came up with is pretty much unreadable to me. Not that I can’t see the intent, but it lacks obvious structure.

How old your son?

Thanks for the feedback. My younger son’s 12 but quite bright. The aim of the language was to just define where the platforms are etc and no more work would be required ie jumping etc would be handled by my part. The advantage of this little language is that you could create your own playable platform game in just a couple of lines of code as opposed to writing 100’s or 1000’s of lines of code ie the code snippet below is one whole platform game. The other advantage is that these levels could plug together.

This is a better description of what the previous program does:

simple set of 5 platforms with a ladder between each

define x 40 # sets x to 40
loop 5 # loops round 5 times
define y loop * 40 # y gets set to 140 then 240 etc
platform at x, y # draws a platform at x,y coord
ladder at x+rnd(100), y # draws connecting ladders

The above would be enough to start playing a game. It looks intuitive to me obviously because I came up with the language but it was interesting to hear I need to make it easier. The advantage of my small design is that I can create types of things (like platforms) and then plonk them on the screen to use. This is how I would define the platform and I’d do it elsewhere so the user doesn’t have to write the standard stuff:

define platform # this defines what a platform is
image “plat.png” # there’s an image
extend right 100 # that gets repeated for 100 pixels going right
action stand # the player can stand on this item

Other options apart from stand are :

  • stand # player can stand on this
  • climb # for ladders or trees I guess
  • die # any contact will kill player
  • ignore # just part of background image
  • push # the player can push this item around

You can define various things for any item, so above we have the platform extending to the right for 100 pixels but, if that wasn’t what you wanted, you could just add a different extend when placing a platform ie:
platform at x, y extend up 200

Other options allow items to move so you could just define an elevator to go from the bottom of the screen to the top as follows:
define elevator # this defines what an elevator is
image “plat.png” # just used same picture but could be anything
action stand # must be able to stand on it
move up 400 restart # it will move up the screen 400 pixels and then restart

then I could place elevators anywhere on screen:
elevator at 50,0
elevator at 400,40

Does that make it clearer?

Most important question is, is that what your son wants or is it you having fun in designing this stuff ?
Has he used the right tools so far, are his goals neither too low nor too high set ?
What you describe sounds rather like a complete configurable game than a little language.

I suppose my son is the impetus but I like to have interesting projects. I’m just coming to the end of writing a chess program at the moment! I’m pretty sure my son would use it, at least for a few games, especially if he could give a link to his friends so they could play. An interesting side effect might be to interest him in programming - if it only takes a few lines to create a game and you can immediately see the effect on screen then that makes it more interesting than writing a similar amount of code to say “hello world”! Lastly I like creating new languages but I’ll admit I sometimes get carried away doing stuff that no one would ever use :-\

My son has just created a game using powerpoint (bizarre but that’s what he did) and I’d like to make it easy for him to create games of his own design. I think it’s good exercise for the mind. I think if I could appeal to school kids, teach them a little about coding and perhaps amuse my son for 20 minutes then it might be worth it. If it does work well then there’s quite a lot of room for expansion of the idea.

I believe that is what Sratch was made for.

I hadn’t heard of it so I just had a look at it. It certainly looks like it might make game programming slightly easier but it’s still very procedural ie you have to code each movement etc etc. Have you used it? and if so what did you produce? and how long was the resultant code? did it take long to write? I’m hoping to allow kids to produce games they’d be pleased to play (and write) in under a dozen lines of code. Not sure whether I’ll achieve that but hey ho.

I never tried. I just remembered reading a quick blurb on it.