Jump to content


Photo

Vector Engine


  • Please log in to reply
21 replies to this topic

#1 Ruud v A

Ruud v A

    Games programmer

  • New Member
  • 417 posts

Posted 30 July 2007 - 07:47 PM

Vector Engine beta 1

This extension can handle vector images. It works very simple. You have a path. The path contains curves, and the curves (control)points. They are represented by gm objects, so you can move them with the normal gm functions.

Features:
- Very easy and fast structure.
- Cubic bezier curves.
- Connecting a new curve to the previous one.
- Fast navigation by using next and previous variables.
- Svg loading (beta function).
- Precision levels.
Limitations:
- It can only draw outlines. (Because gm can only draw triangle primitives)
- Svg loader can only load <path> tags and C (curveto) parameters.

You can help by posting bugs or suggestions.

Please post what you think about this extension.

Download
Download from Veniogames.
Download demo. (exe)
Mirror by gmbase:
Posted Image

~Ruud

P.S. Oh and if you want to know, this is completely gml, no dlls are used.

Edited by Ruud v A, 22 August 2007 - 04:46 PM.

  • 0

#2 IamCalle

IamCalle

    GMC Member

  • GMC Member
  • 444 posts

Posted 30 July 2007 - 11:20 PM

Whoa, this can be really handy. :) (I have not tried your extension, but I read through the help file, and I noticed a few typos.)
  • 0

#3 Krisando

Krisando

    GMC Member

  • New Member
  • 1351 posts

Posted 31 July 2007 - 03:27 AM

Haha Nice idea!! now we can enlarge images without loosing Quality!! :) but youll have to draw in something like Paint Shop Pro
  • 0

Posted Image


#4 Ruud v A

Ruud v A

    Games programmer

  • New Member
  • 417 posts

Posted 31 July 2007 - 08:33 AM

I read through the help file, and I noticed a few typos.

<{POST_SNAPBACK}>


Yes, I'm not English... I'll correct them if you say where they are.

@krisando:
You can download Inkscape, it's completely free. In fact, its the only program that works with the svg loader for now. Only the path tool. (Or you can convert your circles etc. to paths). I didn't test any other programs.

Edited by Ruud v A, 31 July 2007 - 08:40 AM.

  • 0

#5 jobro

jobro

    GMC Member

  • GMC Member
  • 1300 posts
  • Version:GM:Studio

Posted 31 July 2007 - 10:26 AM

Nice one, will not likely use it tho.
  • 0

Marketplace.png


#6 edmunn

edmunn

    GMC Member

  • New Member
  • 1298 posts

Posted 31 July 2007 - 11:09 AM

Very nice work, 10/10
  • 0

Posted Image
Please PM / Email your suggestions!

15.4" Apple MacBook Pro Late 08', 2.8 GHz Intel Core 2 Duo, 4GB RAM, SSD
Mac OS X Lion


:)

#7 the_mysterious_gamer

the_mysterious_gamer

    GMC Member

  • New Member
  • 431 posts

Posted 31 July 2007 - 11:32 AM

Very good work! Great quality... Unfortunately, it would be hard to use without some sort of fill/background. Try find a way to do that, and this could be very useful.
  • 0
"F*ck that sh*t - next time I'm introduced to someone I'm going straight into explaining recursion." - Mistertim on society

#8 Ruud v A

Ruud v A

    Games programmer

  • New Member
  • 417 posts

Posted 31 July 2007 - 01:37 PM

Thanks you all, I'm searching for a way to fill the paths here.
  • 0

#9 th15

th15

    GMC Member

  • GMC Member
  • 1585 posts
  • Version:Unknown

Posted 03 August 2007 - 03:15 AM

I don't know, it's pretty spiffy but if even the demo runs slow after a dozen points or so how well does it scale into a game?

Since Battleships Forever using a vector line art style (which is sadly faked with raster images) I'd jump at an opportunity to use real vectors, however, with each ship section made of about 8 vertices and each ship having an average of 6 sections, that's going to add up real quick.

Edited by th15, 03 August 2007 - 01:03 PM.

  • 0

Sean 'th15' Chan
site_logo.gif


#10 Ruud v A

