Left 4k Dead

I haven’t gotten far, but here’s what I’ve got so far:

http://www.mojang.com/notch/j4k/tmp/left4kdead0.jpg

Try the applet here, but keep in mind it’s pretty buggy still. Don’t walk outside the map, or it will crash.
WASD moves, arrow keys turns.

[edit:]

The completed game is available here

Pretty cool effect! Only need a gun and monsters and it’s DOOM3!

Looking good.
I got 2 out of bounds crashes:

[quote]exp=1571, start=2, num=13415780137
exp=1571, start=2, num=13336887949
Exception in thread “Thread-14” java.lang.ArrayIndexOutOfBoundsException: -953
at G.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
2008-12-03 11:17:12:701 Get(1)=83708ms, Compute=25039ms, Upload=57478ms, Sleep=25039.0ms, Avg Compute=25039ms
2008-12-03 11:17:12:997 Get(1)=83700ms, Compute=24697ms, Upload=58499ms, Sleep=24697.0ms, Avg Compute=24697ms
exp=1571, start=2, num=26775636225
exp=1571, start=2, num=26731454147
[/quote]

Woha! O_O

Cool stuff! :slight_smile:
Can I still use “Left 4 Kay” as I had planned? :wink: Heh…

EDIT: Way, way too fast though.

Very, very nice. I look forward to seeing what it looks like when its more playable.

This is 4k? Incredible!!!

Really wonderful lighting effects for 4k. Bravo, seriously.

The crashes are most likely from the map borders not working.

The lighting works like this:
The game area is 240x240 pixels (the rightmost panel is planned for gui stuff). For each border pixel (ie 240*4 pixels), I draw a line from the center of the view towards the target pixel. For each pixel on that line, I check if the map is of color 0x000000, and if it is, I reduce the power of the light by 50% (this provides somewhat soft shadows). Walls thicker than three pixels will remove all light.
I set the light of each pixel on the line to that in a look-up-table (for speed, not for space) multiplied by the current light level.
To get the flashlight effect, I have an exponential falloff in base light level based on the difference in light ray angle and player view angle.
There’s also a sphere of light directly around the player to help when backing into corners and so.

Then I render the area around the player, and multiply the colors by the light level.

When the player moves, I check that he isn’t moving into a map pixel with color 0x000000. Zombies will use the same check.

The game is just under 2kb so far, and I still need to add

  • Rotating graphics for zombies, players and bullets
  • Bullets
  • Zombies that walk towards the player
  • Zombie hoards that spawn a whole pile of zombies at random
  • Health bar + game over

Maybe, in order of importance:

  • Scoring?
  • Some way of winning?
  • Blood splatter that sticks to the map graphics when killing a zombie?
  • Tanks? Witches? Boomers?
  • Four survivors you can select between with the 1-4 keys? (Blue outlines in the dark?)
  • Pipe bombs?
  • Molotovs/fire?

[quote=“Morre,post:5,topic:32601”]
The more the merrier! I just wanted to claim the name, not the concept. :wink:

http://www.mojang.com/notch/j4k/tmp/slaughter.jpg

Play now!

It’s still missing actual gameplay stuff (like losing and winning), but you can kill zombies now. =D
Plus, there’s film grain.

Oh that is dam cool.
So you using jasmin for this?

Not yet. It was taking far too long to build something from scratch in there, so I’m writing it in java first, then I’ll port it to jasmin later on if I need additional space. There are a few pieces of code that would benefit by being moved to sub routines (JSR/RET), like the line algorithms (bullet clipping, blood splatter) and several instances of relative position calculations, so I think I should be able to shave it down a bit.

[edit:]

I’ve updated the applet. There are more zombies now, and they never run out. :smiley:

[quote]and they never run out.
[/quote]
Damn, I should have read this first!

Dmitri

Wow. :o

This is really good. 4k. Jeez!

That’s quite stunningly good fun!

It’s begging for RMB to toss grenades/molotov’s!
Oh and groan, gun & squelch sfx ;D

I’m having trouble running it.

[quote]Exception in thread “Thread-1386” java.lang.OutOfMemoryError: Java heap space
[/quote]

It should allocate 102410244 bytes of data for the map, 1716412124 bytes for the sprites, and 32024024 bytes for the rendering.

That’s just over 5mb… doesn’t seem TOO bad.

Very cool stuff, Markus!

It took me a while to realize that WASD actually directly controlled the movement. Given the sort of animation you have, I first thought you’d have W for forward, S for back, and A/D for turning. On the other hand, that wouldn’t make any sense at all with the mouse aiming, so what you’ve got is good.

BTW, a different control scheme may be a bit better: left mouse to move to pointer, right to shoot (or the other way around)…

Dmitri