And the first problem appears: it seems to generate the same sequence of caves each time. How does one seed the random number generator randomly in GIMP?
Edit: Fixed.
Here's a random cave generator I just wrote with GIMP's script-fu; it's basically a reimplementation of my online cave generator, except instead of using the old-school TSR blue style with a grid, this was designed to be used with RobA's subterranean map prettier script.
This is only my second attempt at GIMP scripting, and it's only the first draft, so no doubt I've done something stupid somewhere; advice from more experienced scripters is welcome (is there really no floating-point random number generator? No pi?).
I've attached a map made with my script, followed by the result of scaling it by 200% and applying RobA's script (grid size 15, all other parameters default).
Installation and use:
Once you've installed the .scm file in your gimp scripts directory, it's accessible under Xtns / Script-Fu / Utils (if there's a more appropriate place to put it let me know, and let me know how).
Parameters: image size (the dimensions of the image in pixels), number of random walks (the caves are excavated by drunken dwarves), and length of the walks. Default values should work well enough.
The code is free -- do with it what you will.
I hope you enjoy it, and feedback is always welcome.
Updated: Version 0.3.1 - fixed error with grid toggle
Last edited by isomage; 12-11-2008 at 04:02 PM. Reason: New version
My random map generators and GIMP scripts: http://axiscity.hexamon.net/users/isomage/
And the first problem appears: it seems to generate the same sequence of caves each time. How does one seed the random number generator randomly in GIMP?
Edit: Fixed.
Last edited by isomage; 12-09-2008 at 02:27 PM.
My random map generators and GIMP scripts: http://axiscity.hexamon.net/users/isomage/
Hmm sry isomage, I've got some troubles reading script-fu, which makes troubleshooting tough for me. If you give me a python code I'll help ya.
My Map Challenge Entries
I use GIMP for all my maps.
GIMP scripts and plug-ins overview
Everything I post on this site uses the Creative Common Attribution-Noncommercial-Share Alike license. Only exception to this are any pyhton scripts which use the GPL.
If you are using any of my posted stuff just use your rep stick on me
Should you be interested in using anything I posted on commercial purpose drop me a pm.
Here's another example, this from version 0.1.2 (with improved path rendering to reduce square features), again rendered with RobA's script.
Last edited by isomage; 12-09-2008 at 10:24 PM.
My random map generators and GIMP scripts: http://axiscity.hexamon.net/users/isomage/
yummy.
I will have to take a look at your code!
-Rob A>
My tutorials: Using GIMP to Create an Artistic Regional Map ~ All My Tutorials
My GIMP Scripts: Rotating Brush ~ Gradient from Image ~ Mosaic Tile Helper ~ Random Density Map ~ Subterranean Map Prettier ~ Tapered Stroke Path ~ Random Rotate Floating Layer ~ Batch Image to Pattern ~ Better Seamless Tiles ~ Tile Shuffle ~ Scale Pattern ~ Grid of Guides ~ Fractalize path ~ Label Points
My Maps: Finished Maps ~ Challenge Entries ~ My Portfolio: www.cartocopia.com
Cool stuff Isomage!
My Finished Maps | My Challenge Maps | Still poking around occasionally...
Unless otherwise stated by me in the post, all work is licensed under a Creative Commons Attribution-Noncommercial 3.0 United States License.
Makes me want to learn how to GIMP.
If the radiance of a thousand suns was to burst at once into the sky, that would be like the splendor of the Mighty One...I am become Death, the Shatterer of worlds.
-J. Robert Oppenheimer (father of the atom bomb) alluding to The Bhagavad Gita (Chapter 11, Verse 32)
My Maps ~ My Brushes ~ My Tutorials ~ My Challenge Maps
Well, your scheme coding skills are waaay better than mine... I'm assuming you actually know scheme!
The only thing I don't get is what this bit a the end is for:
I think the same could be done with a simple erode and invert.Code:; Magic! (gimp-invert layer) (plug-in-sobel RUN-NONINTERACTIVE image layer 1 1 1) (gimp-invert layer) (let ((select-point (screen-coordinates '(0 0)))) (gimp-fuzzy-select layer (car select-point) (cadr select-point) 1 CHANNEL-OP-ADD TRUE FALSE 0 FALSE)) (gimp-selection-invert image) (gimp-edit-bucket-fill layer FG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0) (gimp-selection-none image)
One other suggestion would be to have the user specify the brush size rather than using the 12 px brush.... You'd also have to space the random walk step size proportionately, of course.
The code to programmaticly define a hard edged brush is:
and then destroy after use by:Code:;Set up Brush (set! brushTemp (car (gimp-brush-new "MyBrush"))) (gimp-brush-set-shape brushTemp BRUSH-GENERATED-CIRCLE) (gimp-brush-set-hardness brushTemp 1) (gimp-brush-set-radius brushTemp varRadius) (gimp-brush-set-spacing brushTemp varSpacing) (gimp-brush-set-spikes brushTemp 2) (gimp-brush-set-aspect-ratio brushTemp 1) (gimp-brush-set-angle brushTemp 0) (gimp-context-set-brush brushTemp)
(Of course this would also let you vary the brush size in a random walk itself! just call the gimp-brush-set-radius whenever)Code:(gimp-brush-delete brushTemp)
-Rob A>
My tutorials: Using GIMP to Create an Artistic Regional Map ~ All My Tutorials
My GIMP Scripts: Rotating Brush ~ Gradient from Image ~ Mosaic Tile Helper ~ Random Density Map ~ Subterranean Map Prettier ~ Tapered Stroke Path ~ Random Rotate Floating Layer ~ Batch Image to Pattern ~ Better Seamless Tiles ~ Tile Shuffle ~ Scale Pattern ~ Grid of Guides ~ Fractalize path ~ Label Points
My Maps: Finished Maps ~ Challenge Entries ~ My Portfolio: www.cartocopia.com
I like Lisp, and Scheme's just a dialect -- they have a lot in common.
Ah, you're right -- that stuff follows the process I used to use when I first started playing with this sort of thing, and it's basically redundant now. I've replaced it with an erode. ThanksThe only thing I don't get is what this bit a the end is for:
...
I think the same could be done with a simple erode and invert.
I've been thinking about that; it'll probably make it into a future version.One other suggestion would be to have the user specify the brush size
That's definitely worth investigating.Of course this would also let you vary the brush size in a random walk itself!
Thanks for the advice; I've updated the zip file in the first post to remove that redundant code.
Last edited by isomage; 12-10-2008 at 11:07 PM.
My random map generators and GIMP scripts: http://axiscity.hexamon.net/users/isomage/
Added color, brush sizing, optional grid. Default settings will still work as input for RobA's script, but it can now make blue, gridded TSR-style maps as well.
Last edited by isomage; 12-11-2008 at 07:29 AM.
My random map generators and GIMP scripts: http://axiscity.hexamon.net/users/isomage/