Applet reintroduced!

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
This was a beast, yet in the very end turned out to be so few modifications it isn't even funny thinking about how long it took me to figure out :?

In short: Took "allow duplicates" off the jar building, made temp internal versions of a couple Groovy files, signed the jar, and hooked it into the LWJGL applet template...

Longer version: Went through half a dozen different ways to run the applet, so much keystore mumbo jumbo, happy fun time with the classpath, weirdo policy files for specific permissions (which turned out to be completely unnecessary, I just wasn't signing the jar right), and so much other stuff I'm quickly forgetting and / or repressing

There are bugs and quirks to go through still - mainly because the branch is so busted, but I also hit a weird momentary lockup when running via Firefox each time a Gelatinous Cube spawned. So testing needed at some point too. Near 1 am again so going to sleep before round two. Round three is integrating it with the website after merging the code back in properly so the applet actually has any recent features ;)

Still very happy as this has been on my mind too long, blocking far more interesting stuff :geek:

GitHub: https://github.com/Nanoware/Blockmania/ ... 58936b835c
Demo: http://nanoware.org/applet/

To build the applet locally (the top level applet dir is source stuff only) run gant buildApplet or gant buildAll then look in out/applet

Which, oh yeah, reminds me of the other issues - haven't sorted out IntelliJ setup to get Gant working internally, and it was a while ago I attempted to run the Applet directly from there. And we now have LWJGL jars in two places that differ, so maybe we can smooth that over sometime. More stuff coming...
 

metouto

Active Member
Contributor
Art
...... Demo: http://nanoware.org/applet/........

That demo worked really nicely for me Cervator ..... had the loading bar so you knew that something was going on and you used the "Q" key to remove blocks ... same keys to move .... :D ... it was nice to explore the world again
 

begla

Project Founder and Lead Developer
Contributor
Architecture
Logistics
Looks good! With a little bit more work we'll have a working applet for the latest in place again. But now you know exactly why I completely removed the applet for the time being... :twisted:
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Yeah that was a pain :D

But with it fully automated and checked in now I think we can keep it running with minimal effort. I've got a few items in mind for optimizing the structure but that's the sort of thing I can bundle into issues to tempt other contributors into playing with - which reminds me that I should really get around to getting all the issues out of my head and into the issue tracker :D

How do you like the Gant setup?
 

begla

Project Founder and Lead Developer
Contributor
Architecture
Logistics
Cervator said:
How do you like the Gant setup?
Looks good and straightforward! To be honest... I've never liked the plain Ant setup in the first place. :shock:
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
New and old code have been merged together! Applet now works with the latest features :)

I updated the demo at http://nanoware.org/applet

Something changed slightly, not sure if it is specific to my system, but if I load it in Firefox the window goes poof right around the time when the game is supposed to do its final load. Works OK launched from the jar, or as an applet in IE for me (or Chrome for Stuart). So there are some inconsistent run issues - please let me know who can get it to work how and if you can dig any logging out of no-worky situations! Which is going to be another todo item, as while the Java Console will get you normal logging, this abnormal termination closes the log window before I get a chance to see what is killing it :p

I also made a doc page on the topic in the wiki: http://wiki.movingblocks.net/Main/AppletArchitecture

Another outstanding issue is that under some circumstances (or all?) the applet briefly locks up as a Gelatinous Cube spawns. Not sure what's up with that, but at least it is specific, so we can probably figure it out. With a little more polish we can hook the applet Gant built up to Jenkins and have it auto-deploy to a page on the Blog.
 

begla

Project Founder and Lead Developer
Contributor
Architecture
Logistics
Nice. It does not work using Mac OS X Lion and Safari though. Will look into this next weekend when I actually have some time to twiddle around again. :)
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Yeah, not surprised, it seems pretty sketchy at the moment. I'd debug, but the main crash error goes poof so fast with so awkward logging I can't catch the error! Blah :)
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Figured out the stalling bug while running as an applet and a Gelatinous Cube spawns :)

Every new GelCube went up the class tree in the constructor and loaded the footsteps audio anew - which in an application probably isn't noticable, but in an applet (or a jar? Didn't check that) the resource loading happens with noticeable delay

Fixed it temporarily by disabling footsteps for GelCubes - https://github.com/MovingBlocks/Terasol ... 482bc7c696

I was wondering if that would at all help the odd "stuck on 99.97%" issue or not working in FF, but no dice (99.97% does seem to potentially relate to whether the window is disturbed?). As the commit suggests we probably need an audio cache of some sort to share the same loaded resources rather than reload blindly every time? Which might be out of scope for a while - but at least this way we could have the applet more presentable, which suits my nefarious plans :D
 

woodspeople

