Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×
Mozilla The Internet Entertainment Games

Firefox 3D Canvas FPS Engine 280

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.

Firefox 3D Canvas FPS Engine

Comments Filter:
  • overhead (Score:4, Interesting)

    by jacquesm ( 154384 ) <j AT ww DOT com> on Sunday November 27, 2005 @11:20AM (#14123753) Homepage
    Think about the overhead, here is a triple-layered game engine ! Wonder what you could really do with these machines if you hard coded them 80's style in assembler...

    • Re:overhead (Score:4, Insightful)

      by rd4tech ( 711615 ) * on Sunday November 27, 2005 @11:28AM (#14123784)
      would it be as portable as it is now?
      • would it be as portable as it is now?

        Well, if you need portability for some graphical gadget, why not do it in Java [nyu.edu]?

        I'm really not too impressed with all this Javascript-used-for-graphics stuff that's in vogue right now - okay, so this Canvas element allows much more graphical control over page layout, but if this mini-FPS is anything to go by, it's horribly slow. As a comparison, see the famously slow Java do a far more complex scene entirely in software [nyu.edu]...
    • Both of you raise a valid point.
      That said, what he did is a good tech demo of what users/programmers out here can do with Canvas on the most recent Firefox versions ! Although older computers should not be neglected, the power of modern computers leaves some room for improvement: it is perfectly usable on my machine, which is more than two years old.
    • Re:overhead (Score:4, Funny)

      by Anonymous Coward on Sunday November 27, 2005 @11:44AM (#14123850)
      Yeah, it will never work. Only took 12 seconds to load with no excitement. Compare that to the 15 minutes of quality time my son & I spend together trying to launch Runescape.
    • Re:overhead (Score:3, Interesting)

      by bradbeattie ( 908320 )
      Wonder what you could really do with these machines if you hard coded them 80's style in assembler...
      Not much more than if you coded it in C. Compiler optimizations pretty much took the place of tricky assembly programming.
      • Right, the only people who need to program in assembly are those who optimise or develop compilers. It's still useful to learn a bit so you know how to keep your project in check before going into bloattown.
      • While I've heard that more than a few times, I can't help to think that it seems to contradict the following other meme:
        • Java programs run using a good JIT can actually be faster than C programs. This is because of two reasons: one, the JIT can use runtime information to know the best way to optimize certain segments of code; two, since Java don't have some language features such as pointers, it is possible to make optimizations that are not possible in C.

        The first part about special insights obtai

        • I think you are thinking Java v. C++.

          Of course, I think it highly depends on the app. Java as a language has a bit more memory overhead for things like string operations.

          People have described C as something like an architecture-independant assembler. In other words, if you know the C, you can easily translate it into assembler. C++ and Java are completely differnet beasts. And although I keep hearing people talk about overhead in one or the other, I have never seen particularly good benchmarks which wer
          • No, actually, I really am talking about C vs. Java, or more specifically the compiler optimizations that are available in some other languages, e.g. Java, or Fortran (and thus implicitly assembler), that are not available in C.

            Also, you said: People have described C as something like an architecture-independant assembler. In other words, if you know the C, you can easily translate it into assembler.

            • Re:overhead (Score:4, Insightful)

              by einhverfr ( 238914 ) <chris...travers@@@gmail...com> on Sunday November 27, 2005 @07:28PM (#14125683) Homepage Journal
              It also depends though on what you are optimizing for.

              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.
      • Re:overhead (Score:4, Interesting)

        by jcnnghm ( 538570 ) on Sunday November 27, 2005 @06:29PM (#14125480)
        I ran a basic benchmark to test this theory a couple of weeks ago. I wrote a very basic selection sort in asm, then rewrote it in C++. The asm took 25 seconds to sort 100,000 random 32-bit numbers whereas the C++ took 45.

        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.
    • It would take you months to do that in assembler, and half a day to do it in C. Then the C code would end up faster because compiler optimizations are faster than anything a person could hope to do, and it would be portable too.

      And the assembler code breaks when CPU upgrades happen.
      • Re:overhead (Score:5, Informative)

        by Lionel Debroux ( 807362 ) <lionel_debroux@y ... GO.fr minus city> on Sunday November 27, 2005 @01:13PM (#14124256) Homepage
        > It would take you months to do that in assembler, and half a day to do it in C.
        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.
        • Yes, maybe one out of 100 programmers _may_ be able to beat a compiler at optimization. It's more important to get that one out of a hundred people to contribute those techniques to the compiler itself so more people benifit. It's just too time consuming to teach everyone low level assembly and there are just too many traps you can easily fall into.

          With FPGA's I don't think anyone would seriously consider doing their own layout, cell by cell, for a design. The task would be nearly imossible, there is no way
      • Comment removed (Score:4, Interesting)

        by account_deleted ( 4530225 ) on Sunday November 27, 2005 @01:54PM (#14124468)
        Comment removed based on user account deletion
      • Compiler optimizations don't create faster code than a decent human coder, even for, say, x86. They just do it much quicker and make the code easier to debug/reuse. On most big systems (say, a 3D game on a PC or game console) the complexity of the programs makes using an optimizing compiler an acceptable tradeoff (and thus people have invested much work in making good compilers); on smaller embedded systems like DSPs in cell phones, it still makes sense to have hand-optimized code because it can save the
    • I agree.

      Even on my Athlon64 3200+, the game is jerky at best; whenever I move the character, the CPU usage shoots up to 100%.

    • Re:overhead (Score:3, Interesting)

      Try pouet.net [pouet.net] or other "demoscene" websites. The Demo Scene guys still do a fair amount of stuff in low level languages, especially for the 64k (or smaller) competitions. Some of the stuff they do is quite amazing, for its technical merits as well as the artistic aspect.
    • Re:overhead (Score:2, Interesting)

      by coopaq ( 601975 )
      Here's a fake example I wrote using just DIV and IMG tags.

      games [mindread.com]

  • by martinultima ( 832468 ) <martinultima@gmail.com> on Sunday November 27, 2005 @11:22AM (#14123762) Homepage Journal
    Yay, a platform-independent way of senselessly killing innocent people! What's next, "Grand Theft Auto: Firefox <canvas>"?
  • by mikeage ( 119105 ) <{slashdot} {at} {mikeage.net}> on Sunday November 27, 2005 @11:25AM (#14123773) Homepage
    [In case it's slashdotted, the walkthrough looks like a standard FPS, with an M4 being held].

    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)

      by TubeSteak ( 669689 )
      In case of /.ing, break mirror
      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)

    by BibelBiber ( 557179 ) on Sunday November 27, 2005 @11:26AM (#14123774)
    Now include a Wiki environment and people can dynamically built and develop on the levels. Looks nice, really.
  • Opera (Score:5, Informative)

    by masklinn ( 823351 ) <.slashdot.org. .at. .masklinn.net.> on Sunday November 27, 2005 @11:26AM (#14123777)
    FYI, Firefox only works from 1.5 onwards (Gecko 1.8), and Opera 8.5 doesn't work (anyone testing 9.0 could tell if it works or not?)
  • by Anonymous Coward on Sunday November 27, 2005 @11:27AM (#14123779)
    May I point out that Canvas tag is only supported in Firefox 1.5, and not the current stable release 1.0.7.
    • But it works fine in Safari 1.3+.
    • May I point out that Canvas tag is only supported in Firefox 1.5, and not the current stable release 1.0.7.

      No, you may not. And you get points off for using a period instead of a question mark. /troll && /funny

      However, my question is this: Is the canvas tag standards-compliant?

      *will look up later*
    • There is a current stable release? That's funny, on all three of my usual machines, firefox still leaks memory like a sieve if I leave multiple tabs open for longer than a day or so and PDFs frequently crash the app. Don't get me wrong, I prefer Firefox over any other browser, but I still have use IE for a few things and at least when IE crashes, it doesn't bring down every other instance of the same program with it (firefox does).
      • When IE crashes on me, it crashes Windws entirely, no BSOD, but the entire OS freezes, I've never had that problem with firefox. If a web site dosn't work in firefox or Opera, I don't use it.
        Unfortunatly you're right firefox does leak memory, but then so does Windows itself which dosn't help.
        • I don't bother making my websites look nice in IE anymore. Just make it usable and slap a 'better with Firefox' logo/link on. Sometimes I'll bother tweaking the site to fix minor bugs in Opera and Safari but not always. Luckily the bugs in those, especially in Safari, are few so even if I don't they tend to work well.

          I like to use text shadowing too which STILL only works in Safari. I really wish Firefox would add that style element. It really does make text jump off the page in a way flat text doesn't.

          I ha
      • I am using FireFox here (1.0.7) on FreeBSD. The machine is an old ThinkPad that I'm using while my PowerBook is repaired. I have found it choke on a few sites that Safari renders fine, but other than that it's fine. This machine only has 256MB of RAM (8MB of which are stolen by the integrated graphics chip), and yet after three days of uptime with FireFox open most of the time I still haven't used virtual memory. Admittedly most of the rest of what I am doing is vim, which is only memory-heavy next to v
        • It definitively leaks. Both on Linux and Windows I regularly have to restart Firefox - it regularly grows to more than half a GB before I kill it, and closing down browser windows doesn't help. And before anyone suggests I remove the flash plugin etc., my Linux box NOT have flash installed. I've followed every single tip I've seen for tweaking prefs, turning off caching etc., and it hasn't helped.

          It's been that way as long as I've used Firefox and Mozilla.

          My Linux box is continuously on, but I use the W

      • Interesting. My copy of Firefox has been up here on this Ubuntu laptop since I booted it. Current uptime: 13 days. Multiple tabs open the whole time. No swap usage, 512 mb of RAM.

        My desktop at work, running Windows 2000 has been running Firefox for at least several weeks, though I'm not at it to check its exact uptime. Again, multiple tabs are open. No paged memory, 512 mb of RAM.

        On my home desktop, running Windows XP, I don't tend to run Firefox too often since I game with it, and I have my laptop ne
    • May I point out that Canvas tag is only supported in Firefox 1.5, and not the current stable release 1.0.7.

      Tomorrow on Slashdot: A Firefox website did NOT get slashdotted yesterday!
    • That's so that, when a dupe of this is posted next week, everybody who gets the stable release of Firefox 1.5 when it comes out will have something new to see in the article.
  • by aussie_a ( 778472 ) on Sunday November 27, 2005 @11:30AM (#14123793) Journal
    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

    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.
  • Opera 9 preview 1 (Score:4, Interesting)

    by sucker_muts ( 776572 ) <sucker_pvn@hotmCHICAGOail.com minus city> on Sunday November 27, 2005 @11:31AM (#14123794) Homepage Journal
    In opera 9 preview 1 it works, but incredibly slowly. I get about 1 fps, because it reloads all the scenery and redraws the white walls with every move.

    Perhaps because the /. effect? Or is javascript not dependent on the server? Or is the implementation for javascript in opera not optimal?
  • safari works (Score:4, Informative)

    by BushCheney08 ( 917605 ) on Sunday November 27, 2005 @11:31AM (#14123795)
    Works in Safari on 10.4 However, it really helps show the age of my G3 iBook (4+ years). I get approx 2-3FPS. But it loads really fast! Still, a nice proof of concept. I'll have to check it out on my PC when I go fire up NFS Most Wanted this afternoon.
  • Ideas (Score:5, Funny)

    by Hinhule ( 811436 ) on Sunday November 27, 2005 @11:35AM (#14123809)
    This game is being developed but doesn't have much direction at this time, to make a suggestion email me.

    I hear Jack Thompson recently had some ideas.
  • Well.... (Score:5, Funny)

    by confusion ( 14388 ) on Sunday November 27, 2005 @11:37AM (#14123820) Homepage
    I guess we've found a purpose for those 8 core CPU's we've been hearing about...

    Jerry
    http://www.cyvin.org/ [cyvin.org]
    • "I guess we've found a purpose for those 8 core CPU's we've been hearing about..."

      You laugh, but SpreadFirefox [spreadfirefox.com] are giving away dual-processor, Firefox-skinned Alienware machines (price tag: $4700) "to the three developers who extend firefox in ways that are worthy of such raw computing power."
  • works fine (Score:3, Informative)

    by Anonymous Coward on Sunday November 27, 2005 @11:40AM (#14123833)
    works fine with athlon64 and 2gb ram on firefox1.5
  • FPW (Score:2, Funny)

    by Avisto ( 933587 )
    More like a First Person Walker. /ripped from a digg comment
  • by Danathar ( 267989 ) on Sunday November 27, 2005 @11:52AM (#14123884) Journal
    Its funny to see things popup that have been done before but with standards that never made it....
    • Are there any active VRML sites still around? I found one about two years ago or so that still had a couple of people in it, but it was like finding a random IRC channel with a low population. Nothing actually was happening.
    • by Anonymous Coward
      One of the longest running jokes in Internet history revolves around VRML (an acronym for "Virtual Reality is Much Laughter"). In case you haven't heard of this idiotic language, and I truly hope you haven't, let me get you up to speed by presenting an alarmingly inaccurate historical description of VRML. VRML was initially created in the mid-90's to allow users to experience the utter joy of being in "cyberspace," which consisted of floating around gigantic neon cubes and cones. All the "cool" movies in th
  • by ilmdba ( 84076 ) on Sunday November 27, 2005 @12:15PM (#14123954)
    support for this sort of stuff seems like bloat to me. i mean wasn't the whole idea behind firefox to get away from the "hey let's jam everything we can possibly think of into one browser app" idea that was bogging down mozilla?

    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.

  • by Nevenmrgan ( 826707 ) on Sunday November 27, 2005 @12:20PM (#14123971)
    Works much faster on Camino 1.0 than in Firefox 1.5 or Safari. Smooth enough to "play" on a 1.5GHz G4.
  • by Neillparatzo ( 530968 ) on Sunday November 27, 2005 @12:21PM (#14123976)
    And of course this technology will NEVER be used for ads.
  • adblock adds tags to simplify blocking canvas tags.

    I like the idea of an open javascript driven presentation engine. by by flash? doubtful, lets see harvey cartels N games written in javascript first.

    I like anyway.
  • by Miros ( 734652 ) * on Sunday November 27, 2005 @01:01PM (#14124186)
    And so Java3d takes yet another hit. It's always interesting and amazing to me that games in web browsers using things like java3d never really took off. It's probably all due to the loading times, and the ammount of content you'd have to send via http. I mean, look at modern games, one of the huge differneces is the ammount of memory modern video cards have for textures, hundreds of megabytes of textures. Could you imagine having to put that kind of strain on a webserver? It would simply be imposssible! While certainly neat, this will likely become an novelty. Even for things like demonstrations on websites of products, there's flash out there. But, i digress, yet another thing you can do via javascript hacks. Bravo! let the interoperability headaches abound....
  • Not just for games (Score:5, Insightful)

    by Lysol ( 11150 ) on Sunday November 27, 2005 @01:02PM (#14124193)
    I was just looking at the api and this has applications outside games. Think graphics programs; of course, nothing like Photoshop, but enough to allow doing images in a browser. Why use Dia as a standalone app when you can have a collaborative version in a browser?

    It's coming..
    • Collaborative image editing? Like in NetMeeting, MSN Messenger, Yahoo Messenger, and the late mPlayer multiplayer matchmaker?
    • by LnxAddct ( 679316 )
      Here [krenzel.info] is a cellular automata simulator I've written. Right now I'm working on a simulator for Conway's Game of Life, here [krenzel.info]. Next I'm doing an interactive whiteboard using AJAX and then I was thinking about a ray caster like the one in the article but a bit more optimized and possible doing textures. The possibilities with <canvas> are pretty significant, I think we're on the verge of a web revolution.
      Regards,
      Steve
  • Isn't "canvas" the Dutch word for make your own fun [google.com]?
  • by bombshelter13 ( 786671 ) on Sunday November 27, 2005 @01:39PM (#14124404)
    With progress like this, it shouldn't be longer before Firefox achieves full 'It runs Doom!' certification. Good job guys.
  • Try this (Score:5, Funny)

    by DrIdiot ( 816113 ) on Sunday November 27, 2005 @02:17PM (#14124569)
    Hold the space bar so you'll jump continually. Then, while holding the space bar, click on a window that isn't your browser (so the browser will lose focus). Then go back to the browser.

    Click on the canvas, and walk around. You've turned into a rabbit.
  • by TSTM ( 145574 ) on Sunday November 27, 2005 @02:53PM (#14124716) Homepage
    Will there be a support for canvas in IE7?

    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.
  • First thing I like about 1.5 is that SVG is now supported. The Second thing I like about 1.5 is the 3D Canvas FPS Engine. What will really win me over is if they offered VRML/X3D [web3d.org] support.

    I'm taking a peek at the source codes for this web page and they are very well written. He says it does not have much direction at this time. On the contrary. This project has much potential.
  • Firefox DeerPark latest 1.6a1 20051125 -> perfect, I wish WoW had the same frame rate... ;)
    Safari (OS X 10.4.3 with all standard updates) -> a bit slower...
    Shiira 1.1 -> same as Safari, maybe a bit faster (should have the same engine as Safari, though)
    Opera 8.5 -> Browser incompatibility... yadda yadda...

    Anyway I think the most interesting test would be some kind of IE7 on some Vista's Beta...
  • You can do a much better raytracer [ctho.ath.cx] with canvas than without it - previously you'd have needed a large table or many divs to display the image, but with canvas the output can actually be drawn properly.
  • What is this canvas element and what's it's purpose? It looks to me like a bitmap-based competitor to SVG or something, but built into HTML. Can anyone tell me what it's meant to be used for?
  • Wow (Score:3, Informative)

    by BejaminJoffe ( 934316 ) on Monday November 28, 2005 @02:14AM (#14127051)
    Gee thanks guys your gonna kill my server. It is a shock to see how much coverage this game is getting, this is the first 3D environment I have ever coded so it is pleasing to see that I am not the only one enjoying my efforts. When I ran my tests about 80% of the processing power was spent on rendering the trapeziums to the canvas which I have little control over. As far as I can see most of the math was fairly optimal, no obvious problems there. I will probably continue developing this in a few weeks when I am on holidays, probably by that time several people will have coded far more superior ones but I will see... The wedding business is my brother's, I don't have my own server. Here's another little code I made, not quite as interesting though: http://www.random.abrahamjoffe.com.au/public/JavaS cripts/canvas/interpolation.htm [abrahamjoffe.com.au]

Math is like love -- a simple idea but it can get complicated. -- R. Drabek

Working...