Parsing vector graphics files

Moderator
Posts: 522
Joined: 2002.04
Post: #1
I'm trying to find some information or source code about parsing something like an Illustrator AI or EPS file, or any of the vector formats. All I need to be able to do is read in the coordinates of the points of things created using Illustrator's pen tool. I can export from Illustrator into most any vector format, but I haven't been able to find any source or information on reading them.

I tried making a simple illustrator drawing and exporting it into each format, but none of them were very friendly to figure out how to parse the things when I opened them up with a text editor.

Thanks
-Jon
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
Quote this message in a reply
Member
Posts: 304
Joined: 2002.04
Post: #3
I am also doing a 2d side-scroller with polygon/curve backgrounds. Im also using a Rage128 which I can tell you is fast enough for what you want to do. So, some suggestions.

Look at the sourcecode for Rocco's uDevGame 2003 Contest Entry "Adventures on Pirate Isle". In the levels where you go underground into the caves, it uses a polygonal background. He exports from Illustrator to (some format that I forget) and then loads that in - so that should be a big help! I dont see the sourcecode available on his site tho - maybe you could ask him to send it to you since its not linked.

http://homepage.mac.com/felinegames/games/pirateisle/

Or, consider generating the terrain randomly for each game! As a player Id like that. You would have to be careful to not let it get too hilly - or for craters to appear right next to each other - but that would be cool.

Or, write your own tool specifically for making 2D terrains.

Or - and this could be an easy way out - use Illustrator to make a black outline of the terrain on a white background - then have Illustrator export as a .tiff (or some bit image format) - and read in the bit image and just scan to see where the non-white pixels are. Then save the data in your own format.

good luck,
Codemattic
Quote this message in a reply
Moderator
Posts: 522
Joined: 2002.04
Post: #4
Thanks!

SVG and Pirate Isle source code look like exactly what I want. I think it was the only vector format that Illustrator could export that I didn't look at! Hopefully I can come up with something nice.

-Jon
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Reflect a vector in relation to another vector ipeku 4 5,002 Dec 12, 2011 07:17 AM
Last Post: ipeku
  OpenAL - Ogg files vs Caf files Fred9000 8 13,388 Aug 23, 2011 08:01 PM
Last Post: ipeku
  New to obj-c and have no idea where to start: vector graphics billybob 1 2,511 May 27, 2009 11:17 AM
Last Post: billybob
  Vector graphics rendering: Best approach? Luipaard 5 4,856 Sep 28, 2007 08:40 AM
Last Post: TomorrowPlusX
  2d vector graphics game: GL or Flash? Krazygluon 1 2,961 Oct 30, 2006 09:57 PM
Last Post: maximile