Member
Contributor
Design
Tried the applet in Firefox on Mac and it worked! But so super slow as to be unusable. :( Still beautiful though
 

Immortius

Lead Software Architect
Contributor
Architecture
GUI
The logs I'm getting from running the applet in Firefox suggests something screwy with where saved worlds are being placed:

<message>Saving merged Block texture file to C:\Windows\system32\SAVED_WORLDS\ImageManifest.png
<message>java.io.FileNotFoundException: SAVED_WORLDS\ImageManifest.png (The system cannot find the path specified)

...

Why is it trying to save to system32?
 

begla

Project Founder and Lead Developer
Contributor
Architecture
Logistics
:laugh: Cerv you've created evil malware! Good catch though – I'm sure he'll look into this soon. I have not looked through the new applet code yet.
 

metouto

Active Member
Contributor
Art
I am thinking that you are talking about the starting up of the game in the web browser .... so Google Chrome w/windowns 7 is working good ... ;)
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Immortius said:
<message>Saving merged Block texture file to C:\Windows\system32\SAVED_WORLDS\ImageManifest.png
<message>java.io.FileNotFoundException: SAVED_WORLDS\ImageManifest.png (The system cannot find the path specified
Whut... sense - that makes none! :(

It is supposed to save to wherever the browser stores its applet cache, which I figured out was C:\Users\Cervator\AppData\Local\Temp\lwjglcache on my system - but never actually checked beyond seeing the applet files expanded there. Now that I check I'm not even sure where SAVED_WORLDS go - it isn't in my system32, nor the %TEMP% dir.

Oh - it is on my desktop. Why of course, I totally intended that! Yeah, uh.. yeah... I will indeed have to look into that a bit more. Maybe the directory reference to SAVED_WORLDS in code ends up getting set relative to where some involved process comes from :geek:

I didn't really expect it to become sentient quite this early... *shifty eyes*
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Bah, so very close to having this fixed. I've submitted code that happily writes to the user's temp dir now when running as an applet, yet still the expected SAVED_WORLDS in the project dir when running from IntelliJ. But after "fixing" the dir for BlockManifestor's work something still crashes and makes the Java Console disappear before I can make out the error. I've tried previously to redirect output or make the window stick around after a crash, but no luck - anybody have better luck or an idea how to do that?

For all I know it might work for somebody else, but it crashes in both Firefox and IE for me now.

https://github.com/MovingBlocks/Terasol ... d4eda242c5

I have everything nicely merged too, MB develop + Immortius Shape branch. Started using the shiny static import log thing for Groovy - had seen that before but forgotten about it, now it will be all better :)

One quirk there - why does usage of the static log thing result in two logged lines rather than just the INFO alone?

Feb 8, 2012 12:47:27 AM java_util_logging_Logger$info call
INFO: _imageManifest file: E:\Dev\GitProjects\Terasology\SAVED_WORLDS\ImageManifest.png

Alright, nearly 1 am, giving up for tonight. Gotta go to work tomorrow and all that, bah!
 

Immortius

Lead Software Architect
Contributor
Architecture
GUI
Cervator said:
But after "fixing" the dir for BlockManifestor's work something still crashes and makes the Java Console disappear before I can make out the error. I've tried previously to redirect output or make the window stick around after a crash, but no luck - anybody have better luck or an idea how to do that?
For me the logs can be found in E:\Users\Immortius\AppData\LocalLow\Sun\Java\Deployment\log after it exits.

One quirk there - why does usage of the static log thing result in two logged lines rather than just the INFO alone?
The default logging format is to log the time and the calling method on one line, with the message on the next. In groovy the calling method is apparently lost. Apparently log4j has a solution for this, not sure if the java logger does.
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
I get the Deployment/log directory too, but it only ever contains a one-line XML file - no actual useful content. Although I haven't checked after the logging changed - curious to see how that logging quirk itself can be fixed too, but at least it still is nice and easy to use.
 

Immortius

Lead Software Architect
Contributor
Architecture
GUI
You may also need to enable logging in the java control panel. I know I changed a couple of those settings.
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Aha! That did the trick, I finally have logging :)

Originally I just enabled the console, but didn't look for logging settings in there, especially since the console itself offers assorted logging tweaks.

And interesting - hitting an array size / negative index while trying to load images from the jar. Did not see that coming - but now I can troubleshoot it! Thanks :D
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Success! Found the issue :)

https://github.com/MovingBlocks/Terasol ... 77269cdab4

The manifestor's path handling (and logging...) was always sort of sketchy and needed tidying up. In the shuffle to utility class I think that tripped a thing or two and in the end a double-slash could end up stuck in the path the image scan searched - which for some reason only caused trouble in applet-mode, where it somehow thought the nothingness between the two slashes was a valid path to search, leading to a crash due to always trying to go back one character.

The applet now plays nice and (on my system) uses C:\Users\Cervator\AppData\Local\Temp\SAVED_WORLDS rather than whatever it feels like (desktop, firefox dir, system32...). Works in both Firefox and IE and even reloads the same world between the two of them :D

I need testing! Have integrated to the main develop branch since everything looks pretty good, but still. Master branch might be next, need to review if there's anything else really left in milestone 1.

http://nanoware.org/applet (also need to put it back on the official site and so on)

Also, I tried to sort out two persistent changes that keep wanting to get into Git - one is the toggling "logs" / "LOGS" thing for excluded dirs (I tried to make it lower-case everywhere) and another is this .idea/misc.xml snippet that just won't leave me alone - can't find where to change it in IntelliJ. Please do take it back out of it matters :)

Code:
  <component name="DependencyValidationManager">
    <option name="SKIP_IMPORT_STATEMENTS" value="false" />
  </component>
Edit: Okay, so I missed a couple commits from develop and had to resolve a few minor conflicts. WorldProvider became IWorldProvider, MovableEntity had differing changes on sequential lines (not a real conflict), and the Project SDK being set to 1.7 (which I don't have on my box) caused compilation here to not be able to find Groovy classes for some reason. Put that back to 1.6 for now.
 
Top