Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (491)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (556)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [j4k mk3] jm4k  (Read 4686 times)
0 Members and 1 Guest are viewing this topic.
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Posted 2004-12-24 14:47:16 »

Ok. Here is my entry Smiley

jar link removed for yahoo's crawler http://kaioa.com/games/jm4k.zip[soundbank required - it will just bomb out without one!]

4093 4092 bytes used. There wasn't room for a manifest.mf - sorry Tongue

java -cp .;jm4k.jar D

The game runs in fullscreen 640x480x32@0hz. It relys vsync for throtteling (sorry - no space) and is supposed to be run at 75hz.

Keys:
Press <space> to start.
left = left
right = right
up or down = fire + thrust

You can also fly backwards if you want to, by pressing (and holding) the direction you want to move to first and then press (and hold) the direction you want to fire. It's pretty funny, but also quite hard getting used to that.

The bar on the bottom labeled with 'F' "FUEL" is the fuel-meter. If it runs out, you die - game over. Flying into enemys and firing decreases it (more in higher levels). You can refill it by picking up the 'F' items and you also get a full bar at the start of each level.

The other bar on the bottom labeled with 'W' "WARP" is the warp-meter. It decreases automatically. If it runs out you're in the next level.

The other things... well, you'll see Wink

弾幕 ☆ @mahonnaiseblog
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #1 - Posted 2004-12-24 17:17:12 »

Cool, it plays like an old B&W arcade  Smiley
Runs very smooth, and the sound is also pretty good. Having the shoot button mapped to the 'up' key is clever.
Very nicely done!

Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #2 - Posted 2004-12-24 18:43:39 »

Smiley

The sound is somewhat non static. The volume of the explosion effect depends on the distance (except for end of level and own death - those are fixed). And the volume of the bump against floor/ceiling depends on the speed. Well, most people won't notice, but I thought it's a cool thing (it was also very cheap to add Wink).

From level 5 upwards there are spikes on the floor and from level 10 upwards there are also spikes on the ceiling.

For offsetting the difficulty jump the spawn rate is decreased back to a lower level. Neat, isn't it? Oh and that was a one liner:
if(Math.random()>1.0-(double)(l<15?(l>4?l%5+2:l%5+1):l-10)/250.0)
spawn here Smiley

I also just spotted some unused vars... maybe it's enough to label the bars properly... like "FUEL" and "WARP" (the way they have been).

Right now there are 824 lines of code... one constructor, main (one liner) and processKeyEvent (one liner) and nothing else. It's so screwed Grin

弾幕 ☆ @mahonnaiseblog
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #3 - Posted 2004-12-24 19:39:47 »

Updated.

http://www.kaioa.com/games/jm4k.jar (same url)

4092 bytes now. The bars are now properly labeled and the "SPACE" text is blinking (insert credit-ish).

Removing some unused vars made that possible Wink

弾幕 ☆ @mahonnaiseblog
Offline Abuse

JGO Knight


Medals: 12


falling into the abyss of reality


« Reply #4 - Posted 2004-12-24 22:33:47 »

switch the main for a static {} initializer as the app. entry point should save you afew bytes  Wink

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #5 - Posted 2004-12-24 23:39:41 »

But that won't be enough for a manifest.mf right?... Yep, not enough.

Well, basically there is everything I wanted to put in (plus some cheap fluff) except a manifest.

Hm. Ok there is another thing I could try.

弾幕 ☆ @mahonnaiseblog
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #6 - Posted 2004-12-25 02:03:49 »

Quote
switch the main for a static {} initializer as the app. entry point should save you afew bytes  Wink


If you have any exceptions, then it's actually cheaper to define:

1  
public static void main(String[] args) throws Exception


Throwing the exception from main is way less costly than a complete try/catch block. :-)

Java Game Console Project
Last Journal Entry: 12/17/04
Offline princec

JGO Kernel


Medals: 369
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #7 - Posted 2004-12-25 09:00:46 »

Level 5, $6344!
Nice.

Cas Smiley

