Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (515)
Games in Android Showcase (122)
games submitted by our members
Games in WIP (577)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 2 [3] 4
  ignore  |  Print  
  Preliminaries (tentative)  (Read 20393 times)
0 Members and 1 Guest are viewing this topic.
Offline appel

JGO Wizard


Medals: 51
Projects: 4


I always win!


« Reply #60 - Posted 2009-11-02 12:44:59 »

Several applet base source codes have been posted in this thread. Wink

Does any of them provide for what is needed? End-user browser stability?

Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
Offline Markus_Persson

JGO Wizard


Medals: 16
Projects: 19


Mojang Specifications


« Reply #61 - Posted 2009-11-02 13:07:16 »

Other than a few people with no java installations, I haven't received a single complaint about left 4k dead not working, and it's received quite a lot of attention.

Play Minecraft!
Offline Alan_W

JGO Knight


Medals: 8
Projects: 3


Java tames rock!


« Reply #62 - Posted 2009-11-02 19:46:57 »

The following is my suggestion for a template.  Note that the graphics context is grabbed outside the main loop, which would cause issues if the browser window is minimised and then maximised as internet explorer assigns a new graphics context.  However fortunately isActive() goes false when the window is minimised and  thus the thread terminates.  It is recreated when the window is maximised, which causes a new graphics context to be grabbed.

The optional lines can be omitted if you don't care about Appletview and Webstart, and are desperate to save a few bytes.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
public class A extends Applet implements Runnable {

  public void start() {
    enableEvents(...);
    new Thread(this).start();
  }

  public void run() {
    // Initialise
    ...
    while (!isActive()) Thread.yield(); // Optional line to ensure Appletviewer works

    Graphics g;
    while ((g=getGraphics())==null) Thread.yield(); // Optional line to ensure Webstart works
    // g=getGraphics(); // You need this if the previous line is omitted

    do {
      // Game Loop
      ...
      if (g!=null) { // Catch Null Pointer exceptions (in most cases)
        // Draw on screen
        ...
      }
      ...
    } while (isActive());
  }
  ...
}

Time flies like a bird. Fruit flies like a banana.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline TheAnalogKid

JGO Coder


Projects: 2



« Reply #63 - Posted 2009-11-02 19:56:03 »

Question: do you rely on System.currentTimeMillis() or System.nanoTime() to cap the FPS in the rendering loop? I guess so otherwise you'd bust the 4k limit using a third party lib.

BTW, thanks for the code, it will save precious time about code size optimizations.

Offline appel

JGO Wizard


Medals: 51
Projects: 4


I always win!


« Reply #64 - Posted 2009-11-03 15:21:41 »

The following is my suggestion for a template.  Note that the graphics context is grabbed outside the main loop, which would cause issues if the browser window is minimised and then maximised as internet explorer assigns a new graphics context.  However fortunately isActive() goes false when the window is minimised and  thus the thread terminates.  It is recreated when the window is maximised, which causes a new graphics context to be grabbed.

The optional lines can be omitted if you don't care about Appletview and Webstart, and are desperate to save a few bytes.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
public class A extends Applet implements Runnable {

  public void start() {
    enableEvents(...);
    new Thread(this).start();
  }

  public void run() {
    // Initialise
    ...
    while (!isActive()) Thread.yield(); // Optional line to ensure Appletviewer works

    Graphics g;
    while ((g=getGraphics())==null) Thread.yield(); // Optional line to ensure Webstart works
    // g=getGraphics(); // You need this if the previous line is omitted

    do {
      // Game Loop
      ...
      if (g!=null) { // Catch Null Pointer exceptions (in most cases)
        // Draw on screen
        ...
      }
      ...
    } while (isActive());
  }
  ...
}


This does not use double buffering.

Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
Offline pjt33
« Reply #65 - Posted 2009-11-03 17:23:24 »

I have updated the skeleton applet I posted on the previous page.
Offline Markus_Persson

JGO Wizard


Medals: 16
Projects: 19


Mojang Specifications


« Reply #66 - Posted 2009-11-08 13:12:16 »

1  
Component#handleEvent(Event)

[...]
By my guesstimates, that should save ~50-100 bytes of compressed code!

And so it does! Wowzers. I used it for Left 4k Dead 2 which I released a few days ago, and just that change alone gained me some 100+ extra bytes. Amazingsauce!


