Author Topic: Java map viewer applet  (Read 32049 times)

0 Members and 1 Guest are viewing this topic.

Offline Maxim

  • Hero Member
  • *****
  • Posts: 974
Java map viewer applet
« on: September 03, 2007, 04:14:17 pm »
Here are some test maps. Page weights are about 10% of the PNG file size for large images, and browser memory usage will be vastly less, even with the Java runtime overhead.



Castlevania-CircleOfTheMoon-Castle.png 16.1MB -> 1.2MB

http://www.smspower.org/maxim/forumstuff/maptest/cv.html



EarthBoundZero(J)-World.png 4.1MB -> 169KB

http://www.smspower.org/maxim/forumstuff/maptest/earthbound.html



soniccd11apalmtreepanicwo6.png 350KB -> 109KB

http://www.smspower.org/maxim/forumstuff/maptest/scd.html



I still want to:



- add the ability to save as PNG? Or maybe as an "executable" JAR? Both will require either server-side help or for people to accept a dodgy signed applet...

- alternative browsing methods: eg. for Enduro Racer's diagonal maps

- keyboard control

- middle-mouse-click scrolling

- maybe some branding/credit overlay?

- sometimes you get multiple images when zooming out



The Castlevania one is coming out as using more than 20000 tiles which seems wrong, but I think it may be due to the large annotations/branding in the image which has low tile-based redundancy.



Feedback is very welcome.

Offline Grizzly

  • Full Member
  • ***
  • Posts: 189
RE: Java map viewer applet
« Reply #1 on: September 03, 2007, 06:35:45 pm »
That's very nice. Also the amount of extra compression due to that tile based compression is impressive. When you add a zoom option (to zoom out, and in) and a save as PNG option, that maybe would be a nice possibility to save downloading times and lower server usage.

The FIFA map doesn't work for me, though.



I really need to learn how to manipulate images in Java, too. Which classes do you use for loading an image and splitting it into pieces etc?

Offline Maxim

  • Hero Member
  • *****
  • Posts: 974
RE: Java map viewer applet
« Reply #2 on: September 04, 2007, 12:12:41 am »
Image. I'll post source soon, it's actually incredibly simple. I use a modified Tile Slicer to produce the input data.

Offline DarkWolf

  • Hero Member
  • *****
  • Posts: 640
RE: Java map viewer applet
« Reply #3 on: September 04, 2007, 08:03:37 am »
Are you buffering the output?  That should solve the flicker, I would think.  Although, I've never done java.

Offline Revned

  • Hero Member
  • *****
  • Posts: 1094
RE: Java map viewer applet
« Reply #4 on: September 04, 2007, 09:12:18 am »
The reason Castlevania came out as so many tiles is probably because it isn't aligned to the tile grid.

Offline Maxim

  • Hero Member
  • *****
  • Posts: 974
RE: Java map viewer applet
« Reply #5 on: September 04, 2007, 02:13:02 pm »
I switched from AWT to Swing for the GUI and got free double-buffering - I was doing it by hand before and there's a limit to how much you can do. It still flickers like hell when resizing the window.



The Castlevania map looked pretty well aligned to me. http://www.smspower.org/maxim/forumstuff/maptest/cv.png if you can open a 16x368848 PNG...

Offline Maxim

  • Hero Member
  • *****
  • Posts: 974
RE: Java map viewer applet
« Reply #6 on: September 05, 2007, 01:49:09 am »
I added mouse dragging and some preliminary (ugly) zoom support.

Offline DarkWolf

  • Hero Member
  • *****
  • Posts: 640
RE: Java map viewer applet
« Reply #7 on: September 05, 2007, 05:00:18 am »
The Sonic CD special stages I did had both flipped and rotated tiles.  If it is too much trouble to implement all the combinations, I think the flipped would be the most effective though.

Offline Maxim

  • Hero Member
  • *****
  • Posts: 974
RE: Java map viewer applet
« Reply #8 on: September 06, 2007, 01:24:45 am »
I implemented most of it, and I'm finding very little rotation (didn't try Sonic CD yet). Officially, the Mega Drive graphics chip doesn't support it, I don't know what the Mega CD adds to the mix.



I also added the feature to (sort of) merge tile sets between maps. The result is that you can have one set of tiles fueling multiple maps for a more optimal experience. I'm finding sprites cause a lot of tile duplication though, but I don't want to make the source data more complicated than a single image.

Offline DarkWolf

  • Hero Member
  • *****
  • Posts: 640
RE: Java map viewer applet
« Reply #9 on: September 06, 2007, 06:44:47 am »
Sprites certainly complicate things.  The ultimate format would be one that would allow you to store tiles/backgrounds and sprites separately.  Unfortunately you'd have to create the image in that  format in the first place.

Offline Maxim

  • Hero Member
  • *****
  • Posts: 974
RE: Java map viewer applet
« Reply #10 on: September 07, 2007, 12:45:25 am »
Exactly. This is trying to be something that you feed a map and it spits out something hugely smaller.

Offline Maxim

  • Hero Member
  • *****
  • Posts: 974
RE: Java map viewer applet
« Reply #11 on: September 08, 2007, 01:35:00 pm »
Updated the first post. Here's some source, if anyone's interested:



http://www.smspower.org/maxim/forumstuff/maptest/src.zip

Offline TerraEsperZ

  • Hero Member
  • *****
  • Posts: 2326
RE: Java map viewer applet
« Reply #12 on: September 09, 2007, 12:16:19 pm »
Such an ultimate format would pretty much be impossible to do. It would most likely be easier and take less space to create a program that would output the map straight from the rom using the correct tiles, palettes and whatever internal transformations needed and then add all the sprites wanted.



I remember reading about a guy who was trying to do something similar but for a video format for NES games that would thus have perfect image clarity and would require a much smaller bit rate than most existing video format.



---

"With the first link, the chain is forged. The first speech censored, the first thought forbidden, the first freedom denied, chains us all irrevocably." [...] The first time any man's freedom is trodden on, we're all damaged. - Captain Jean-Luc Picard



B*tch, meet reality. Reality, meet b*tch. - Me
Current project:
Mega Man: Powered Up (PSP)