Making my Asteroids clone (in C) I've rather fallen in love with vector-based entities, but I've simply coded them in as x,y-point arrays. That's been fine for something like Asteroids, but what should I do if I want to make more complex 2D models?
I note that there is an awful lot of 3D modelling software out there, as well as ample tutorials and help on importing 3D models into one's C/C++ program for use with Open GL.
However I'm rather more interested in creating 2D vector-based models than 3D, as I'm perfectly happy to keep trying 2D games for a while yet. Does such a concept as 2D modelling exist? Are there tools for creating and exporting 2D models and libraries for importing 2D models specifically, or does one just create flat models in 3D software and then import those files (e.g. .3ds, .ms3d) and lay them flat onto the z-axis?
My only thought so far was perhaps using something like Inkscape for modelling, generate SVG files, and then use Cairo to import and render them. Will that work well, or do you have other recommendations?
Note I'm a bit of a newbie to modelling of any kind, so I may be asking a silly question...
In game development, vectors have two or three dimensions (depending on whether you are making a 2D or 3D game) and are generally used to represent geometrical properties of objects within the game world (rotation, position, etc.).
More often, Game Developers use Vectors to determine the position of an object, the speed of a moving entity, the length of a certain object, and the distance between two specific positions. Further, it also helps in getting the direction which is mostly used in games having automatic following mechanics.
Vector is present both in old and modern games; the graphic holds specific advantages, making them useful even with the current technology in game development. Moreover, various game developers use certain assets made of Vectors while applying different graphic technologies to the game's main content.
Vector graphics refer to the use of geometrical primitives such as points, lines, and curves (i.e., shapes based on mathematical equations) instead of resolution-dependent bitmap graphics to represent images in computer graphics.
No need to upvote my own answer, but I've done a bit more research into using SVG. As I'm using OpenGL, it seems that OpenVG might be a good match.
It seems that all except librsvg stop short of actually allowing SVG files to be loaded in, so presumably there needs to be another step where SVGs are parsed into appropriate OpenVG structures (which mostly seem to be big float arrays, so not too hard). There likewise seems to be a one-to-one mapping of items from SVG to OpenVG, which is promising. As far as I can tell, OpenVG was pretty much made for SVGs.
I will probably use ShivaVG. Maybe it's not perfect, but it draws the tiger and I love a pure C / OpenGL implementation, and I seriously doubt I'll be doing anything all that complex just yet.
As far as 2D vector game programming goes, it usually is the domain of Flash and Flex.
Still SVG and loading it via Cairo seems to be a viable solution. Although I'd take care to make sure that you have hardware acceleration enabled (OpenGL backend preferably).
As far as 2D formats go, you won't get as good support as for SVG for any format, so I'd stick with it. Technically things like Collada or X3D do support 2D graphics, but practically they have a lot of useless (for a 2D programmer) bloat.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With