1  
2  
3  
4  
5  
6  
7  
   @Override
   public boolean handleEvent(Event evt)
   {
      // Non-key events have 0 for their key field.
      keyEventCount[evt.key]++;
      return false;
   }

Won't this cause the key to toggle on/off repetedly for keytyped events?

Play Minecraft!
Offline pjt33
« Reply #67 - Posted 2009-11-08 20:48:47 »

Won't this cause the key to toggle on/off repetedly for keytyped events?
What keytyped events? The 1.0 event model has KEY_PRESSED and KEY_RELEASED.

If I hold down a key then keyDown remains consistent and keyPressed flickers inconsistently, but it's probably quite variable between OSes and Java versions. My Debian/KDE/Sun Java 6 setup has aggressive key-repeat, so I get a continuous stream of KEY_PRESSED and KEY_RELEASED events. It appears that the (KEY_RELEASED KEY_PRESSED) auto-repeat sequence occurs an integer number of times between frames (don't ask me how it's so consistent), but not always once per frame.

I think what I have there will be adequate for my games this year; the ideas I have in the pipeline are mainly mouse-driven, and the one key-driven one is going to rely on keyDown. The whole issue of key repeat is a thorny one, though, because there's so much variation. Some games last year were hard to play on my box possibly because they weren't expecting it.
Offline Abuse

JGO Knight


Medals: 13


falling into the abyss of reality


« Reply #68 - Posted 2009-11-08 23:39:55 »

What keytyped events? The 1.0 event model has KEY_PRESSED and KEY_RELEASED.

If I hold down a key then keyDown remains consistent and keyPressed flickers inconsistently, but it's probably quite variable between OSes and Java versions. My Debian/KDE/Sun Java 6 setup has aggressive key-repeat, so I get a continuous stream of KEY_PRESSED and KEY_RELEASED events. It appears that the (KEY_RELEASED KEY_PRESSED) auto-repeat sequence occurs an integer number of times between frames (don't ask me how it's so consistent), but not always once per frame.

I think what I have there will be adequate for my games this year; the ideas I have in the pipeline are mainly mouse-driven, and the one key-driven one is going to rely on keyDown. The whole issue of key repeat is a thorny one, though, because there's so much variation. Some games last year were hard to play on my box possibly because they weren't expecting it.

Does the jvm for linux *still* have that repeated keypress/release bug when holding a key down?!
That's been there for as long as i've been using Java, core awt behaviour that simply fails to conform to the awt event model specification.

Mindboggling.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline pjt33
« Reply #69 - Posted 2009-11-08 23:45:09 »

Does the jvm for linux *still* have that repeated keypress/release bug when holding a key down?!
That's been there for as long as i've been using Java, core awt behaviour that simply fails to conform to the awt event model specification.

Mindboggling.
To be honest I think it's my KDE settings rather than the JVM, but anyone who wants to write cross-platform should assume that it's a possibility. The joys of write-once-debug-everywhere. After all, who's going to reconfigure their desktop just to play a minigame?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Markus_Persson

JGO Wizard


Medals: 16
Projects: 19


Mojang Specifications


« Reply #70 - Posted 2009-11-09 10:48:40 »

What keytyped events? The 1.0 event model has KEY_PRESSED and KEY_RELEASED.

Sounds great =D

Play Minecraft!
Offline StephR

Senior Duke


Medals: 9



« Reply #71 - Posted 2009-11-11 21:32:28 »

Here is a question which has not already been asked, it seems : Appel, when will end the submission period for the coming 2010 competition ? I didn't find the answer on the official site or in this topic.
Offline appel

JGO Wizard


Medals: 51
Projects: 4


I always win!


« Reply #72 - Posted 2009-11-12 09:21:12 »

Here is a question which has not already been asked, it seems : Appel, when will end the submission period for the coming 2010 competition ? I didn't find the answer on the official site or in this topic.

3 months. 1st of Dec - 28th of Feb.

Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
Offline moogie

JGO Knight


Medals: 13
Projects: 6
Exp: 10 years


Java games rock!


« Reply #73 - Posted 2009-11-12 20:57:27 »

Are the rules going to be different to last year?

Specifically the pack200 rule. Does it even need to be there since the games are hosted by your own web host? I would like to embed a pack200 version of my game into a loading stub which reads itself and extracts the embedded game, creates an instance and uses it.

