Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411488 Posts in 69377 Topics- by 58433 Members - Latest Member: Bohdan_Zoshchenko

April 29, 2024, 03:42:28 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Vector Graphics/Animation
Pages: 1 [2]
Print
Author Topic: Vector Graphics/Animation  (Read 10171 times)
medieval
Guest
« Reply #20 on: September 01, 2008, 12:05:19 PM »

Actually, don't you mean vector graphics as in, made in Illustrator or similar? I think one of the few options is to import the outlines (the points, and then draw the lines in between them according to how you bent them), then stroke and fill them, which somebody needs to back me up for because I am not that much of a real programmer!

Once you got everything loaded it should be similar to sprites for animating them (assuming you have all the frames. If not, then I got you wrong, excuse me.)
Logged
cmspice
Level 1
*


View Profile
« Reply #21 on: September 02, 2008, 12:00:39 AM »

I think allegro has vector support (basic shapes and and bezier curves for more complicated stuff).

Hey, umm, any examples of non flash vector stuff? I'm just curious.

A vector engine would be the balls but it'd be too much work to make. I'm sticking with raster for now. That amanithVG thing is pretty cool though.
Logged
Eclipse
Level 10
*****


0xDEADC0DE


View Profile WWW
« Reply #22 on: September 03, 2008, 12:34:20 AM »

Eclipse, it looks sweet.

I wish you good luck, mate!

BTW, C# question.. Is the reason's C# is so slow compared to C++ is because of the additional interpretation layer (the JIT)?

Hey Orestes ;)thank you!
Let me clarify this before some C# fan hit me with a club Smiley
first, the JIT doesn't know anything about the processor in which it is running, so there are no specific machine code optimizations, on the pc it just runs fine, on xbox is a pain in the a** for that.

Second, C# can't inline anything. That's mean that even the simplest of the operators does a lot of jumps and copy just like you're calling a funcion, for example:

Vector3  pos=pos2;

That stuff will do something like  Add(x, y, z, x2, y,2, z2), i mean, it will call a funcion and do the copies, in this case calling the function is even slower than simply copying 3 floats.

If this simple code is inside a loop called a lot of times every frame (for example inside the stuff that checks for collisions)it will considerably slow down your game.
To fix that you have to manually copy all the stuff avoiding the operators like:

pos.x=pos2.x;  pos.y=pos2.y; pos.z=pos2.z;

you can undestand better the problems around the impossibility to inline code and the stupidity of the JIT compiler here
http://creators.xna.com/en-us/tutorial/optimization_highfrequency

Another possible problem, but this time on Xbox only, is caused by incrementing class variables inside a loop. It causes what is commonly named a "load-hit-store" problem, you can read more about it here http://www.gamasutra.com/view/feature/3687/sponsored_feature_common_.php

And all that stuff is C# (or better any .NET language) fault, not XNA one..

So yes, C++ is way faster than unoptimized C#, and to optimize your code you have to write a lot of dirty stuff and even make it unsafe, for example i had to activate the unsafe flag to do some optimized math functions which uses bit shift operators. If you can avoid C#, don't fuckin' use it, it offers anything more C++ and there are not so much good libraries too.

@muku i dubt those tests were made using some specific code that slow down C#, in a normal application it is just fine but try do to that stupid code inside your main gameplay loop and you will see:

for (int i=0; i<200; i++)
Vector2 pos=pos2;
« Last Edit: September 03, 2008, 12:41:42 AM by Eclipse » Logged

<Powergloved_Andy> I once fapped to Dora the Explorer
Zaphos
Guest
« Reply #23 on: September 03, 2008, 01:45:01 AM »

I think allegro has vector support (basic shapes and and bezier curves for more complicated stuff).
I think it is all in software and with no anti-aliasing, though ...

Eclipse -- The JIT does know what machine it's running on, and it does make machine specific optimizations, one of which is how much to inline.  The issues mentioned in your links are specific to the 360.

@muku i dubt those tests were made using some specific code that slow down C#
They were done with C# mono, which is an unsupported open source implementation.  The microsoft implementation should be faster.
« Last Edit: September 03, 2008, 01:50:31 AM by Zaphos » Logged
muku
Level 10
*****


View Profile
« Reply #24 on: September 03, 2008, 01:45:58 AM »

Hey Orestes ;)thank you!
Let me clarify this before some C# fan hit me with a club Smiley
first, the JIT doesn't know anything about the processor in which it is running, so there are no specific machine code optimizations

That's not true though, see this article:
http://blogs.msdn.com/davidnotario/archive/2005/08/15/451845.aspx


