Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Gosu Exchange / hackable game editor project?
- - By sylvain303 Date 2014-02-17 17:46

Is there some source code around easily hackable for a game game editor?

What I need, is to create a visual map of point "above" a picture.
Then recording this "path" or "polygon" into my own data structure.

So I could associate this "map" to the image and perform fill / masq / collision detection, etc.

Of course, load / save, edit point add / remove / join would be very nice to have, read: not to recode.

Do you have seen this kind of tool?

like that:

Parent - - By RunnerPack Date 2014-02-18 02:30
Why not let the computer do (most of) the work? Just turn your image into a silhouette, scale it down to the resolution of your grid (or use the "Pixelate" function, if you have one), and do a threshold to get the "solid" bits where you want them. You can either use the low-resolution bitmap for collision directly, or run it through a vectorization program. In fact, you could vectorize the full-size silhouette and reduce the number of edges to something manageable.

I made an illustration:

And here is the resulting vector file (SVG).
Parent - - By sylvain303 Date 2014-02-18 05:23
Hi RunnerPack,

Yes, it's a possibility. Which tool(s) did you used?

I did some try some time ago, as I'm not well skilled in picture manipulation, it takes me longer too learn gimp and co, than hacking code…
But I can try.

Parent - - By RunnerPack Date 2014-02-18 06:02
I used PaintShop Pro 8, but Paint.NET or, like you said, The GIMP, would work if you want something free. Of course, if you want to try automating it, there's always ImageMagick. You could probably do it in Ruby with Gosu and Texplay, too.
Parent - - By sylvain303 Date 2014-02-20 07:14
Thank you RunnerPack,

I did manage to perform the shadow with The gimp. But in didn't find the svg part, yet…
How did you compute the path surrounding the pixelized shadow?

I opened the SVG you've posted and it could be a great result to achieve, thanks.

May be the good question should be:

Which library will I use to perform collision detection and or, what is its ability to open such or such path format?
or shape, using Chipmunk vocabulary for example…

We didn't answered the topic question, though: is there already some game editor project around?

Parent - - By sylvain303 Date 2014-02-21 12:31
I've found it, with Gimp:

1. Make a shadow, by selecting by color or magic tools or following a shadow tutorial on youtube
2. you should have a layer with only the shadow
3. unselect all in the shadow layer and do a filter > blur > pixelate
4. reselect the result, fill it in black, if needed
5. convert the selection to a path, excellent tutorial available too
6. in the path selector (A pane in the layer window) you can export the path it's an svg file…

Parent - By RunnerPack Date 2014-02-21 17:05
Hey, that's cool; I didn't know GIMP could export the path like that (I haven't used it much, and it was a long time ago).

I actually used a commercial program (Vector Magic) to do the conversion, but there are free alternatives. Inkscape, for example, has bitmap tracing. I don't know how it performs, but it's probably good enough for this.
Parent - By RunnerPack Date 2014-02-21 17:17
I'm glad you figured it out.

As for an "off-the-shelf" game editor that supports this, that I don't know. Frankly, if you're looking for an all-in-one solution for making games, you've come to the wrong place :p Gosu is great at what it does, but it has very specific design goals which don't generally include much "hand-holding"...

For those who don't want to engineer their own solution, there are things like Unity, Construct 2, Stencyl, and the like. One of those probably has something you can use. In fact, I wouldn't be surprised to see something that automated this entire process – just drop images into it and get usable physics "objects" out of with no work at all. It's probably going to cost you, though.
Parent - - By sylvain303 Date 2014-02-22 10:21
Thank you RunnerPack,

I followed your hints using open source software and some tutorial.
keeping this way I've a path in a SVG file that I need to load, and transform into my polygon data structure, should not be very difficult.

> As for an "off-the-shelf" game editor that supports this, that I don't know.

Sorry to have been unclear about, but I was just looking for a piece of open source Ruby code, having some basic path editing behavior.
As I have understood the library chipmunk use a concept of "shape" which is exactly that. You have to provide a path matching the sprite.

Just a bit lazy and didn't want to recode all the stuff, or see it as community participation… ;)

Parent - - By RunnerPack Date 2014-02-23 19:14
Oh, so I completely missed the point, then... Well, the only thing I have that's even remotely related is a SketchUp plugin that exports ActionScript3 (Flash) source for Box2D physics objects. I doubt if any of it would be useful in this case. I do look forward to seeing anything you end up sharing, though.
Parent - By sylvain303 Date 2014-02-24 05:16

Now that I'm playing with svg I've found that exported path from The Gimp have duplicated points…
And that modified svg from Inkscape have relatives coordinates…

I didn't find an SVG parser library yet. One which seems to extract the path nicely… There's some  chunk of code on github, though:  a bit old, very limited parser can't read path from Gimp because of XPATH expression limited to Inkscape,  use hpricot (deprecated) not tested yet, more complete, more recent lib many be some hint or lib here SVG Path specification and lib 2Geom.

Of course my click and pointing shape editor in my own ruby code, would have been probably working already, if I've not explored the SVG way…
But application like Inkscape and Gimp, are of course much more powerful.

I'm still looking for game editor's code if someone have seen a base with load/save/export features.

Up Topic Gosu / Gosu Exchange / hackable game editor project?

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill