Robotron 4096

Unfortunately, I realized a few weeks ago that other commitments would prevent me from doing the 4K game I wanted to do. So at the time, I whipped up a little game as a replacement. I then polished it off last night and am now ready for the world to see it. I give you:

Robotron 4096

In 2084, Robotron valiantly attempted to save his own life after the demise of the last family. He continued to gain powerups, nuclear bombs, shields, and other defenses against the robot invasion. However, just before the robots were able to overwhelm Robotron, he was suddenly snatched from their grasp by an unknown force!
[tr][td]
http://java.dnsalias.com/4k/robotron/screenshot1_small.png
[/td][td]
Displeased that a human still remained alive somewhere, the robots hatched a plan. They would build a time device that would pull Robotron into the future, just before he disappeared.

The robots spent over two-thousand years on the project, and in that time they came up with a new battleplan. Robotron’s weapons were far too effective. The only method that worked for defeating him was to overwhelm him to where he could no longer stave off the avalanche of attackers. Thus the robots began mass production of the inexpensive Hoover Vacuum Cleaner robot, as well as a more heavily shielded mechbot. It was felt that these should be able to overwhelm Robotron without overstraining the robot economy’s resources.[/td][/tr]
On January 23, 4096, the robots (unaware of the causality loop they were about to produce) snatched Robotron from the year 2084 and placed him in an arena with invisible forcefield walls. This time the robots were certain that they would finally be victorious… [Read More]

Robotron 4096 is an action packed, 3D, first person shooter with full graphics! It’s the first of its kind ever to be entered into the Java 4K Game Programming Contest! Download it today, and see if you can survive the robot onslaught!

[] Self-executing JAR
[
] Webstart (Coming Soon!)
[] Readme File
[
] Action Shot!

Other Notes:

  • This game is a tribute to Cas’s new game Puppytron.
  • Gameplay was inspired by Blast4K (Thanks!)
  • See the readme for the artists of the graphics
  • I tried sound, but what works for 2D sounds just BAD in 3D
  • Does anyone know where I donate for Puppytron? :wink:

Absolutely brilliant! Real feeling of being closed in on and its smooth as a baby’s bum on my machine!

I absolutely love it! How did you ever fit them graphics in!

Kev

[quote]Absolutely brilliant! Real feeling of being closed in on and its smooth as a baby’s bum on my machine!
[/quote]
/me takes a bow

[quote]I absolutely love it! How did you ever fit them graphics in!
[/quote]
SuperPackME. :slight_smile: You just have to know how to use it. Just an FYI, I was thinking about the issue of single image vs. multiple brought up in the other thread, and realized that splitting the images is important to the compression as well as the code. You see, if you combine the images, you’ll increase the number of colors! An increase in the number of colors prevents SuperPackME from shrinking things at the bit level. (Read the Wiki page on it if you don’t understand why this is a problem.) In addition, splitting the images means that the each image will share byte symbols with other images. And more redundancy == better compression.

So if you have any questions on how the tools should be used, just ask! They’re not magic, and can far too easily be foiled. :slight_smile:

its smooth as a baby’s bum on my machine!

It’s even smooth on my ol 500mhz thingy :slight_smile:

Awesome work jbanes :smiley:

[quote]It’s even smooth on my ol 500mhz thingy :slight_smile:

Awesome work jbanes :smiley:
[/quote]
Thanks Onyx! :slight_smile:

Those of you with Macs should also find the game highly playable. (After all, it was developed on one!) Due to lack of fullscreen support, however, it won’t work on Linux machines. :frowning:

The secret to the game is really nothing more than a sprite scaling engine combined with some 3D math. In hindsight, however, I may have gotten better results if I had gone for a full 3D texture mapping engine.

The problem I ran into is that I ended up having to embed 3D math in several places throughout the code. This lead to a lot of unnecessary bloat. Had I just kept arrays of vertexes, I could have transformed all the vertexes at the same time, then blit the results to the screen without any more calculations. Alas, you live, you learn. :slight_smile:

BTW, if anyone wants to view the (somewhat sloppy) source code, I’ve uploaded it to here: http://java.dnsalias.com/4k/robotron/Robotron.java

Enjoy! :slight_smile:

loadImages() could be inlined and instead of KeyListener you could just enable events.

keys[e.getKeyCode()] is a bad idea with an 256 array, because extended keys are out of that range. new boolean[0x1000] would be just big enough :wink:

[quote]loadImages() could be inlined and instead of KeyListener you could just enable events.
[/quote]
Heh, I know. I can also replace the Math.xxx functions with lighter-weight, inlined computations. Not to mention changing the name “Robotron” to simply “R”. However, it fits, and I don’t have any features I need to fit. So why bother?

