Lander 4K

I am currently working on my 4K entry for the contest and wanted to share my current work:

http://www.martialartsmovies.net/lander.zip

Until now, I have 6996 bytes BUT I know where I can spare a lot. I am currently using for testing purposes an image with the map data and this takes already 948 bytes.

I also use 5 classes (first OOP, then optimise) and I could already squeeze them into 1 big class. I am also using long var and function names. I am also not compiling with -g:none.

I hope I can make some modifications to get under the 4K limit.

Until now, I have the following:

You need to control a space aicraft (currently a dot, I’m lazy) with limited fuel and you need to land it safely onto a landing zone. Each movement (boost, left, right) needs fuel and the amount of fuel is limited.

on my TODO list:

  • get rid of that ugly level image and use a better system (perhaps random map generator)
  • design a better aicraft, that dot just sucks
  • squeeze everything into one file
  • perhaps better game logic, more informations…perhaps more screens.
  • perhaps use a life system where you have 3 lifes to get through some levels.
  • perhaps a map editor (would not come with the 4K).
  • the possibility to modify the gravity and the fuel amount at startup if using the random map editor.
  • When playing the pre-defined maps, the gravity and the fuel amount will be contained in the map informations and will modify the level difficulty. Some levels will have huge gravity and a limited amount of fuel.

Until now, the game runs old-schoolish in fullscreen, 640x480@16.

This is my first try with such kind of things, so be polite :slight_smile:

Forgot to say:

You can press “Enter” at any moment when you crashed or disappeared, the game will restart. Forgot to print that message after the crash message.

Hi Koni! It seems that there are still a few bugs to work out. My ship move about 2 pixels, then the message “You Crashed on the Surface” pops up. Hitting enter makes the message flicker. Also, “thrust” is misspelled as “trust”. I’m on Mac OS X v10.2.6, 2 USB port iBook.

I can’t wait to play the fixed version! :slight_smile:

Very nice! reminds me of the old days :slight_smile:
Looking forward to your enhancements!

Oh, and I tried it on debian testing.

// Gregof

Hi Koni,

Here’s a few tips based on a jar -tvf of your file:

  1. Don’t use a package. That wastes a lot of space.
  2. Shorter class names are good.
  3. You should be able to use the Frame directly instead of embedding a panel.
  4. There’s no need for the “Manifest-Version” as long as you have two carriage returns. Just test with 1.5 if you’re worried if you have it right.
  5. Images don’t need extensions. So “map1.GIF” can become “m”.
  6. Use SuperPackME for images! ;D (Ok, so that’s a plug for my toolkit, but it’s great if you have a lot of images and not a lot of space.)

I got the same you crashed message as jbanes. :frowning: It did appear to go into full screen mode with no problem though. :slight_smile:

I’m on a mac G4 with OS 10.3.7, 256meg.

Hey jb - On win you can alt tab between programs. How do I do something similiar in mac land? Another java app I tried went full screen, but was just black. I couldn’t figure out how to kill it or switch to the finder. I ended up holding the power button down and rebooting. :frowning:

Regards,
Dr. A>

[quote]Hey jb - On win you can alt tab between programs. How do I do something similiar in mac land?
[/quote]
Try… (wait for it…) Apple+TAB. :slight_smile:

Most of the Windows shortcuts were stolen from the Mac. As a result, they tend to work the same on the Mac, except that you use the Apple key instead of the control key. A few minor differences:

End: Takes you to the end of the file
Apple+Right: Takes you to the end of the line.
Home: Takes you to the start of the file.
Apple+Left: Takes you to the beginning of the line.

[quote]Another java app I tried went full screen, but was just black. I couldn’t figure out how to kill it or switch to the finder.
[/quote]
Just hit Apple+Q next time. It’s like Alt-F4 in Windows, but better. ;D

[quote]Hi Koni! It seems that there are still a few bugs to work out. My ship move about 2 pixels, then the message “You Crashed on the Surface” pops up. Hitting enter makes the message flicker. Also, “thrust” is misspelled as “trust”. I’m on Mac OS X v10.2.6, 2 USB port iBook.

I can’t wait to play the fixed version! :slight_smile:
[/quote]
Hm, this seems to be a problem with an incorrect collision-map. I am currently reading the image from the jar and then make a collision map based upon the color informations in the image. Perhaps something went wrong with that. I’ll try to get that to work…but perhaps I am also going to implement the new map system right away so I can forget about the image.

I’ll try to get a MAC to find the problem.

A little update:

I am using a yellow color pixel on the image to mark the start location for the aicraft. I just saw that I forgot to put something in the collision map if the color was yellow, so perhaps the MAC VM initialises the int[][] not the same way as does the windows version ???

