Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (476)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
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  
  Super Sprint 4k  (Read 7144 times)
0 Members and 1 Guest are viewing this topic.
Offline ap_kelly

Junior Member




Java rocks!


« Posted 2005-01-25 20:37:32 »

Well, I'm still a little over the 4k limit, but I haven't started doing the optimisation of my code, I'm currently at 6526 bytes, but should make 4k by the end of Feb.

Anyway here it is Super Sprint 4k *cough* 7k ;-)

Super Sprint 4k

Instructions and source code are available on my site, I'm sure a few people here will wince horribly when they see the code.

A few outstanding issuse still to be finished, e.g. car animation, better collision detection etc.

Be kind,

Andy.

Offline Malohkan

Senior Member




while (true) System.out.println("WOO!!!!");


« Reply #1 - Posted 2005-01-25 20:44:00 »

Interesting start Wink  Reverse and restart features would be nice

Admin and Game Developer at
GameLizard.com
Play Rimscape!    |    Play Conquer!
Offline jbanes

JGO Coder


Projects: 1


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


« Reply #2 - Posted 2005-01-25 20:50:11 »

I can't play it because my Mac doesn't have Java 1.5, but you may find this first year entry very interesting...

http://www.pkl.net/~rsc/4KApplet/4KApplet.html

Java Game Console Project
Last Journal Entry: 12/17/04
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Malohkan

Senior Member




while (true) System.out.println("WOO!!!!");


« Reply #3 - Posted 2005-01-25 20:56:13 »

I managed to get all of Abuse's cars in a jam in a corner Wink

Admin and Game Developer at
GameLizard.com
Play Rimscape!    |    Play Conquer!
Offline jbanes

JGO Coder


Projects: 1


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


« Reply #4 - Posted 2005-01-25 21:03:41 »

Whoa. Time-out! I just looked through the code, and there's some serious optimizing that can be done:

1. Replace the three parameter constructors of Color (i.e. new Color(240, 160, 0)) with the Hex equivalents (e.g. new Color(0xF0A000)).

2. Move as many of those static entries into the main method as possible! You don't pay extra for method variables (they're all on the stack), but you do pay for fields and methods!

3. Get rid of unnecessary class references. Being able to use "Point" is nice, but for what it costs, you should stick to a 2D array.

4. Nice fonts are, well, nice, but configuring them costs some serious class space. Ditch 'em and use whatever the default is.

5. Move all that INT data to a file. I know you think you're saving space by using an embedded array, but what you're actually doing is generating a constant pool entry plus a stack push operation for each array item! If you want to embed the data, encode it as a string and decode it at runtime.

6. This:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
JPanel panel = (JPanel) container.getContentPane();
    panel.setPreferredSize(new Dimension(WIDTH, HEIGHT));
    panel.setLayout(null);
   
    // setup our canvas size and put it into the content of the frame
 
    setBounds(0, 0, WIDTH, HEIGHT);
    panel.add(this);
   
    // Tell AWT not to bother repainting our canvas since we're
   // going to do that our self in accelerated mode
   setIgnoreRepaint(true);
   
    // finally make the window visible
   container.pack();
    container.setResizable(false);
    container.setVisible(true);


Can be more succinctly stated as:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
JPanel panel = (JPanel) container.getContentPane();
       
    // setup our canvas size and put it into the content of the frame
 
    setBounds(0, 0, WIDTH, HEIGHT);
    panel.add(this);
   
    // Tell AWT not to bother repainting our canvas since we're
   // going to do that our self in accelerated mode
   setIgnoreRepaint(true);
   
    // finally make the window visible
   container.setResizable(false);
    container.setVisible(true);


7. Inline those methods!

In short, you've got a lots of opportunities to fit this in 4K. :-)

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

Junior Member




Java rocks!


« Reply #5 - Posted 2005-01-25 21:46:56 »

Thanks for the quick responses, having tried a few quick optimisations I've knocked another 900bytes off the total, and that was just by inlining most of my methods!

jbanes, thanks for the links and tips, I'll be sure to check them out.

I don't use any Java 1.5 features, so I've changed the jnlp file so that everyone can play.

Feeback is such a wonderful boost to the ego, I really must get this finished now.

Thanks,

Andy.

Offline jojoh

JGO Knight


Medals: 5
Projects: 7


games4j.com


« Reply #6 - Posted 2005-01-26 08:33:54 »

Looks very interesting. Tried to run it on a Java 1.4 machine, but got this from the downloaded jar
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
Exception in thread "main" java.lang.UnsupportedClassVersionError: SS (Unsupported major.minor version 49.0)
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)

