![]() |
JAVA programmer? (and Win-DomMap, and some GIMP)
This site has a blur class, and a map render program. It would be great if someone could look at it and see if it will fill our needs to map-making
http://www.jhlabs.com/index.html Can the blur run stand-alone? Batch mode? on linux? process targa files? be told to not blur white pixels (255/255/255)? be told 3 colors to avoid? [ February 24, 2004, 19:33: Message edited by: Gandalf Parker ] |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
This filter won't run on itself. It's a class that can be used in conjunction with the Java Advanced Imaging API (JAI). It would be quite easy to implement a filter that does the thing's you mentioned though. But it only works with BMP, GIF (decoder only), FlashPix (decoder only), JPEG, PNG, PNM, TIFF, and WBMP.
For running java programs you need to have at least the JRE installed. Set some enviroment variables and you can (almost) use it like a native executable. |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
Examples of the maps Im working with are at http://www.techno-mage.com/~dominion...s2/RandomMaps/ And you can email me as gandalf@ that site or community.net (or a dozen others) http://forum.shrapnelgames.com/images/icons/icon7.gif |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Before I spend my day working on Java (again) may I suggest something else? Try ImageMagick. It might be just what you are looking for. If you're running Linux it's probably already installed... I'm not very experienced in using it but it is *very* powerful. I use it for on the fly generation of thumbnails on my webserver.
I browsed the Online docu and there is a blur filter and an option to select a specific set of colors. I haven't tried it but it seems like this should work. |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
If you can point me to a site that explains the PNM format and a sample image, I can give it a go.
|
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
The JPG exists for web viewing and so that WebMagick can make thumbnails (which does use imagemagick to do it). I did see that ImageMagick had a blur switch but didnt see where I could hold 255/255/255 white aside. Maybe something where I could copy the white pixels to another file then merge it back after the blur? Of course these are also all work-arounds for the old DomMap program which is in C source code if anyone is interested. [ January 31, 2004, 17:22: Message edited by: Gandalf Parker ] |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
If I'm correct you can use the map switch. Give it a color map file to select specific colors (I'm totally clueless about the file format though). Pass that output to the matte channel. You might have to create a temp file for that.
In the docs there's an example about using a matte channel to filter only certain areas of the image. |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
Please send me the source code when you get a chance. I'd like to take a look at it. I'm a bit late to this party. Why are we looking for a blur filter? gladestrider |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
PhilD is managing the source code now. The Last batch of changes were his. He has pretty much gotten it to create maps which will work for Dom2. His Version is Linux only and there are people who would love to get just a working Windows compile made available.
The blur story is this. Dom1 had a very restricted use of color. The maps made for Dom2 have a much greater range of allowance. There are alot of possible ways to go as far as making the random maps look much better. But the EASIEST thing Ive found is a blur. In a few steps, using GIMP, I can layer the white capital dots, layer the blue borders in water provinces, layer the brown color used for land borders, blur the rest and then save. I can provide links of the before and after if you wish. With DomMap I can generate 100 maps a day and make them available on my web site. But they are ugly. Ive tried to find a way to automate blurring them while not touching 3 colors (or even 1, the 255/255/255 white capitals). But a better answer would be the fact that DomMap has all that info in an array at one point. There are alot of ways to go. Blur then insert the capital pixels to the file would be one. Id also be interested in whether the C code actually generates a more extensive fractal map then "dumbs it down" to the old Dom1 map format. Such as... does it squeeze everything between height 100-150 into the green tree color because the old Dom1 limited the map to a total of 16 colors? Letting it assign each level to a slight color change could result in a great map. |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Found PhilD's link to the newer DomMap code.
http://duchon.philippe.free.fr/dom2/index.html |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
(more truthfully: I don't know what it would take to get it to compile on non-linux machines; it's most likely very little) Quote:
I can easily change it so it outputs more or less the whole range (of one map), or something like that: it's a very minor change. Or to output the province borders and capitals to a different .tga file, if you want to do some automated image treatment. Not that big a deal (will use more memory, though). |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
I've already mentioned to Gandalf that I'll be looking at porting it to Windows later this week. I grabbed the code earlier tonight. The compiler I'll be using, BTW, is MSVC++ 6.0 Pro.
In case anyone's curious, I'm not a newbie C++ programmer. I cut my teeth in C/C++ on AT&T UNIX systems back in '88. Used Borland compilers (I was one of their beta testers) from '90-'97, and have used MS stuff since then (have to for my employers). EDIT: oh, and in regards to the thread's title, I also program in Java. http://forum.shrapnelgames.com/images/icons/icon12.gif [ February 24, 2004, 06:47: Message edited by: Arryn ] |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
I eat toast.
Just in case that is a requirement. |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Its a race. So far I think 3 people have offered to take a stab at a Windows compile.
PhilD: do you want to host the Win Version also. Im thinking its basically your puppy for control purposes. Or at least you get first shot at it if you want it. On the other notes, YES those would be great. Doing the 2 tga might make the blur project work. And Id love to see what we get if each level/richness variation is given a slightly different color. The blur project might not be needed at all. With some tweaking we might get it to smoothly transition appropiately. Maybe even knock the GIMP project out of the running if we can get it close to this.... http://www.techno-mage.com/~dominion...s/rendered.jpg |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
|
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
Next, select by colour to select the borders and capital-dots on the original map and cut these parts away from the copy. Delete the plasma map.) |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
Next, select by colour to select the borders and capital-dots on the original map and cut these parts away from the copy. Delete the plasma map.) </font><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">WOw I didnt follow that at all. There are some GIMP threads here that you might want to look at. Click on "search" in the upper right of this forum. I think GIMP in the titles of the threads will get you a short list. I have a few steps that will do it in GIMP quite nicely. And one of the people here even made a scheme script-fu of it for me. But I still havent gotten it to work in a batch mode which is what Im really wanting. If anyone is REALLY into GIMP Id rather see someone tackle the map generators that are in gimp already. |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
[quote]Originally posted by Gandalf Parker:
Its a race. So far I think 3 people have offered to take a stab at a Windows compile. PhilD: do you want to host the Win Version also. Im thinking its basically your puppy for control purposes. Or at least you get first shot at it if you want it. I'd rather not have executables on my "site", though I'll gladly link to them. If I understand Leif's comment, it's a very minor change I need to make so it becomes Windows-compatible (provided one knows how to compile). Actually, there are a few tweaks I'd like to try, and minor features I'd like to add, if I can find the time (who am I kidding? I'm on vacation this week, so I have to choose between PLAYING this game and PROGRAMMING this stupid generator...) Quote:
(and the picture you linked is nice, but hard on the eyes - it looks like my brand-new 19" LCD monitor is all blurry... http://forum.shrapnelgames.com/images/icons/icon9.gif ) |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
|
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Well, as Leif_- stated, it didn't seem too hard to get compiled. There were a few quirks, but nothing drastic. It seems like it's working fine, but then I've no .tga viewer on this machine, so I'm taking on faith that it functions properly. Anyway, if anyone wants to grab it, it is for the moment at:
http://gozips.uakron.edu/~emil/dommap.zip A sample output is at: http://gozips.uakron.edu/~emil/dommap.zip The program is of course provided as-is, no guarentees, use at your own risk, blah, blah, blah. If it's not working, let me know, and I'll try to fix it (within my capabilities). And I'd appreciate if, should it prove to be correct and of use, for someone to find it a more permanent home than where it currently resides... |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
[Edit: And per Leif_-'s suggestion, I changed the fopen().] [ February 24, 2004, 19:10: Message edited by: E. Albright ] |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
Next, select by colour to select the borders and capital-dots on the original map and cut these parts away from the copy. Delete the plasma map.) </font><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">OK, so now we have someone who really knows what he's talking about... cool http://forum.shrapnelgames.com/images/icons/icon7.gif I tried to do what you said: if you check the "compensate darkening" on the bump-mapping filter, it looks nice... only, now the sea's all bumpy. I thought I'd select capital dots, plus borders, plus the sea, and invert the selection before blurring and bump-mapping, but then, the problem seems to be that colors from the unselected part still blur (which means the area around capital dots will be lighter); and, if I cut this part away, it will either blur to background, or blur to transparent if I make the background transparent. I don't know if all this is clear... OK, now here's what I get, starting with a dommap output with default settings except a 500x500 size... Original dommap output (JPG Version) Same map after blurring and bump-mapping (JPG Version) What do you all think? (The .map file, in case you like it) |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
[Edit: And per Leif_-'s suggestion, I changed the fopen().] </font><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">OK; when someone can confirm that it runs fine, and produces viewable output, could you email me the source at: duchon (dot) philippe (at) free (dot) fr (I'd like to reconcile the Versions, as much as possible, in case I decide to tweak features...) |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
[Edit: And per Leif_-'s suggestion, I changed the fopen().] </font><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">OK I have Win compiled copies from both you and Leif. They both seem to work but have one strange quirk. Little loops of water border create un-capitaled water provinces. Not a big problem since the windows Version was mostly desired by people who wanted to edit the maps in paint programs anyway. |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
[Edit: And per Leif_-'s suggestion, I changed the fopen().] </font><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">The variable "near" is also a (obsolete) reserved word and I had to change that (to "nearby" http://forum.shrapnelgames.com/images/icons/tongue.gif ). The only thing blocking my compile at present is a missing def for "M_PI". Of course, I presume this is related to the value of Pi, but I don't know what the "M" is supposed to imply. Once I have the console port in Windows compiled and working okay, then I can begin the "fun" task of rebuilding the app as a native Windows MFC app, with GUI and all the other niceties. Well, that's the plan, FWIW. |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
OK that makes 3 in the running. http://forum.shrapnelgames.com/images/icons/icon7.gif
Anyone feel like "Source Forge"ing this project? http://forum.shrapnelgames.com/images/icons/shock.gif |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
But I suspect this is farther away from being batch-useable than blur is. Im sure ImageMagick commands can do what I want. I just dont understand enough about masks and such. [ February 24, 2004, 19:39: Message edited by: Gandalf Parker ] |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
M_PI is normally the value of PI from math.h or a subinclude. For instance, on a Linux box I've nearby, /usr/include/math.h contains
# define M_PI 3.14159265358979323846 /* pi */ (in a block of defines surrounded by an #ifdef relating to BSD). |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
I've gotten the code to compile and produce a map & tga. You can get the v1.94a console .exe w/ sample output from my site. If no one finds any other problems (besides the odd water loops that happen with my compile also), then I can begin the conVersion into a real Windows app. That is, assuming anyone is interested in the fancy Windows trappings (GUI, etc.) ... [ February 24, 2004, 20:00: Message edited by: Arryn ] |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Not to curb your enthusiasm but so far what we have managed to do is get the DomMap from Dominions 1 to work for Dom2. There is a wish-list for this program. Many things that could be upgraded. If we wander into two code-sets it will be hard to keep up. Your choice of course.
There are also other 3rd party program requests where window-dressing (pun intended) is what is being asked for. |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
Second, and more pointedly, if I apply "window-dressing" to the app, it will be a major (ie: almost complete) rewrite of the code, not just a recompile. This will render moot any source control between a Windows GUI Version and a linux console Version. The ideal option, of course, is to do any GUI in Java, which, if done properly, will run on all platforms. Doing it in Java will take me longer as the code not only has to be translated from C, but I'm not as swift a Java coder as I am a C coder. BTW, I haven't been doing this out of any interest I have in the app (I don't plan to use it myself), but just because a need for a Windows Version was expressed. So just point me in the direction you want me to go. Quote:
[ February 24, 2004, 21:54: Message edited by: Arryn ] |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
It _almost_ works in batch mode (with the command-line gimp -b '(selective_blur_batch "/complete/path/to/file/random.tga")(gimp-quit 0)'), but for some reason the gimp-by-color-select calls refuses to work unless there's an open display. I did a quick google on the problem, and it seems other people _are_ able to use the gimp-by-color-select calls in batch mode, so it might perhaps be related to the Version of Gimp I'm using (1.2.3) |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Hmmm the dommap has kindof a UI called run_dommap.sh which I tried to convert to a batch file. Didnt really come out good. All it does is give an easy semi-documented way to edit the many parameters of DomMap and run them with your favorite settings over and over. Doing a GUI front-end to DomMap would probably be a great thing.
On my linux system I made a front-end for me to play with which ran batches of maps thru DomMap while randomizing many of the parameters (within reasonable boundarys) so that I could view the results of 30, 50, 100 at a time. It gave me a feel for the settings I prefered. I can provide the code if you promise not to laught at it (its in Basic) You could probably do something with those two. A front end that offered help on the variables, let you set them, save them, randomize them, and run a batch for viewing. I started a list of desired 3rd party apps but it got kindof long. I thought maybe I had better make it another thread. |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
|
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Hi all,
I also have compiled a working windows Version of the DomMap generator. I have also started work on afront end to allow variable changing etc. I am new to the forum and see that Arryn has also started work on a front end. Let me know if you need any help. I'll keep working on mine just in case you don't get any time to finish. By the way Arryn, I was finally able to view the TGA files. Thanks Mark Garnett Brisbane Australia |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
|
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
But thanks for clueing me in that there is a cross-platform compiler besides those from Borland and IBM. [ February 24, 2004, 23:53: Message edited by: Arryn ] |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
I've finally managed to get the "blur and bump-map" script to work with Gimp's batch mode - although unfortunately I had to hard-code the color values into the script. (I'm sure it's possible to send them in as parameters, but I don't know enough scheme to get it done.)
I've put the working script up at http://home.Online.no/~rmoldskr/Domi...blur-batch.scm Place it in Gimp's scripts directory (~/.gimp-1.2/scripts on unix machines) and you can run it from the command line by typing gimp-1.2 -b '(script_fu_blur_random_map_batch "./random.tga")' - Alternatively, just add this as the Last line of run_dommap.sh |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
Quote:
|
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
Unfortunately it still wont quite fill my needs because Im hard-headed and dont load GUIs on my servers. Everything I do with the maps so far uses no console display. WHen I run your new script I get much farther than before but I get this... Gtk-WARNING **: cannot open display: even though Im not asking for a displayed finish. I even deleted the display line out of the script completely and it gave me that error [ February 25, 2004, 15:21: Message edited by: Gandalf Parker ] |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
|
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
Unfortunately it still wont quite fill my needs because Im hard-headed and dont load GUIs on my servers. Everything I do with the maps so far uses no console display. WHen I run your new script I get much farther than before but I get this... Gtk-WARNING **: cannot open display: even though Im not asking for a displayed finish. I even deleted the display line out of the script completely and it gave me that error </font><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">Have you tried using the -i switch? My gimp (Version 1.2.3) says it will not cause the program to use its graphical interface. I just tried, and it seems to work (it's possible that, even when not launching an interface, gimp still requires an X server or something like that, though). |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
|
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
If I had more willpower I would reload Debian with all the GUI stuff and just force myself not to get addicted to it. But I know Id fail and lessen my abilities as a server admin. [ February 25, 2004, 16:54: Message edited by: Gandalf Parker ] |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
If I had more willpower I would reload Debian with all the GUI stuff and just force myself not to get addicted to it. But I know Id fail and lessen my abilities as a server admin. </font><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">Too bad, really. Me, I like the result, and I'll probably add a switch to dommap to launch this script on the .tga... ugly kludge, but if the maps look better... |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
|
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
The script can be found at http://home.Online.no/~rmoldskr/dominions.html and an example web-page with a handfull of generated maps on it can be found at http://home.Online.no/~rmoldskr/Domi...nion_maps.html |
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Magnificent
|
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
|
Re: JAVA programmer? (and Win-DomMap, and some GIMP)
Quote:
Would that help you? |
All times are GMT -4. The time now is 12:26 AM. |
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.