and what is the rules about signing? is the digital signature component counted toward the 4096 bytes? last year the rule was:
"If your JAR is below 4K until you sign it, you must provide a runnable unsigned JAR to demonstrate the game meets the competition rules." but since it is now an applet it is not "runnable" unless it is in the context of appletviewer.

Offline appel

JGO Wizard


Medals: 51
Projects: 4


I always win!


« Reply #74 - Posted 2009-11-17 13:29:08 »

Are the rules going to be different to last year?

Specifically the pack200 rule. Does it even need to be there since the games are hosted by your own web host? I would like to embed a pack200 version of my game into a loading stub which reads itself and extracts the embedded game, creates an instance and uses it.

and what is the rules about signing? is the digital signature component counted toward the 4096 bytes? last year the rule was:
"If your JAR is below 4K until you sign it, you must provide a runnable unsigned JAR to demonstrate the game meets the competition rules." but since it is now an applet it is not "runnable" unless it is in the context of appletviewer.

The rules on the java4k.com site today are outdated.

Regarding pack200. I don't remember all the reasons why it wasn't allowed. Some discussion about it is in order perhaps.

Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 78
Projects: 15


★★★★★


« Reply #75 - Posted 2009-11-17 14:30:31 »

Regarding pack200. I don't remember all the reasons why it wasn't allowed. Some discussion about it is in order perhaps.

The main reason I think was because Java 1.4 does not support pack200. Guess 1.4 is old enough now to set the minimum contest requirement to Java 1.5 (5.0).
Offline appel

JGO Wizard


Medals: 51
Projects: 4


I always win!


« Reply #76 - Posted 2009-11-17 15:26:38 »

The main reason I think was because Java 1.4 does not support pack200. Guess 1.4 is old enough now to set the minimum contest requirement to Java 1.5 (5.0).

I haven't really taken a look at pack200. Does something need to be supported on the server?

Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 78
Projects: 15


★★★★★


« Reply #77 - Posted 2009-11-17 15:49:40 »

I haven't really taken a look at pack200. Does something need to be supported on the server?

nope nothing needs to change on the server side, instead of uploading foo.jar developers would upload a foo.pack.gz

Any jre 1.5+ should detect this as a pack200 file and run it.

But do be careful since there are two versions pack200 atm (java 5 and java 6 editions). Using the pack200 from java 6 will not work on java 5, so when creating the pack200 files do remember to specify the parameter to create a pack200 file compatible with java 5.

However its unlikely for there to be any significant size reduction when using pack200 on a 4k file.
Offline pjt33
« Reply #78 - Posted 2009-11-17 19:18:50 »

nope nothing needs to change on the server side, instead of uploading foo.jar developers would upload a foo.pack.gz

Any jre 1.5+ should detect this as a pack200 file and run it.
That's not how the documentation paints it:
http://java.sun.com/j2se/1.5.0/docs/guide/deployment/deployment-guide/pack200.html
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 78
Projects: 15


★★★★★


« Reply #79 - Posted 2009-11-17 20:00:18 »


well the server stuff is just there if you want to maintain backwards compatibility with older versions of java, it'll just check if the jre requesting the file supports pack200, if it does it gives it the foo.pack.gz file, if it doesn't then it gives it a normal foo.jar. Its a good way to save bandwidth and give users a quicker download but unlikely of use to the 4k competition.
Offline EnderGT

Junior Duke





« Reply #80 - Posted 2009-11-21 19:11:26 »

Deliverables
Applets only (required), webstart optional (applets can be launched as Webstart).

Isn't this a bit overly restrictive? I was planning on resubmitting my poker server/client this year, modified to not use the command line for the server address input, but I'm not sure an Applet can act as a server, or even connect to a server?
Offline Alan_W

JGO Knight


Medals: 8
Projects: 3


Java tames rock!


« Reply #81 - Posted 2009-11-26 07:13:20 »

Less than a week to go now  Grin

Tried the Java 1.0 keyboard event model, but only managed to save about 6 bytes, which was rather strange as enableEvents() was no longer required.  Probably 'enable' and 'Event' occurred elsewhere and compression did the rest.

The java penetration thread elsewhere on this site makes interesting reading, with java 1.6 installs really taking off now, but java 1.5 still having a large user base.  1.4.2 seems to be down to 5%.  I'll probably code for 1.4.2 once more out of force of habit, but 1.5 now looks the better target.