Think this is because it is still compiled to a Java 1.5 class. The nice feedback from the webstart is that the splash screen just sits there, and then nothing happens. Would have been nice from sun, to give some sort info on what went wrong  Tongue

Anyway, it should be enough to change the "compile level" or something like that to 1.4 or lower.

Offline ap_kelly

Junior Member




Java rocks!


« Reply #7 - Posted 2005-01-26 11:22:22 »

I'll change the target to 1.2 on the compiler for the next release. I forgot to do this when I changed the jnlp to reference 1.2 as well.

Check back in 18hrs for an update.

Andy.

PS: Happy Australia Day to all our Australian community members.

Offline darkprophet

Senior Member




Go Go Gadget Arms


« Reply #8 - Posted 2005-01-26 17:36:18 »

hehehe, v. fun game!



Im the only one left! Grin

DP

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Offline Malohkan

Senior Member




while (true) System.out.println("WOO!!!!");


« Reply #9 - Posted 2005-01-26 20:42:41 »

That's the traffic jam I was talkin about! Smiley

Admin and Game Developer at
GameLizard.com
Play Rimscape!    |    Play Conquer!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #10 - Posted 2005-01-26 22:24:13 »

hehe, yeah that game was sooooo primitive =)

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

JGO Coder


Projects: 1


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


« Reply #11 - Posted 2005-01-26 22:55:19 »

Quote
hehe, yeah that game was sooooo primitive =)


I seem to remember that was the time when you were certain that nothing useful would fit in 4k. ;-)

But you are correct. These days you'd have fit fullscreen, scrolling, and powerups into it!  Grin

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

Junior Member




Java rocks!


« Reply #12 - Posted 2005-01-27 10:09:12 »

I've re-compiled the code with the target=1.2 flag, which has saved me another 100bytes, as well as allowing Mac users to finally play the game.

I'm in the progress of adding Mac support to my tutorials sections as well, so look out for those updates in the next day or two.

Regards,

Andy.

Offline darkprophet

Senior Member




Go Go Gadget Arms


« Reply #13 - Posted 2005-01-27 12:24:21 »

it still wont run on 1.4 Sad

Update the jar please! Im dyin to play this game! Cheesy

DP

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Offline ap_kelly

Junior Member




Java rocks!


« Reply #14 - Posted 2005-01-27 18:33:03 »

Updated.

Never code when drunk, it doesn't always go as planned.

Andy.

Offline darkprophet

Senior Member




Go Go Gadget Arms


« Reply #15 - Posted 2005-01-27 19:51:38 »

What ever happened to rotation?  Shocked

If you make em top down, and add rotation, it would be super!

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Offline ap_kelly

Junior Member




Java rocks!


« Reply #16 - Posted 2005-01-27 20:56:46 »

Rotation is one of the few things left on my to-do list, along with lap counter for your car and better collision detection.

I should be able to post an update on Sunday night that contains some/all of these updates.

I was concentrating this week on reducing the size (still over the limit) and making sure I compiled everything with 1.2 so our Mac friends can play along.

Andy.

Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #17 - Posted 2005-01-27 21:08:46 »

Mac-compatibility means right now 1.4 and not 1.2 Wink

弾幕 ☆ @mahonnaiseblog
Offline Virum

Junior Member




Like a leaf in an icy world, memories will fade


« Reply #18 - Posted 2005-01-28 01:29:18 »

Quote
hehe, yeah that game was sooooo primitive =)


I seem to remember everyone being blown away by it. Smiley

It's time to prove to your friends that your worth a damn. Sometimes that means dying; sometimes that means killing a whole lotta people.

Blog
Offline ap_kelly

Junior Member




Java rocks!


« Reply #19 - Posted 2005-01-28 04:16:38 »

Quote
Mac-compatibility means right now 1.4 and not 1.2 Wink


So does this mean it needs to be re-compiled with 1.4? I would have thought that the 1.4 JVM could run 1.2 code, correct?

Andy.

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.

pw (21 views)
2014-07-24 01:59:36

Riven (19 views)
2014-07-23 21:16:32

Riven (16 views)
2014-07-23 21:07:15

Riven (19 views)
2014-07-23 20:56:16

ctomni231 (47 views)
2014-07-18 06:55:21

Zero Volt (43 views)
2014-07-17 23:47:54

danieldean (34 views)
2014-07-17 23:41:23

MustardPeter (38 views)
2014-07-16 23:30:00

Cero (53 views)
2014-07-16 00:42:17

Riven (52 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!