I added the correct value for those yellow points and hope this will fix the problem ?

I’ve overwritten the old version, so: http://www.martialartsmovies.net/Lander.jar

yeah, I seem to remember encountering that issue way back in the 1st 4K competition.

If my memory serves, it initializes images to grey (or was it white…), not black.

Some serious space improvements, now I have 3984 bytes and so have space left to improve things :slight_smile:

What I want to improve now:

  • better image for the rocket (less pixelated and needs to be transparent)
  • better collision detection
  • find a BETTER WAY to save the level data, if someone has a better idea which doesn’t uses images then it would be a big help
  • add more levels (if I manage to find another way to save the level data)
  • optimise the images. On my laptop I don’t have my specialised photo manipulation tools and therefor the size is still too big. Looking forward to get back home to save them optimised.
  • get rid of the package name (some more bits)
  • get rid of the image extensions
  • add images for the flame burst when moving sidewards and using the thrust.

Could someone please test if it still doesn’t run under Mac OS X ?

[quote]Could someone please test if it still doesn’t run under Mac OS X ?
[/quote]
Nope, that version isn’t going to work on a Mac. It’s compiled with 1.5. :slight_smile:

didn’t know there wasn’t a 1.5 release for MAC. gonna compile it with 1.4 tomorrow.

still no 1.4 version but I got rid of the map image and implemented a new map generator which will randomly generate a new terrain to play with. You also got a launch and a landing zone now and you need to fly from one to the other.

I think the best way would be to go with a “xx successfull maps withouth crashing” and the fuel would decrease every map and the gravity would be random.

I don’t see another possibility with a linear gameplay.

I’m also a little over the 4092 limit so I need to tweak some, expect the new version soon.

Tried this on my win box. Still waiting for the mac version. ???

Some thoughts for you -

  • The gravity is WAY too strong. After 10 - 15 tries, I just gave up in frustration.

  • It seems like there might be a collision detection problem. If you get going down too fast, you will go through the landing pad a bit. The text says you hit the ground, but it should have detected the pad impact, IMO.

  • The ship looks really pixelated. Not sure why. Are you stretching an image?

  • You need some type of force indicator, so the person knows if they are in the right zone for touchdown. I was able to almost land a few times, but apparently it was always too hard, so I just ended up crashing.

  • You need to change the text from - You disappeared and where never… to were never….

  • You seem to have a good starting point. It will be good to see the final version. :slight_smile:

  • Burning fuel on up thrust, seems to use too much. Maybe decrease the usage a bit.

HTH -
Dr. A>

Here come’s the new version (still 1.5 though, don’t know how to compile for 1.4 with jdk1.5; perhaps javac -source 1.4 -target 1.4 or something).

First the file:

http://www.martialartsmovies.net/lander.zip

now the new changes:

  • a new ship grafic, expect the version with the flame burst soon
  • a new map generator for hours of fun
  • 4017 bytes so I’ve got some bytes to spare for the level count system.

@dranonymous

thanks for all your great suggestions. As for the fuel problem, I was able to beat every generated level at the first try. My girlfriend needed the first time 10 tries and after that crashed 2-3 before landing.

I don’t think it’s a computer problem with different CPU speeds, I’ve got a 20 ms timer and fuel is used if space pressed during a frame.

I changed the text, now it is correct english. I will also indicate somehow when the ship is slow enough to land safely. I am used to the old Lander Game and therefor know how to navigate but perhaps it’s too hard for beginners. Please try again and when it’s still to hard, I’ll double the starting fuel.

pretty cool, one complaint though. The animation quality of ship moving is a bit poor, are you using double buffering? vsync? or maybe the framerate is just too low. I understand if you aren’t doing these things because there is no room in your code, but if thats not the case then you may want to try changing something.

i dont like the collision detection, i lost one when i shouldnt have (the “transparent” zones shouldnt count), i also got a free win though :stuck_out_tongue:

you mean the transparent zones of the aicraft ? Hm, a pixel perfect collision detection is to space-consuming, I only test the collision on the bounding box. As for the free win, how did that happen ?

Was the landing zone at the same place as the launch zone or what ? Because that shouldn’t happen, I did pay attention to that.

@ everyone:

does anybody know how to compile with jdk 1.5 to be compatible with 1.4 ?

is it something like:
javac -source 1.4 -target 1.4 G.java ??

[quote]you mean the transparent zones of the aicraft ?
[/quote]
You could add a landing gear. That’s how most Lander games get around that issue. :slight_smile:

[quote]does anybody know how to compile with jdk 1.5 to be compatible with 1.4 ?

is it something like:
javac -source 1.4 -target 1.4 G.java ??
[/quote]
Basically, yeah. Although using target is sufficient. i.e.:

javac -target 1.4 G.java