Slashdot Log In
Firefox 3D Canvas FPS Engine
Posted by
CmdrTaco
on Sun Nov 27, 2005 10:19 AM
from the because-you-can dept.
from the because-you-can dept.
axonis writes "Benjamin Joffe has developed Canvascape - "3D Walker", a simple javascript browser based 3D first person game engine that shows off the capabilities of the Canvas tag found in Firefox, Safari and Opera. " Don't expect much except a proof of concept ;)
This discussion has been archived.
No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Full
Abbreviated
Hidden
Loading... please wait.
overhead (Score:4, Interesting)
Re:overhead (Score:4, Insightful)
Parent
Re:overhead (Score:4, Funny)
Parent
Re:overhead (Score:3, Interesting)
Re:overhead (Score:4, Interesting)
I would suggest compiling performance sensitive apps to asm, and then optimizing nested loops and some comparison orderings. It is possible to get a lot better performance out of assembly.
Parent
Re:overhead (Score:4, Informative)
Bottom line, my register usage makes all the difference.
http://compucatedsolutions.com/asm.htm [compucatedsolutions.com] contains the C++ and assembly sorts, you'll notice they both operate in exactly the same way. I couldn't manage to get it past the lameness filter.
Parent
Re:overhead (Score:4, Insightful)
Having worked in Fortran, I can tell you that some things are just not possible to optimize well in Fortran either. And although I will admit that it is possible my knowledge of Fortran could be outdates (is there any other kind?) I suspect that you still have issues with optimizing for certain things (such as executables of sane sizes when dealing with huge arrays).
Again, I have friends who work as programmers in scientific fields who have complained about the overhead of Java in things like genetics analysis apps. On both the Fortran and Java the problem is not how fast can you pass X benchmark but rather how fast will your program work on a data set of arbitrary size.
Indeed Fortran makes this requirement next to impossible for the very fact that all memory allocation is done at *compile time* in Fortran 77, and in Fortran 90, you still extremely inflexible and this is what allows certain optimizations to take place.
Secondly, these posts only deal with pointer optimizations. They *do not* deal with the question of whether a given application will be faster than another one, especially in cases where many of the cycles are run through routines which don't involve user defined pointers. There is a very real question whether in memory or processor intensive applications whether these pointer optimizations will create a *net* gain of speed. For example, lets say in Fortran 77, I use a static array that is large enough to take up most of memory because this is the maximum size I *may* need for my application. At least with Fortran 77, this executable will be *big* and take time to load that could be better used actually running the program. Secondly, what happens when I also need to run another app on that same system? What is going to get swapped to disk? How is that going to impact performance? How does the kernel scheduling affect things?
Now supposed I write the same app in ANSI C using malloc and free where appropraite. The executable will load faster and *only use the memory it needs.* This means less swapping, and fewer delays due to outside factors.
In Fortran 90, things get somewhat better. I can create an array and then allocate space to it. But complex data structures are still lacking and so certain types of problems are going to get semantically *ugly* in Fortran 90. Ugly semantics makes for slow programs.
Here is the thing. There is no "perfect language." Fortran excells at allowing science students to rapidly develop quick and dirty programs to solve science problems safely (no buffer overruns, etc). These simulations, provided that they meet certain criteria, will probably run faster in Fortran than in any other language. But I don't think you can generalize this to an idea that "Fortran is faster than C" because in many cases, it won't be (many of these cases are corner cases in Fortran's core market though).
As for Java... It is great at some things. But there are many other areas where it simply doesn't perform well. Again processor and memory intensive apps (especially those involving string processing) come to mind. Java excells at being able to offer closed source software vendors a compiled environment with the portability of a scripting langauge. If performance continues to improve, great, but I don't think that performance will ever be the reason to choose Java, unless it is being compared to the likes of Python. Is it possible to determine circumstances where it may perform better than C, C++, or insert language here? Sure, but can one say that this means that Java is on a par performance wise with these languages? I don't think so.
Parent
Re:overhead (Score:3, Interesting)
Re:overhead (Score:5, Informative)
Imprecise. If considering only a specific platform and no existing libraries, you're even completely wrong: Coding ASM is significantly more time-consuming than coding C, but the difference is 3-5 times "only".
Obviously, with C, you get a higher level of abstraction, therefore more reusability, portability, etc.
> Then the C code would end up faster because compiler optimizations are faster than anything a person could hope to do,
Depends on the platform. Hardly anybody is able to optimize for speed a modern x86 processor "by hand", but RISCs and even some CISCs like the 68000 are another story. I have been programming for years as a hobby on the 68000 processor, and I have seen:
* GCC missing completely obvious CSEs: a global array used about ten times in a row, the compiler won't put its address into a register even if it has many spare ones;
* GCC not using the instruction set possibilities (10-byte code instead of 4-byte code, and that spills one more register; bad code related to local variables on the stack; etc.);
* GCC completely messing up a calling convention that should be more optimized ( saves&restores on a register that isn't even changed);
* etc.
Wonder why a number of not-very-powerful embedded platforms, like calculators, are still partly programmed in ASM...
There may be more appropriate compilers for those processors, but hey, GCC is supposed to be portable, and it has (had, they deprecated some useful things like casts-as-lvalues in GCC 4.0) cool extensions that most other compilers don't have.
> and it would be portable too.
If you use external libraries like the SDL, yes. Otherwise, no, not more than ASM.
Parent
Re:overhead (Score:4, Interesting)
The big issue is that assembler code doesn't have a lot going for it, so most people who program it these days do it for the extremes where nothing else will do - the glue to start a C program, that kind of thing. Worse still, a lot of it is device driver code designed by people who really aren't programmers. It's hard to find good assembler code in the 2000s. Those of us who were programming Motorola 68xxx code in the 1980s though know elegant, readable, maintainable, well structured, assembler code, generated no more slowly than stuff in C isn't impossible. As it's not as maintainable as the equivalent in C, nor as portable, nor as fast, it's just not worth doing any more.
Parent
Re:overhead (Score:3, Funny)
I have to tell you an awfull secret about 3D software. None of them really renders graphics three-dimensionally. They all just emulate 3D using math and gradients ;).
Re:overhead (Score:4, Interesting)
I disagree. The shareware release of Doom 1 was only 2.9MB compressed, and look at how much content it has. 2.9MB for all sounds, music, maps, code, etc. The game has a limited low-res textureset that is used creatively, used MIDI for music, and had a small number of sounds.
It isn't a matter of requireing too much data, it's a matter of not being able to use the same mindset when coding games for such platforms.
I'm not even a game developer, and I can think of a few tricks. For one thing, stream content as needed. Assume the player has broadband. Stream content as you play. Yes, have a loading screen, and use that initial load to grab the content for the first level. Then, while the user is playing, grab the content for the next level or two. Assuming low-end DSL (half a megabit), and 10MB of compressed content per level (Which can store a TON of content), you've got three minutes of load time per level. The initial load time is going to be the big crunch, because after that you can use gameplay time for downloading the next level.
You can also reduce initial load times by prioritizing content and streaming it in as-needed. If you have a level that is going to have 10 or 20 minutes of gameplay, then you don't need to load in sounds and textures that are only going to be used 15 minutes into the game. Those can be loaded while the user is playing. They only initially need to load stuff that is going to be present in the first few minutes of gameplay.
Another trick is procedural texture generation, where textures are mathematically generated rather than stored as bitmaps. And of course there's always the trick of combining multiple low-res textures to create higher res ones, like Halo did for terrain.
And assuming you have a 10 megabyte budget per level, you can always get more out of that by using textures from previously-loaded levels. This has the side effect of the game getting more graphically diverse as the player progresses, so it may not be something you want.
Anyhow, I think that considering how much can be done with a mere 2.9MB of data, having that much or more PER LEVEL can lead to some pretty good looking content.
Parent
Great, just what we need... (Score:5, Funny)
Re:Great, just what we need... (Score:3, Funny)
Woah! We get to kill real living sacks of dirty water? Neat! How does it work? remote operation?
Juxtaposition? (Score:5, Funny)
Then we have the last line of text:
This game is being developed but doesn't have much direction at this time, to make a suggestion email me. The gun is copyright by FarCry but is only here temporarily until I model the weapon set. Sydney Wedding Video and DVD
Wedding Video? Crazy Aussies...
Re:Juxtaposition? (Score:3, Informative)
http://www.abrahamjoffe.com.au.nyud.net:8090/ben/c anvascape/ [nyud.net]
Oddly enough, I get an error message for FF 1.07 but not IE6
(Yea, I know, use FF 1.5, it says so right in the error message)
The 2nd to last line of text;
Alot of people have suggested that I make the gun shoot or other equally redundant points. I only made this a couple of days ago so all in good time.
Kinda takes the shoot out of First Person Shooter
Wiki (Score:5, Interesting)
Re:Wiki (Score:5, Informative)
Parent
Opera (Score:5, Informative)
Firefox Compatibility (Score:5, Informative)
Re:Firefox Compatibility (Score:2, Informative)
Re:Firefox Compatibility (Score:3, Interesting)
Yeah, the <canvas> tag was introduced by Apple, so they were first-to-market with this one. Looks neat, which is probably why it's being adopted by others.
Re:Firefox Compatibility (Score:3, Funny)
Re:Firefox Compatibility (Score:4, Insightful)
Not in HTML4, nor in XHTML1.0 or 1.1
Canvas is a semi-proprietary element [whatwg.org] (originates from Apple, who first implemented it for Dashboard) that currently is in the under development HTML5/Web Applications 1.0 [whatwg.org] standard from WHATWG [whatwg.org], but is (as far as I know) not part of the W3C's XHTML2 draft [w3.org]
Parent
A cease and desist coming his way (Score:5, Informative)
And you can expect to be in trouble now that you've been slashdotted (I expect the legal document will come just as you finish putting out the fire your server caused). Even if it was only tempporary, lawyers have funny ways of dealing with copyright infringement. Which is sad, but protected by the law.
Re:A cease and desist coming his way (Score:4, Insightful)
1) that may well fall under fair use
2) so he gets a C&D letter, instructing him to remove the offending content... which he's planning on doing anyway. Net result, the company pays some lawyers needlessly.
Parent
Re:A cease and desist coming his way (Score:4, Informative)
Parent
Re:A cease and desist coming his way (Score:3, Insightful)
Such as reading a bedtime story from a book to your children is not a "Performance"; copying a vinyl record to cassette tape for use while jogging (those wearable 45's skip too much) is not "Piracy"; recording a TV show on your Betamax deck is not "Theft" (unless you fast forward through the commercials).
Fair Use shouldn't need to be specifically defined in the written law, but I'm sure many clarifications can be found in case law.
I would guess that since his use is
Opera 9 preview 1 (Score:4, Interesting)
Perhaps because the
Re:Opera 9 preview 1 (Score:5, Informative)
Parent
safari works (Score:4, Informative)
Ideas (Score:5, Funny)
I hear Jack Thompson recently had some ideas.
Well.... (Score:5, Funny)
Jerry
http://www.cyvin.org/ [cyvin.org]
works fine (Score:3, Informative)
end result VRML without VRML (Score:5, Interesting)
Re:end result VRML without VRML (Score:3, Funny)
Re:end result VRML without VRML (Score:4, Informative)
One of the longest running jokes in Internet history revolves around VRML... etc.
"Hilarious" and stolen from:
http://www.somethingawful.com/articles.php?a=926 [somethingawful.com]
Parent
here we go again... (Score:3, Insightful)
all the code neccesary to support this canvas thing (which will probably rarely be used) is just more junk that will slow down legit bug fixes, and probably be RIFE with security holes.
firefox will eventually just turn into 'Mozilla NG', and become yet another bloated turd of a browser, given the direction that 1.5 is taking, IMO.
this 'web app' support should be a sandboxed plugin, or something else that can be -optionally- added on, for firefox, not built directly into it.
Camino beats Safari/Firefox in speed on OS X (Score:3, Informative)
Shoot the Monkey and Win $20! (Score:5, Funny)
And java3d takes yet another hit (Score:5, Insightful)
Not just for games (Score:5, Insightful)
It's coming..
Re:Not just for games (Score:3, Interesting)
Regards,
Steve
How long till doom (Score:3, Funny)
Try this (Score:5, Funny)
Click on the canvas, and walk around. You've turned into a rabbit.
But will IE7 support Canvas (Score:3, Insightful)
I think it will be a big factor to think about when thinkin about using canvas in some web app. Because noone will want to use it if only a handful of browsers can support it.
Already supported with a plug-in (Score:3, Informative)
Wow (Score:3, Informative)
Re:Not for Opera 8.5 for OSX? (Score:3, Informative)
Re:Different than IE ? (Score:3, Informative)