Offline weston

Junior Member





« Reply #8 - Posted 2004-12-25 22:24:34 »

<n00b>I don't see how you are playing sounds without using a sound file... did you just view the bytes of some sound and hard code them into a byte array in your program or something?</n00b>. The game is quite fun, I'm amazed at how much could be done with 4k... would remind me of a c64 game if it had a couple more colors Smiley

level 10 Grin

for(int i = 1; i > 0; i++)
{
System.out.println(i+" cups of java downed");
}
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #9 - Posted 2004-12-25 23:03:39 »

Quote
I don't see how you are playing sounds without using a sound file... did you just view the bytes of some sound and hard code them into a byte array in your program or something?


Well, there's a hint... "soundbank required" Wink

I just trigger midi events directly like this instrument, kinda lound and high pitch. That's by far the cheapest way to produce any sounds - at least if you look at the required bytes.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
import javax.sound.midi.*;
[...]
Synthesizer synth;
(synth = MidiSystem.getSynthesizer()).open();
Receiver synthRcvr = synth.getReceiver();

ShortMessage sm = new ShortMessage();

Instrument[] I=synth.getAvailableInstruments();

//instrument remapping
//will bomb out here with an IndexArrayOutOfBoundsException if there isn't a soundbank
synth.remapInstrument(I[118],I[0]); //shoot
synth.remapInstrument(I[116],I[1]); //explosion1
synth.remapInstrument(I[127],I[2]); //explosion2
synth.remapInstrument(I[ 98],I[3]); //bonus

[...]

//playing shoot sound, high pitch and not very loud
sm.setMessage(ShortMessage.NOTE_ON, 0, 80, 40);
synthRcvr.send(sm,-1); //instant play


Abuse did a similar thing in his 4k shooter game (j4k mk2). His approach was slightly different... not sure if his version is better or smaller.

>The game is quite fun, I'm amazed at how much could be done with 4k

Thanks Grin

---

I just made a new version... featuring a title screen and it also explains the controls ingame.

See here:
http://kaioa.com/k/jm4k_title.png

Nice arrows huh? Well, it's just:
1  
g.drawString("LEFT \u2190\u2195\u2192 RIGHT",250,380);

Haha Grin

http://kaioa.com/games/jm4k.zip

It's now a zip file, containing two files... it just gave me a little extra room Wink
jm4k.jar39213934
d144
together40654078


Just made the title a bit nicer Wink

弾幕 ☆ @mahonnaiseblog
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Ahmad

Junior Newbie




Java games rock!


« Reply #10 - Posted 2004-12-26 08:17:34 »

whoa! This is actually fun.. im amazed Cheesy
Offline qgpr

Senior Newbie




yawn


« Reply #11 - Posted 2005-01-05 18:53:08 »

I cant* play it here, invalid display mode. Would you mind doing a 16bit colors version?
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #12 - Posted 2005-01-05 20:53:43 »

Oh that's odd. I tried it on a 1.4 machine with a 16bit only card (voodoo banshee) and it worked there. :-/

Well, I have some bytes free... maybe it's enough for a command line switch.

弾幕 ☆ @mahonnaiseblog
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #13 - Posted 2005-01-06 02:27:55 »

New version:
http://kaioa.com/games/jm4k.zip

jm4k.jar_3950
d_________144
-------------
total____4094


Run the game in 16bit mode:
java -cp .;jm4k.jar D any arguments will do the trick Smiley

弾幕 ☆ @mahonnaiseblog
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Nickropheliac (15 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (29 views)
2014-08-22 19:31:30

atombrot (41 views)
2014-08-19 09:29:53

Tekkerue (39 views)
2014-08-16 06:45:27

Tekkerue (35 views)
2014-08-16 06:22:17

Tekkerue (25 views)
2014-08-16 06:20:21

Tekkerue (36 views)
2014-08-16 06:12:11

Rayexar (72 views)
2014-08-11 02:49:23

BurntPizza (49 views)
2014-08-09 21:09:32
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!