Quote
@muku i dubt those tests were made using some specific code that slow down C#, in a normal application it is just fine but try do to that stupid code inside your main gameplay loop and you will see

Yeah, sure, those are just generic micro-benchmarks, I'm not claiming they are completely reliable. If you write stupid code though, you can make any language crawl. Wink

I don't want to come off as a C# fanboy, I'm not, I only use it at work and it performs reasonably well in a business environment. For game development, I'll stick to D, thank you very much Wink
Logged
Eclipse
Level 10
*****


0xDEADC0DE


View Profile WWW
« Reply #25 on: September 03, 2008, 03:01:41 AM »

The issues mentioned in your links are specific to the 360.

strange because i speeded up my game from 50 to 120 fps on my laptop only manually inlining stuff and avoiding operators...
I tried it on xbox 360 too, and yes here it's even worse, writing what can appear like a normal object oriented line of code can completely suck your framerate down.

C# is good for applications, just like java is, but it sucks ass from a straw in mid complex games and i assure you i had proofs because i directly ported my stuff on it from c++  Wink

Now let's back in topic Tongue
Logged

<Powergloved_Andy> I once fapped to Dora the Explorer
Zaphos
Guest
« Reply #26 on: September 03, 2008, 03:21:21 AM »

strange because i speeded up my game from 50 to 120 fps on my laptop only manually inlining stuff and avoiding operators...
What it can inline is restricted, and sometimes it will just decide not to inline things, but it is not true that it cannot inline at all.  So ... yes.

C# is good for applications, just like java is, but it sucks ass from a straw in mid complex games and i assure you i had proofs because i directly ported my stuff on it from c++  Wink
I agree with your general point, I just think the specifics were not accurate.  I suppose it hardly matters Smiley
Logged
dmoonfire
Level 3
***



View Profile WWW
« Reply #27 on: September 04, 2008, 05:32:18 AM »

As for the JIT, I think its just a matter of maturity. The JIT knows whats machine it is running on, simply because most JITs are implemented as C code, not C# code. So, it doesn't really make sense that it wouldn't know. The main issue is that most JITs just work with the core x86 code because it handles the largest number of cases and machines. Simple economics. Sooner or later, someone will come up with machine-specific optimizations. Its less bang for the buck, except maybe in the Xbox machine, but I'm sure that's related to where Microsoft is spending its research dollars more than anything else.
Logged
sirGustav
Level 0
*


View Profile WWW
« Reply #28 on: September 13, 2008, 05:05:35 AM »

I've been wanting to do something with cairo, though havent found myself the time yet.
http://cairographics.org/
Logged
increpare
Guest
« Reply #29 on: September 13, 2008, 05:21:21 AM »

I've been wanting to do something with cairo, though havent found myself the time yet.
http://cairographics.org/
Does cairo work well for animated stuff?  I've used it to produce still images, but I've never considered using it in realtime stuff.
Logged
muku
Level 10
*****


View Profile
« Reply #30 on: September 13, 2008, 05:36:56 AM »

I've done a bit of research on Cairo a while back when I was looking into different vector libraries, and it's possible (there's even a Lander-style game prototype floating around which uses it, IIRC), but from what I've read you're bound to run into performance problem pretty quickly.
Logged
increpare
Guest
« Reply #31 on: September 13, 2008, 05:44:27 AM »

I've done a bit of research on Cairo a while back when I was looking into different vector libraries, and it's possible (there's even a Lander-style game prototype floating around which uses it, IIRC), but from what I've read you're bound to run into performance problem pretty quickly.
Yeah, that's what I guessed.  Good for basic gui graphics rendering, though.
Logged
dmoonfire
Level 3
***



View Profile WWW
« Reply #32 on: September 13, 2008, 06:29:22 PM »

Depends on the Cairo backend, from what I figured out. They have quite a few, the Glitz (OpenGL) backend is suppose to be fairly fast. I think they were also talking about an OpenVG one, as soon as someone produces it. The default Gtk+ has the same problem that doing animation in Gtk+ has--Gtk+ blows for animation. At least, that was my impression when I spent a month doing a Gtk animation library, with a lot of help from (probably the wrong subset) of Gtk+ programmers.

I actually used Cairo as part of my SVG OpenGL implementation. It isn't too bad, but once you get it into OpenGL, you can display list it and make it a lot faster. Well, that and I was rasterizing it via Rsvg+Cairo since they just added a lot of the hooks for straight to OpenGL (rsvg has a render to cairo directly function).
Logged
Pages: 1 [2]
Print
Jump to:  

Theme orange-lt created by panic