|
-
Simply test it yourself 
When handling anything but integers or floats, the access speed of a Vector is slightly slower than the humble array. With integers or floats, the access speed is significantly quicker, but for general use the Array still wins.
-
Custom User Title
 Originally Posted by realMakc
I don't mind having a car that can fly even if that means reverse gear doesnt work.
Good coding practices would mean that you better have a car AND a plane instead of a plane-car-house-boat all in one that is not really good on any of that.
-
Senior Member
sure AND is better, but also more expensive
-
Senior Member
 Originally Posted by rumblesushi
Simply test it yourself 
Actionscript Code:
var a:Array = [new BitmapData (1, 1), new BitmapData (1, 1)]; var v:Vector.<BitmapData> = new Vector.<BitmapData> (2, true); v [0] = a [0]; v [1] = a [1];
var t0:int = getTimer (), i:int, bd:BitmapData; for (i = 0; i < 1e8; i++) bd = a [i % 2]; trace (getTimer () - t0); // 10204
t0 = getTimer (); for (i = 0; i < 1e8; i++) bd = v [i % 2]; trace (getTimer () - t0); // 10078
will now re-test in release mode
edit: release mode test
Actionscript Code:
var tf:TextField = new TextField; tf.autoSize = "left"; var s:String = ""; var a:Array = [new BitmapData (1, 1), new BitmapData (1, 1)]; var v:Vector.<BitmapData> = new Vector.<BitmapData> (2, true); v [0] = a [0]; v [1] = a [1];
var t0:int = getTimer (), i:int, bd:BitmapData; for (i = 0; i < 1e8; i++) bd = a [i % 2]; s += (getTimer () - t0) + " ";
t0 = getTimer (); for (i = 0; i < 1e8; i++) bd = v [i % 2]; s += (getTimer () - t0);
tf.text = s; addChild (tf);
10281 10188
so, I'm back to what I said: I would sure like to see some test code, please.
edit: ok, I'm also getting results like 10296 10360 but that's ~3% fluctuation, at least both methods perform equally fast/slow, without clear winner any way. except with Vectors you get compile-time type checking and code hints, which is clear winner in my book
Last edited by realMakc; 07-20-2010 at 01:45 PM.
-
Senior Member
Well, adobe might have made a significant leap with As3(and scared away half of it's non-coder user base), but that is "significant" when we compare flash with how it used to be. Now, it's not flash vs flash! Flash will have to compare itself against technologies like unity, while dealing with all of the flaws it has overlooked so far. That means, years of work within a few weeks, and for me, that seems quite impossible for the current adobe.
And with the html5 slowly becoming popular(it might take ten more years, but it has the potential), and adobe itself backing the project, it needs to do something groundbreaking again, like when flash first appeared on the market to maintain it's position(well, that is unless adobe pulls something to cripple the development of html5 and it's rivals)!
If you like me, add me to your friends list  .
PS: looking for spriters and graphics artists for a RPG and an Arcade fighting project. If you can help out, please pm me!
My Arcade My Blog
Add me on twitter: 
-
 Originally Posted by realMakc
Actionscript Code:
var a:Array = [new BitmapData (1, 1), new BitmapData (1, 1)]; var v:Vector.<BitmapData> = new Vector.<BitmapData> (2, true); v [0] = a [0]; v [1] = a [1];
var t0:int = getTimer (), i:int, bd:BitmapData; for (i = 0; i < 1e8; i++) bd = a [i % 2]; trace (getTimer () - t0); // 10204
t0 = getTimer (); for (i = 0; i < 1e8; i++) bd = v [i % 2]; trace (getTimer () - t0); // 10078
will now re-test in release mode
edit: release mode test
Actionscript Code:
var tf:TextField = new TextField; tf.autoSize = "left"; var s:String = ""; var a:Array = [new BitmapData (1, 1), new BitmapData (1, 1)]; var v:Vector.<BitmapData> = new Vector.<BitmapData> (2, true); v [0] = a [0]; v [1] = a [1];
var t0:int = getTimer (), i:int, bd:BitmapData; for (i = 0; i < 1e8; i++) bd = a [i % 2]; s += (getTimer () - t0) + " ";
t0 = getTimer (); for (i = 0; i < 1e8; i++) bd = v [i % 2]; s += (getTimer () - t0);
tf.text = s; addChild (tf);
10281 10188
so, I'm back to what I said: I would sure like to see some test code, please.
edit: ok, I'm also getting results like 10296 10360 but that's ~3% fluctuation, at least both methods perform equally fast/slow, without clear winner any way. except with Vectors you get compile-time type checking and code hints, which is clear winner in my book 
Interesting, Adobe appear to have fixed it in the latest F10 player just like they did with uint being slower than int. They seem to be exactly the same speed now, I just tested a loop of 1 million polygons, with some basic read/write on the object.
I did some extensive benchmarking last year, and the array was about 4% faster. Even in real world scenarios, I tried changing all the main arrays in my 3D engine to Vectors, and on a demo that runs at 50 something FPS, the array was a couple of FPS faster.
-
Please, Call Me Bob
Eh? 3D games don't usually do it for me, not when it's dressing the usually quick-to-play games I typically find with flash; seems a little gimmicky when it isn't done right (or most times I've encountered it, at least)
When done well, yes, it is very pretty, and I like pretty things, but I don't want to feel like I'm cheating on the fun, gameplay-oriented flash projects I love so much
This isn't to say I won't have an urge to make something when this comes up though...
Not to mention, it wouldn't matter if I despised every 3D game ever made; having the extra option never hurts unless it's removing functionality to make room somehow
As for anything else being faster, big thumbs up for that... always
With more speed comes more opportunities
Also, I have an awfully bad habit of running out of resources when doing experiments
But this has always been the way
-
 Originally Posted by TOdorus