Ruud v A

    Games programmer

  • New Member
  • 417 posts

Posted 03 August 2007 - 11:57 AM

You can speed it up by using less detail. The demo uses a detail level of 32, but even a detail of 12 would look good enough. So it would be almost 3 times faster by using 12 instead of 32. But if you're using detail levels of 4 or 6 then the lines don't look smooth enough.
  • 0

#11 Ruud v A

Ruud v A

    Games programmer

  • New Member
  • 417 posts

Posted 15 August 2007 - 07:35 PM

I just found an example, on yourselfs website, how to triangulate polygons. I'm going to implement this as soon as possible, because it allows filled shapes. But it will not be very fast...
  • 0

#12 Billy MetAl

Billy MetAl

    GMC Member

  • New Member
  • 463 posts

Posted 28 September 2007 - 03:28 PM

good
  • 0
Posted ImagePosted Image Need help with a game, or just need some music? Contact me :)

#13 HaRRiKiRi

HaRRiKiRi

    GMC Member

  • GMC Member
  • 1364 posts

Posted 29 September 2007 - 04:57 PM

To speed it up you could just draw the vector to a surface. Then it will be very fast. Can you give a link to wikipedia or something where the formula can be found on how to calculate this??
  • 0

#14 Ruud v A

Ruud v A

    Games programmer

  • New Member
  • 417 posts

Posted 30 September 2007 - 05:55 PM

Wikipedia article
I found a c++ triangulation code, and I'm writing a dll for it. It will return gml code to draw the filled shape. I will also implement a function to create a drawing string, so you don't have to use the drawing functions each step, which will speed things up for non-dynamic shapes.

If someone knows a good FREE help file creator please pm me. (Not shareware/trials)

Edited by Ruud v A, 30 September 2007 - 08:50 PM.

  • 0

#15 IamCalle

IamCalle

    GMC Member

  • GMC Member
  • 444 posts

Posted 28 September 2008 - 11:23 PM

Hey Ruud, are you still working on this engine? :]
  • 0

#16 Ruud v A

Ruud v A

    Games programmer

  • New Member
  • 417 posts

Posted 29 September 2008 - 06:27 AM

No. I don't even have the source code anymore since my computer crashed a few times (I had to reinstall Windows). I did make a bézier script that returns a point on an n point bezier (limited by the amount of arguments GM can handle), but I don't know if I even still have that.

Besides, triangulation seems rather complicated and I think it would not be very fast in GM... The same for real anti-aliasing, not to talk about svg effects like gaussian blur...
  • 0

#17 IamCalle

IamCalle

    GMC Member

  • GMC Member
  • 444 posts

Posted 29 September 2008 - 11:57 AM

Ok, sad to hear.

Well, in my particular case, speed really isn't much of consern, and svg effects aren't needed. In my case at least, an engine that can draw technical symbols and such, is all I need.- I am thinking of drawing each symbol as a sprite when they are not being resized and so on.
Fede-Lasse has a way of drawing antialiased bezier curves (+ lines, circles etc).- It's not real antialiasing, but I guess it will work ok. (Perhaps one can optimize it if necessary.)

I see several bezier-curve drawing systems here, so I think the next step should be scalable vector graphics...? x)

Edited by IamCalle, 29 September 2008 - 03:47 PM.

  • 0

#18 orthogonal3

orthogonal3

    GMC Member

  • New Member
  • 1 posts

Posted 30 September 2008 - 10:42 PM

Hi guys,

First Post - so sincere apologies if I have put this in the wrong place - it seems on similar topic!
Mods - please move it or tell me how if I need to, thanks!

The situation...

I am programming a military RTS with my brother. We have previously made a simple concept model of the units, planes etc but we have always hit a slight problem with the map/background...

The game will need to zoom in and out over a large map (The World) to country level (roughly speaking) currently using views however our early tests with GIF sprites and JPG/PNG backgrounds obviously hit on a problem of scaling (and we all know how ugly JPEGs can look!)

I always wanted to use SVG as a background source and have obtained a map in that format that will work fine (for me at least)
Now came the problem of how to load this into my game, I then saw this forum thread and things were looking up, you guys are experts from what I've read!!