It has been particularly wet and windy in the UK this last week or so, with the result that I spent last Sunday refactoring my isometric game codebase into 4k.


Time flies like a bird. Fruit flies like a banana.
Offline appel

JGO Wizard


Medals: 51
Projects: 4


I always win!


« Reply #82 - Posted 2009-11-26 13:43:46 »

Isn't this a bit overly restrictive? I was planning on resubmitting my poker server/client this year, modified to not use the command line for the server address input, but I'm not sure an Applet can act as a server, or even connect to a server?

Note that the Applet-only restriction only applies to the end-user part of the game. As long as the end-user can play the game in a web browser, just like should be the norm, that game qualifies. You may of course write some server application that the game interacts with. I am not knowledgeable enough of Applets to know if you can host that server wherever, maybe you can with a signed Applet. Perhaps I can look into hosting it, but I am skeptical about it since running third-party processes on the machine is dubious.

But I am willing to accommodate anyone that wishes it. Just need to talk to me in order to find a solution that works.

Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
Offline appel

JGO Wizard


Medals: 51
Projects: 4


I always win!


« Reply #83 - Posted 2009-11-26 13:44:52 »

The website will be updated over the weekend, and the new rules will be put up.

5 days Grin

Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
Offline Morre

JGO Knight


Medals: 2
Projects: 10


I'm Dragonene on IRC.


« Reply #84 - Posted 2009-11-26 14:45:27 »

Has there been a decision on how to handle scoring for games where one judge couldn't start the game? Also, will they be asked to try it on multiple platforms? I understand if this is not the case, of course.

Offline Markus_Persson

JGO Wizard


Medals: 16
Projects: 19


Mojang Specifications


« Reply #85 - Posted 2009-11-26 15:37:56 »

Note that the Applet-only restriction only applies to the end-user part of the game. As long as the end-user can play the game in a web browser, just like should be the norm, that game qualifies. You may of course write some server application that the game interacts with. I am not knowledgeable enough of Applets to know if you can host that server wherever, maybe you can with a signed Applet. Perhaps I can look into hosting it, but I am skeptical about it since running third-party processes on the machine is dubious.

But I am willing to accommodate anyone that wishes it. Just need to talk to me in order to find a solution that works.

Just to clarify, I assume the total size of the entire project (including server parts) must not exceed 4KB, the only exception being jnlp files or applet tags on the condition that those don't inject any data or logic into the game.

Play Minecraft!
Offline appel

JGO Wizard


Medals: 51
Projects: 4


I always win!


« Reply #86 - Posted 2009-11-26 15:47:52 »

Just to clarify, I assume the total size of the entire project (including server parts) must not exceed 4KB, the only exception being jnlp files or applet tags on the condition that those don't inject any data or logic into the game.

You're correct.

Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
Offline Markus_Persson

JGO Wizard


Medals: 16
Projects: 19


Mojang Specifications


« Reply #87 - Posted 2009-11-27 11:10:37 »

And I have to just add that as usual, I'm really excited about this. Cheesy

Play Minecraft!
Offline pjt33
« Reply #88 - Posted 2009-11-27 12:19:58 »

And I have to just add that as usual, I'm really excited about this. Cheesy
I've got about four games I want to make, but I doubt I'll have time for all of them.
Offline steveyO
« Reply #89 - Posted 2009-11-27 13:43:39 »

Four games, gosh!!  It's taken me 6 months just to think of an idea for one!!  Just thought of one today.. No revolving screens this time! Am in!

https://play.google.com/store/apps/details?id=com.bullsquared.alggame Annoying Little Gits (Android)
www.bullsquared.com   Play java (applet) games! www.chessclockpro.com Free Online Chess Clock
Pages: 1 2 [3] 4
  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.

TehJavaDev (31 views)
2014-10-27 03:28:38

TehJavaDev (26 views)
2014-10-27 03:27:51

DarkCart (40 views)
2014-10-26 19:37:11

Luminem (21 views)
2014-10-26 10:17:50

Luminem (25 views)
2014-10-26 10:14:04

theagentd (31 views)
2014-10-25 15:46:29

Longarmx (61 views)
2014-10-17 03:59:02

Norakomi (57 views)
2014-10-16 15:22:06

Norakomi (46 views)
2014-10-16 15:20:20

lcass (43 views)
2014-10-15 16:18:58
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!