Game Development Community

What happened to vector shapes?

by Ricky Taylor · in Torque Game Builder · 05/13/2006 (3:22 pm) · 14 replies

Well, the title says it all...

In B3, I can't seem to find a way of making those awXome vector shapes, (which are perfect for testing platformers... =) )

-- Ricky

#1
05/14/2006 (10:57 am)
Ricky,
In earlier beta's we attempted to support Vector graphics in some simple way but our implementation was not up-to-snuff and ended up causing more problems than it did resolve thing so it was removed. The t2dShapeVector class was an initial one-pass attempt at a Vector solution by melv. We put it in in hopes that it would be sufficient or that we would have time to beef it up a bit. We decided that the time it would take to properly update it to support the feature set that we deemed to be necessary would be too long so we've opted to post a bounty for a suitable replacement.

If you or anyone from the community is feeling really motivated and wants to implement a solution while making some cash, you can find the bounty listed on the TGB Bounties Page.

Hope this helps clear some things up for you!

Cheers,
-Justin
#2
05/14/2006 (11:28 am)
I guess I would be interested but I've never seen a SVG file in my life and from what I've read, not even the Adobe products fully support the file format. It seems like a quite a big job to implement this. I'd fear someone else's submission is taken after I invested 50+ hours into creating mine.

It could be fun though...

Tom Bless You All!

-Michael
#3
05/14/2006 (5:19 pm)
Inkscape at http://www.inkscape.org/ is an open-source program capable of generating svg files if anyone's interested.
#4
05/14/2006 (11:57 pm)
Yeah, I looked at the scope of this work and it looks to be at least 160 - 200 hours of coding to get something even remotely shippable. Even if you reuse a bunch of prewritten code (and it can't be GNU/GPL licensed if you want to distribute it with Torque), you need:

an XML parser
a CSS parser / runtime
an SVG parser for the 100+ tags and special cases
a scaleable text handling system that is light-years beyond .GFT/.UFT as it exists in Torque
a conversion engine that can convert all of these details into something that would be performant to draw at 250+ FPS in Torque

Good luck! Personally, I think a "clip art" or "vector graphics" component in TGB would be tremendously valuable. But, I think SVG is way too complicated for that purpose. Something that could rasterize WMF, EMF, EPS, or AI would probably be a much simpler task.
#5
05/15/2006 (12:26 am)
Am I missing something?

How did we get from TGB Vector _SHAPES_ to SVG?
#6
05/15/2006 (6:51 am)
Yeah I'm pretty sure ricky just wants the shapes _back_, not what apparently seems to be the most complicated advanced vector engine ever _not_ designed.
#7
05/15/2006 (8:14 am)
I agree with you guys... BUT, the bounty is for SVG, not just shapes. BTW, t2dShapeVector is still in there, it's just not documented. It's a piece of cake to use:

%shape = new t2dShapeVector()
{
   sceneGraph = t2dScene;
};
%shape.setPolyCustom(4, "-1 -1 1 -1 1 1 -1 1");

That creates a square. You can draw any vector shape you want within the coordinate range of (-1, -1) to (1, 1). Then you can scale it up using %shape.setSize().
#8
05/15/2006 (8:44 am)
Any polygonal shape? What about curves/circles?
#9
05/15/2006 (1:25 pm)
You can only build "closed shapes", but they can include concavities. So, stars, circles, boxes, outlined L's, hexagons, you name it.
#10
05/15/2006 (2:00 pm)
Simply call %shape.dump(); to obtain a list of all functions supported by t2dShapeVectors. You could also look in the source code for t2dshapevector.cc and .h.
#11
05/19/2006 (2:10 am)
Yeppers t2dShapeVector is still in the engine, we just removed it from the TGB level builder because it was a pain to work with.

Just FYI on the SVG bounty... putting that one up was kind of a shot in the dark. We know it's a veritable s*load of work. :) For that bounty, we'd actually be very willing to consider solid implementations of a vector graphics component, with an easy to understand public interface, that could load *any* common vector art format.

Ricky, sorry to hi-jack your thread with relatively unrelated info on the SVG bounty. :) Hope the example Jason provided, and the code in the engine itself, makes using the t2dShapeVector clear enough. Again, we don't have immediate plans to add this back into the TGB tool. Once we can get a more robust vector graphics implementation in place, then we'd certainly want to add support for it in the TGB level builder.

Thanks for the good question, btw.
#12
05/21/2006 (9:30 am)
Ohhh More bounties!

Ill take a look Josh... =P

Im crazy enough... And I know C++.
#13
05/21/2006 (11:32 am)
Building upon GameSWF may be a bit easier, no?
#14
05/30/2006 (2:35 am)
Hmm, no XML parser in T2D? I take that as a challenge :)
I have a half-ready quick & dirty C XML parser (follows none of the DOM standards
and such nonsense ;) that I want to upgrade to C++. Maybe I'll have a few classes
to offer once I familiarise myself with the T2D code. Unless someone here beats
me to it..