[quote]keys[e.getKeyCode()] is a bad idea with an 256 array, because extended keys are out of that range. new boolean[0x1000] would be just big enough :wink:
[/quote]
Don’t touch those keys! :wink: Actually, it shouldn’t hurt anything since it’s in the event thread. If an exception occurs, the event thread will catch it, print it out, and keep on about it’s business. So I haven’t worried to much about it.

I don’t have any features I need to fit. So why bother?

I thought that (since you didn’t mentioned anything). But I thought I should point that stuff out anyways (eg for others who are doing a 4k game).

I hope that I can finish my second entry these days. Right now it’s already 500lines of highly inlined mental code. Heh. And I need to squish at least two other algos into it… I’m wondering how many levels I can put in… :slight_smile:

how about a restart button for when you die?

[quote]how about a restart button for when you die?
[/quote]
How did I know that was coming. grumble Maybe when I get around to it… :wink:

Edit: BTW, I’d love to know the highest level/score that players have gotten. Some of the later levels are damned difficult, although not impossible. If you’re having trouble, make sure you open the Readme file. It’s got some good tips on kicking robot butt! :wink:

Just to make Malokhan happy, I’ve added a restart and reuploaded. If you die, just press SPACE to start over. The file is now precisely 4096 bytes. I guess it truly is Robotron 4096! :slight_smile:

There is only one way to describe this: Sick!!

  • Sick as in the modern meaning: “Wow! Holy sh*t! OMFG!” -

Damn 4K!

“Most impressive… The code is strong in this one”

Can you add some full motion video though? :wink:

[quote]There is only one way to describe this: Sick!!

  • Sick as in the modern meaning: “Wow! Holy sh*t! OMFG!” -

Damn 4K!
[/quote]
My goodness! I didn’t think I’d get that strong of a response. And this was just my quick hack! I wonder what would have happened if I had done the game I wanted? :wink:

[quote]“Most impressive… The code is strong in this one”
[/quote]
Listen young padewon and I’ll tell you a secret to winning this competition. Actually, this is for anyone who wants to hear it, because it takes some serious coding skillz to accomplish. I’d do it myself, but I REALLY don’t have time. :slight_smile:

Step 1. Write yourself a super-optimized 3D Perlin generator. You can stop when it can do 9 million textels a second. More is better, but not required. (Hint: You can get away with less if you use pixel doublng…)

Step 2. Plug it into a tightly coded 3D engine. Both a raycaster and a vertex engine are fine. Just pick the one you’re most familiar with and/or can produce the smallest code for.

Step 3. Use the Perlin generator to texture walls on the fly. Precise 3 dimensional coordinates should be used so that you don’t have to worry about seams.

Step 4. Make it into a 3D maze, a Wolf3D clone, or whatever else you can think of for such a small engine.

Step 5. Expect a +50 bonus for “Never seen anything so impressive before” and win the competition. :slight_smile:

[quote]Can you add some full motion video though? :wink:
[/quote]
Smartass. As a matter of fact, I could do FMV if I had a reason. I don’t have a reason, so it would be rather wasteful. :slight_smile:

Exception in thread "main" java.lang.UnsupportedOperationException: Cannot change display mode
        at java.awt.GraphicsDevice.setDisplayMode(GraphicsDevice.java:259)
        at Robotron.main(Unknown Source)

SuSE Linux 9

Java 1.5.0

:frowning:

Mmmhmmm. Read reply #4 of this thread. Then, if you REALLY want to play games on Linux, get someone to fix fullscreen support on Linux. :-/

Hm, quite good…bad I have some comments:

make them SPAWN at a certain distance. I player like 3-4 times and every time, in level 5 they spawned within me and I instantly died. Very annoying and made me stop playing.

[quote]make them SPAWN at a certain distance. I player like 3-4 times and every time, in level 5 they spawned within me and I instantly died. Very annoying and made me stop playing.
[/quote]
They very rarely spawn directly on top of you. However, they do tend to spawn very near, so keep moving and watch your radar! You almost always need to get a move on it when they first respawn! (The times when they seem to be on top of you, they usually snuck up from behind. :-))

I personally have gotten to Level 10, so I know others can do better! :slight_smile:

Very cool :slight_smile: You’ll be writing Doom4k next…

Cas :slight_smile:

I am speaking about the level begin…before I even see them on the radar or sth. They just pop out of nowhere and not even 0.5 sec and I am dead.

Well say that to Sun lazy boys :stuck_out_tongue: . LWJGL switch video mode perfectlyon Linux.

Why not backup your screen resolution change code with a windowed mode ?