Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (120)
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 ... 4 5 [6]
  ignore  |  Print  
  Discuss the future of 4k contest  (Read 26083 times)
0 Members and 1 Guest are viewing this topic.
Offline moogie

JGO Knight


Medals: 13
Projects: 6
Exp: 10 years


Java games rock!


« Reply #150 - Posted 2013-11-27 07:51:57 »

definitely a great start Smiley

Hmm... i wonder whether we would be allowed fullscreen entries again now that it is affectively a java application... It would make my entry much better (a hybrid RTS)
Offline ctomni231

JGO Wizard


Medals: 99
Projects: 1
Exp: 7 years


Not a glitch. Just have a lil' pixelexia...


« Reply #151 - Posted 2013-11-27 11:56:23 »

Perfect! This launcher will go a long way into making java4k more viable. I especially like the fact it can run pack200 games. The contest is saved. :-)

Offline Sunsword

Junior Duke


Medals: 3



« Reply #152 - Posted 2013-11-27 14:11:31 »

Launcher looks neat. I'd like to try it out.

I could provide for a JSON service to retrieve list of games and any information to make it easier to display and run games.
Thanks appel, that would help make it more robust.  Right now I'm doing a simple regex parse of the HTML from the contest listing, but getting the values from a service or even an RSS feed would future-proof against changes to the HTML.  Here's the method, you can see how it relies on the page structure and CSS classes, so any significant changes to those would break it:
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  
29  
30  
   public static List<AppletConfig> getContestAppletConfigs(URL contestUrl) throws IOException {
      String regexGameUrl = "<tr>\\s*<td>\\s*<a\\s+href=\"(.*?gid=(\\d+))";
      String regexScreenshotUtl = "
<img src=\"(.*?)\"";
      String regexGameTitle = "
<td class=\"gametitle\"><a.*?>(.*?)</a>";
      String regexGameAuthor = "
<td class=\"gameauthor\"><a.*?>(.*?)</a>";
      String regexGameDownloads = "
<td class=\"gamedownloads\">(.*?)</td>";
      //String regexGameSubmitted = "
<td class=\"gamedownloads\">(.*?)</td>";
      String regexGameDescription = "
<td class=\"gamedescription\">(.*?)</td>";
     
      ArrayList<AppletConfig> applets = new ArrayList<>();
     
      String html = getHTML(contestUrl);
     
      if (html != null) {
         Matcher matcher = Pattern.compile(regexGameUrl + "
.*?" + regexScreenshotUtl + ".*?" + regexGameTitle + ".*?" + regexGameAuthor + ".*?" + regexGameDownloads + ".*?" + regexGameDescription).matcher(html);
         while (matcher.find()) {
            AppletConfig config = new AppletConfig();
            config.setGameUrl(JAVA4K_URL + "
/" + matcher.group(1));
            config.setJarPath(JAVA4K_URL + "
/applet.php?gid=" + matcher.group(2));
            config.setScreenshotUrl(JAVA4K_URL + "
/" + matcher.group(3));
            config.setName(matcher.group(4));
            config.setAuthor(matcher.group(5));
            config.setDownloads(Integer.parseInt(matcher.group(6)));
            config.setDescription(matcher.group(7));
            applets.add(config);
         }
      }
     
      return applets;
   }


A Service for the game-list informaion yould be great.
especially the information about the main class and target screen dimensions, as was defined in the applet definition:

<applet code="A.class" archive="applet.php?gid=431" width="600" height="600">
That would definitely help, as right now I need to hit the game page to get the name of the Main class, the width and the height.  It costs an extra few seconds, on top of pulling and loading the jar.

I'm having a few issues merging what I had already done with Groboclown's project, so it will be a bit until I can commit it there.  For the time being, you're welcome to run a bleeding edge build from my dropbox.  Once we get grobo's to the same point, I'll start committing a built jar to that project for anyone to download.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Groboclown
« Reply #153 - Posted 2013-11-27 16:58:09 »

I'm having a few issues merging what I had already done with Groboclown's project, so it will be a bit until I can commit it there.
I started working on making it work with WebStart apps, so it can potentially be used to run all the previous entries as well as the new ones.  I'm holding off new changes until you merge in.

Should we look into adding Mac compatibility to fix the issue it has with key release?

Offline Sunsword

Junior Duke


Medals: 3



« Reply #154 - Posted 2013-11-28 17:51:32 »

Grobo and Apo have both offered to help merge the work I've done with the project on pikacode; thank you to both of you.  For now I've simply zipped the source from my old project and put it in my public dropbox.  Grobo's got a lot of good security set up in his project that would be great to keep, as well as user-friendly error messages and things like that.  I've spent some time this lunch-hour cleaning up some bugs in my old project before posting the zip, and as far as I've tested the code I've posted correctly plays all apps from last year's competition (uncompressed, pack200 and pack200+gzip.)  I haven't pushed any further changes to the pikacode project since my changes are only partly complete, and also for some reasons listed below.

The problems I ran into when trying to put some of my work into what Groboclown has already done:
  • The use of launcher.dir in the policy file caused me some grief initially, and specifying the jar in the codebase means it can't be run directly from the Run menu in Eclipse (you have to build the jar first.)  Maybe we can just grant the higher permissions to all code on the classpath instead?
  • I can't actually see the running applets when running the code I pulled from pikacode - I get messages stating the applet started fine, but nothing is visible.  I've run in debug, and it looks like the applet is added, then pack and validate are called.  I don't know what's going wrong, unless there's a missing call to setVisible somewhere?
  • My code takes 5 or 6 seconds to download and start a game, and I expect Grobo's does as well (similar loading strategy), so if we stick with this strategy then a progress bar or message should be added.  An alternative is to pull all jars down right away on startup, but then we'd have to be careful of conflicts, e.g. two games with the same jar name.  (I'm sure A.jar is probably quite popular!) Renaming the jars when downloading would probably solve that.
  • In my code I'm using the system property java.io.tmpdir for temp files, I recommend we do that instead of storing them anywhere else (such as the launcher's directory.)  However when I changed the code in Grobo's PrivilegedActions.createTempJarFile(), the app gave me permission denied errors.  No idea why Sad
  • My code to get the list of games and the game details is quite a bit simpler than what's currently in the pikacode repository.  Groboclown may have made changes in the meantime, but if not might I suggest plugging in my code or something that reads a feed (if appel can get one set up.)  The code that's in the pikacode repository is certainly more robust than what I wrote, since it fully parses the HTML and then navigates the elements, so I understand if you decide to stick with it.  It just seemed a lot harder to understand than what I did with a few regex (though that might be because I wrote it - easier for an author to understand his own code?)
  • It looks like Groboclown's code runs the applets in a separate thread.  Is that necessary?  Is it for some security concerns, or something else?
  • My code in Java4KLauncher.java includes event handlers to stop, start and unload the current applet on minimizing, restoring and closing the application.  I didn't see anything similar in the pikacode, though I may have missed it (sorry if I did.) I see it now, it's in GamePanel.

Again, thanks for any and all help.
Offline Groboclown
« Reply #155 - Posted 2013-11-28 18:32:53 »

I just downloaded your code, and I'm looking into pulling it into the PikaCode codebase now.

Offline Groboclown
« Reply #156 - Posted 2013-11-29 02:55:40 »

Grobo and Apo have both offered to help merge the work I've done with the project on pikacode.
I finished my merge into PikaCode (https://pikacode.com/groboclown/java4k-launcher/), and added the capability to look at the different entries over the years.  I included progress bars and separated out the work for downloads into more reasonable places.  It still has a large amount of work to make it look pretty, and I know my use of SwingWorker can be better done, but the basics are there.

Somewhere along the line I introduced a bad bug where the loaded applets are returning "null" from a getGraphics() call.  I'm assuming I'm just not parenting it correctly.  This is part of the reason the applets weren't visible - they were crashing! UPDATE: I found the source of the issue and fixed it.

I'd like to see either caching of entries, or (possibly additionally) allowing for a zip download that includes all the previous entries to limit the amount of downloads we put on the java4k web site.

As to the other questions:

The use of launcher.dir in the policy file caused me some grief initially, and specifying the jar in the codebase means it can't be run directly from the Run menu in Eclipse (you have to build the jar first.)  Maybe we can just grant the higher permissions to all code on the classpath instead?
There's some options we can do here, like have a debug property that, if set and the launcher.dir isn't set, then we just don't install a security manager.


My code to get the list of games and the game details is quite a bit simpler than what's currently in the pikacode repository.
Yes, and the nice part is, yours works!  Hopefully the code I pulled in for this can be easily swapped out with a feed reader if we get to that point.

It looks like Groboclown's code runs the applets in a separate thread.  Is that necessary?  Is it for some security concerns, or something else?
It's for security reasons, and being able to force a badly running applet to die.  Applets are supposed to not be able to create new top-level thread groups, so that the running tool can just kill all the threads running in that thread group.  It's also used for ensuring that the applet is running in the right security context.  I also have all the thread stuff there so that we make sure that each of those different tasks runs under that thread group.

Offline Groboclown
« Reply #157 - Posted 2013-11-29 13:16:13 »

Here's a screenshot from the current build:



Here's my current list of to-dos:
  • The rest of the details needs to be loaded from the Java4k page.  Right now that's not happening.
  • There's some general Swing layout issues.  The details view of the active game needs a lot of improvement.  The layout is just not done right. I'm no Swing expert, and forms have always given me trouble. The default location for the splitters needs to be set to a reasonable value - right now, you need to manually adjust them at the start.  It'd be nice to add in some pretty icons.
  • Conversion from the HTML non-ascii characters and the Java string isn't working right - you'll notice some of the names aren't showing up right.
  • Add support for WebStart.  It's partly there, I just need to add code to parse the JNLP, and all the life cycle management code.
  • The pop-up dialogs for the progress bars and error messages are showing the "applet warning" note.  That needs to be fixed somehow in the security policy file, but I'm not sure which property manages that.
  • There's a bunch of code cleanup that needs to happen.  There's some places where it's pretty messy.  In particular, the management of the applet classloader needs to be tighter so that it can be property garbage collected.

Offline Cero
« Reply #158 - Posted 2013-11-29 13:35:47 »

Somehow naively I thought by launcher people would mean a slick looking Steam-like launcher, of course with less functionality.
But yeah using swing its gonna be hard making it look good.
This looks like a program from 2001.

Not bashing, maybe more design is on the agenda.

if design isnt on the agenda, at least do something minimalistic and not bulky looking. eg mame game select: http://cdn.toucharcade.com/wp-content/uploads/2013/01/IMG_0140-525x393.png

Offline Abuse

JGO Knight


Medals: 13


falling into the abyss of reality


« Reply #159 - Posted 2013-11-29 13:56:35 »

Looking great!

I wouldn't worry about prettifying it until it's functionally complete; you can waste loads of time dicking around with L&F.


Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online princec

JGO Kernel


Medals: 407
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #160 - Posted 2013-11-29 13:57:02 »

Only vanilla Swing looks shit. Try the Synthetica Blackeye L&F (http://www.jyloo.com/synthetica/themes/)

Cas Smiley

Offline pjt33
« Reply #161 - Posted 2013-11-29 14:13:13 »

Somewhere along the line I introduced a bad bug where the loaded applets are returning "null" from a getGraphics() call.  I'm assuming I'm just not parenting it correctly.  This is part of the reason the applets weren't visible - they were crashing!
Applets which actually crash on that have bigger problems, because (in at least some point releases of JRE 6) applets might get null from getGraphics() due to a bug in the standard applet container's lifecycle.

Conversion from the HTML non-ascii characters and the Java string isn't working right - you'll notice some of the names aren't showing up right.
That's a years-old problem with the java4k.org site.
Offline appel

JGO Wizard


Medals: 51
Projects: 4


I always win!


« Reply #162 - Posted 2013-11-30 21:27:46 »

So, what's the plan?  Grin

Open up Dec 1st (tomorrow) as is?

Applet launcher can appear on the site when it's ready. I'm going to add json services to retrieve game list and such, so it doesn't depend on some html code that could possibly change.


(New rule will be added, no more than 5 games per developer).

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 #163 - Posted 2013-12-01 02:34:35 »

sounds good to me Smiley
Offline Groboclown
« Reply #164 - Posted 2013-12-01 04:09:33 »

Open up Dec 1st (tomorrow) as is?

Applet launcher can appear on the site when it's ready. I'm going to add json services to retrieve game list and such, so it doesn't depend on some html code that could possibly change.

Sounds like a good plan.  Developers can start testing out the launcher as it updates (located here: https://pikacode.com/groboclown/java4k-launcher/file/default/java4k-launcher.zip).  Once the new forum opens, I'll start a thread there for bugs, feature requests, updates, and so on.

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 817
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #165 - Posted 2013-12-01 10:58:14 »

(New rule will be added, no more than 5 games per developer).
This would only affect zeroone... which makes me wonder... why?

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline ctomni231

JGO Wizard


Medals: 99
Projects: 1
Exp: 7 years


Not a glitch. Just have a lil' pixelexia...


« Reply #166 - Posted 2013-12-01 11:00:31 »

(New rule will be added, no more than 5 games per developer).
This would only affect zeroone... which makes me wonder... why?

It might also be a shot against Apo... I double that notion, why?

Offline appel

JGO Wizard


Medals: 51
Projects: 4


I always win!


« Reply #167 - Posted 2013-12-01 17:37:11 »

It's not meant to target anyone.

I just find it peculiar when 25-35% of the games in the contest is from the same person.

The goal is not to churn out as many games as possible.

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 #168 - Posted 2013-12-01 17:55:22 »

We could make it 10 games  Roll Eyes


Ok, the contest is open! Riven will hopefully add a new contest forum.

Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
Offline zeroone
« Reply #169 - Posted 2013-12-01 18:06:57 »

(New rule will be added, no more than 5 games per developer).
This would only affect zeroone... which makes me wonder... why?

Time is a limited resource and there are plenty of things to explore out there.  A cap on the number of entries is fine with me Smiley
Offline Varkas
« Reply #170 - Posted 2013-12-02 15:05:38 »

I find the 4k contest is a lot akin to the the demoscene subculture. By us - for us kind of thing. Showing off what kind of neat tricks you can pull off with only 4k.

That's been my thoughts too. The java way of demo witchery. I once considered to join the 4k contest, but had to realize that it requires very specific skills and methods to produce such compact code which still does something sensible, and I don't have those - and I wasn't willing to sacrifice my coding habits just to squeeze some function into 4k bytecode.

So for me it already was a pretty closed contest for those who are like the old assembly wizards from the demo scene who made other people just "wow - I had no idea that this can even be done".

if (error) throw new Brick(); // Blog (german): http://gedankenweber.wordpress.com
Offline teletubo
« League of Dukes »

JGO Ninja


Medals: 48
Projects: 4
Exp: 8 years



« Reply #171 - Posted 2013-12-02 15:08:54 »

I find the 4k contest is a lot akin to the the demoscene subculture. By us - for us kind of thing. Showing off what kind of neat tricks you can pull off with only 4k.

That's been my thoughts too. The java way of demo witchery. I once considered to join the 4k contest, but had to realize that it requires very specific skills and methods to produce such compact code which still does something sensible, and I don't have those - and I wasn't willing to sacrifice my coding habits just to squeeze some function into 4k bytecode.

So for me it already was a pretty closed contest for those who are like the old assembly wizards from the demo scene who made other people just "wow - I had no idea that this can even be done".


This is what I thought the past few years and I never joined the competition because of that. But last year I tried, and with the toolset you can use (obfuscator, proguard, shrinker) you don't need to ruin your code to fit everything. My games even had 3 or 4 classes, not just 1 like people normally do.
It is perfectly doable, just give it a try.

Offline xsvenson
« Reply #172 - Posted 2013-12-02 15:37:42 »

I have not participated in this contest and I also feel, it's not for me.
But I am glad that this thread took a positive direction and I wish You all the best.
The launcher is nice, keep it up.

“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Offline Sunsword

Junior Duke


Medals: 3



« Reply #173 - Posted 2013-12-02 16:06:04 »

I once considered to join the 4k contest, but had to realize that it requires very specific skills and methods to produce such compact code which still does something sensible, and I don't have those - and I wasn't willing to sacrifice my coding habits just to squeeze some function into 4k bytecode.

So for me it already was a pretty closed contest for those who are like the old assembly wizards from the demo scene who made other people just "wow - I had no idea that this can even be done".

That issue gets raised a lot, but a while back Groboclown put together a good set of ANT scripts that you can use (quoted post below.)  I don't know how much it has changed in the past two years, but when I used it it all I had to do was put in the paths to some tools I downloaded like proguard and kzip, and then I just used Eclipse to run the script.  Doesn't get much easier than 1-click compression!

If you look at the source for many of the games on java4k.com, the fully commented well-laid out code is what was fed in to the ANT scripts, and they spit out an obfuscated, maximum compression 4k jar at the other end. Smiley  My two games had a main game loop, but separate methods for drawing the splash screen, handling menu actions, drawing sprites, and loading and playing music.  There's a bit of trade-off between OO design and minimized byte code, for example my use of a method to draw sprites instead of delegating that to a separate Sprite object that decides how to draw itself.  Along with that decision, I used 2d int arrays to keep track of my sprites and their attributes, rather than introduce another object definition.  But you can do things like define as many constants as you want (to avoid remembering the purpose of a magic number), since proguard will replace them with the values in your code.

Groboclown put together a great set of ANT scripts two years ago.  It's what I used for the 2012 competition.  It does proguard, packing, gzip, etc, even with different block sizes.  I think I had to get proguard and a 7zip separately and configure the script with their locations, but having that toolkit does lower the entry bar significantly.
Thanks for the reference.  I'm now maintaining this over in my sourceforge project: http://sourceforge.net/p/groboutils/java4k/ci/default/tree/
Offline moogie

JGO Knight


Medals: 13
Projects: 6
Exp: 10 years


Java games rock!


« Reply #174 - Posted 2013-12-02 21:02:09 »

Perhaps special recognition award for the best "new comer" entry would help include those who are not considering entering being intimidated by the fantastic entries of the old hands?
Offline SimonH
« Reply #175 - Posted 2013-12-03 00:27:58 »

OK, sorry I've been a bit stressy about this launcher business but I'm pretty much1 won round now.

Perhaps special recognition award for the best "new comer" entry would help include those who are not considering entering being intimidated by the fantastic entries of the old hands?
Superb2 idea! A 'Best Newcomer' category would be an excellent addition to the contest.

1Nothing to do with one of my games being used for the demo - honest!
2On the J4K website news the word 'superb' has been typoed to 'supberb' - just saying...


People make games and games make people
Offline appel

JGO Wizard


Medals: 51
Projects: 4


I always win!


« Reply #176 - Posted 2013-12-03 00:32:03 »

I have a long holiday coming up in a few days, I'll put some work into the site and try to modernize things a little.

Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
Pages: 1 ... 4 5 [6]
  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.

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

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

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

lcass (38 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (68 views)
2014-10-14 00:35:47

TehJavaDev (60 views)
2014-10-14 00:32:37

BurntPizza (73 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45

BurntPizza (86 views)
2014-10-11 22:30:10
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!