The methods discussed or a combination of them (using models perhaps) seem like they will do the job

Details

Here are a few considerations for this map
  • The game does not need to step quickly (approx 5 or 10 Hz) - less pressure on algorithms
  • Map meant to resemble radar(-ish ;) ) so no problems about simple 2 colour - blue/green for sea and land
  • Some units cannot cross the border (sea and land units) - others (air) can so need to collide with border or detect they are at it from colour etc
  • There will be more than one polygon in the SVG file at the minute although each continent-mass is one polygon
  • --possibly in the future-- Skin the map with country/continent borders or other such features
Other than that I think it will be pretty much open (not easy I presume -_- )

Other info
I'm using GM Pro 7
I do understand programming - I've coded in a few langs - even if I need help with the code and how-tos, I should understand any examples

Thanks in advance for any help you guys can offer - These aliased JPEGs are making me ill!

Cheers again,
Phil
  • 0

#19 IamCalle

IamCalle

    GMC Member

  • GMC Member
  • 444 posts

Posted 01 October 2008 - 01:51 PM

Well, I don't know how well true SVG would run in GM (considering the fps count), but if you have a look at a post in another thread:
(http://gmc.yoyogames...howtopic=397516)

QUOTE (IamCalle @ Sep 29 2008, 12:28 PM) *
Yes I have, several times.
Thing is: I don't have the capasity at the moment as I have enough to work on already. (I would have to learn how svg works, then spend much time to make my own system work and I can't do that as I need to finish my program as fast as possible.)


-_- Than keep it as a future project.
But have you taken a bit of time to look at that SVG format ? I think you will run into quite a lot of trouble if you want to emulate its behaviour. I would say its pretty-much impossible for us amateurs, even when we would try to write a DLL for it. Its just too complex.

That is why I suggested you to develop your own, simpler version of it.




-> So, I have been thinking of making something like fake primitive SVG format(visually trying to look like SVG but working in a much simpler way), but I haven't started it yet.
I think that is the best way to go for now.

Edited by IamCalle, 01 October 2008 - 02:10 PM.

  • 0

#20 IamCalle

IamCalle

    GMC Member

  • GMC Member
  • 444 posts

Posted 03 October 2008 - 04:40 AM

Anyone caring to share their thoughts on this? x)
  • 0

#21 Ruud v A

Ruud v A

    Games programmer

  • New Member
  • 417 posts

Posted 03 October 2008 - 07:20 AM

This would be possible, although you have to keep these things in mind:
- Bézier calculations are slow (in GM), so you probably have to render the vector to a sprite and use that sprite. (Which may have the advantage of smaller filesize but that's the only thing I can think of)
- You have to triangulate outlines, which is quite hard (but possible).
- Things like gradients are going to be very hard.

You have to ask yourself if you really need vector graphics. The whole process of calculating the outlines, triangulating them and drawing them is not going to work realtime for more complex shapes. I think adding anti-aliased sprites in multiple sizes would work better, although they are not fully scalable. If someone knows a fast way to get the pixel data into GM (calculated in a DLL), this would be possible.
  • 0

#22 IamCalle

IamCalle

    GMC Member

  • GMC Member
  • 444 posts

Posted 03 October 2008 - 09:22 PM

- Bézier calculations are slow (in GM), so you probably have to render the vector to a sprite and use that sprite. (Which may have the advantage of smaller filesize but that's the only thing I can think of)

That is more or less what I had in mind all the time.

- You have to triangulate outlines, which is quite hard (but possible).

That depends on how this system will work, and how advanced it really needs to be.

- Things like gradients are going to be very hard.

I guess so, yes. But then again, that may not be necessary anyway. (Not for me at least.)

You have to ask yourself if you really need vector graphics. The whole process of calculating the outlines, triangulating them and drawing them is not going to work realtime for more complex shapes. I think adding anti-aliased sprites in multiple sizes would work better, although they are not fully scalable. If someone knows a fast way to get the pixel data into GM (calculated in a DLL), this would be possible.

I know my needs for this project, and I have already thought it through.
- I think I have come up with a solution. It's quite basic, but I am sure it will work. x)

Edited by IamCalle, 03 October 2008 - 09:39 PM.

  • 0