And another plus of that would be, that it speeds up 2D as well as 3D. I can imagine that Adobe will have a hard time pulling that off though. Flash is designed around the CPU for quite a while now, that's some pretty core stuff to change around, not to mention backward, GPU and platform compatibility.
It's all rather pointless if the 3D looks terrible compared to good 2D art. I'd rather have a huge rendering performance boost with no 3D libraries than crappy native 3D support. There are libraries for that already.
If they included GPU support solely for 3D, just feeding the GPU triangles, you could still use that for 2D if you so desire, with an enormous speed boost to the current rendering.
Simply have all your objects represented as 2 polygon planes with a transparent texture (and the level/background as just a big plane), you could work in the same 2D manner that you're used to, but with the game being rendered as triangles, it would look no different, but render much, much faster with everything being drawn by the GPU, and the CPU left to do everything it should be doing.
 Originally Posted by TOdorus
On a more personal note: I don't think there really have been that many good 3D gamedesigns. Most of the time 3D is just used to have some good eyecandy, but the gamedesign is 2D. If I would make a Diablo-clone for instance, I'd like to use a 3D engine for the shading/lighting effects to give some oomph to the atmosphere. This adds more to the production value than gamedesign though. Some genres use 3D in their core gameplay but fail to use it in a novel way (Consider games like Descent, Portal or Dead Space against the overwhelming amount of other titles). As I'm a designer/coder first and then an artist I find 3D a bit overrated.
So in conclusion: just upgrade the rendering proces. Native 3D support is more of a gadget.
Todorus, just curious, which games are you speaking of that are mainly 2D by design but with 3D graphics?
Some of the most common 3D games are first person shooters and driving games. They are completely 3D by design, and simply can't be replicated in 2D.
I'm actually a huge fan of 3D games, even though I'm a proper old school gamer, having owned just about every console out there.
Even though I like SMB3 and SMW, I actually prefer Super Mario 64 to both of them. I just find it more engrossing and more fun.
And I'm a huge driving game fan. In the 2D era, I mainly played platform games, RPG's (well, Zelda), and fighting games. I don't really like 2D driving games.
When Ridge Racer and Daytona came out, my jaw hit the floor, and I've loved 3D driving games since, they are some of my favourite games.
So most 3D games that come out these days, even though a lot of them aren't anything special gameplay wise, are still pretty much 3D in terms of gameplay.
Be it a first person shooter, driving game, or action/adventure game like Bayonetta etc. Or GTA, Crackdown etc. After playing the top down GTA CW on the DS, despite the graphics being 3D, the 2D style camera angle and gameplay just doesn't offer the same level of immersion for me, as a proper 3D perspective view.
The only games that I love these days that are 2D in terms of gameplay mechanics are fighting games. Despite the fact that Super Street Fighter IV has 3D graphics, it's still a 100% 2D fighter in terms of gameplay, and that's exactly how it should stay.
The 3D graphics are a good choice for the game too. Not only do they look great, and maximise the 60 fps in terms of frames of animation per second (as opposed to the 5 or 6 frames per second of the SF2 spritesheets, even though the characters are moving at 60fps) but they are quicker to animate too.
Despite 3D models and UV mapping being a complex process, they are much quicker to animate. Where as for a 2D game you have to draw each new frame of animation, in a 3D game you simply move some constrains around per keyframe, and can even use the same animation cycles on different models etc just by strapping the same constraints to them.
Don't forget too, there are some excellent 2.5 games - like NiGHTS.
One thing I can agree on is there are no good 3D games online. The main 2 reasons for me building my own 3D engine in AS3 is a gap in the market, and my love for 3D games.
Last edited by rumblesushi; 07-21-2010 at 11:55 AM.
-
I'd like to do 3d games but I feel there isn't a good control scheme for anything other than a puzzle game. Mouse leaving the flash player area is a problem and a joystick works much better than a keyboard or mouse.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|