Skip to Navigation | Skip to Content



Cube Defense! (WebGL TD Game) | November 6th, 2009

This is a playable demo of a game I’ve been working on with WebGL. As per usual, this will only run in WebKit Nightlies build. No bias or anything, but WebGL runs too slow for the game to work in FireFox Minefield. (It will work in both WebGL enalbed WebKit and Firefox, but WebKit will perform better.) This is also my first take on trying to make a tower defense style game, so don’t expect too much.

Posted in WebGL, fun, game, javascript, openGL | 23 Comments » | Add to Delicious | Digg It

This entry was posted on Friday, November 6th, 2009 at 7:22 am and is filed under WebGL, fun, game, javascript, openGL. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

23 Responses to “Cube Defense! (WebGL TD Game)”

  1. Alexei Says:

    Wow.. that is pretty damn cool Yohei. wow. If you could just work Chuck Norris into that.. it would be perfect.

  2. Tweets that mention Yohei Shimomae’s Blog » Blog Archive » Cube Defense! (WebGL TD Game) -- Topsy.com Says:

    [...] This post was mentioned on Twitter by Shazron Abdullah and Fil Maj, rob_ellis. rob_ellis said: HOLY COW - Check out this WEBGL Demo Yohei put together 3d Tower Defense http://blogs.nitobi.com/yohei/?p=62 #webgl #nitobi #awesome [...]

  3. Jim Pick Says:

    Congrats! This is the first really playable WebGL game I’ve seen.

    The interface for placing the towers seems a little confusing, but it works!

  4. semanticist Says:

    There’s a bug in selling towers; it will also remove all towers after the selected tower in towerArray. You should use towerArray.splice(currentIndex, 1);

  5. WebGL around the net, 9 Nov 2009 - Learning WebGL Says:

    [...] Shimomae has come up with another excellent demo, a game called Cube Defense. Sadly it’s WebKit-only — it works on Chrome and presumably Safari, but not on Firefox [...]

  6. WebGL Musical Solar System | Buddy's Blog Says:

    [...] been some nice progress around the web as well, most recently with Yohei Shimomae’s Cube Defense, a tower defense like game built with JavaScript and WebGL - probably the first WebGL game [...]

  7. WebGL Musical Solar System | Guilda Blog Says:

    [...] been some nice progress around the web as well, most recently with Yohei Shimomae’s Cube Defense, a tower defense like game built with JavaScript and WebGL - probably the first WebGL game [...]

  8. Robert Schultz Says:

    Works for me in Firefox under Linux.
    Latest trunk as of 10 minutes ago

  9. Play Cube Defense, a WebGL Game Says:

    [...] by our reader Nox. Just like similar games, you have to build towers and defend yourself. Author recommends running it on latest WebKit nightly builds, as WebGL might run slow in other web [...]

  10. Mike Says:

    This is not working for me…

    WebKit Nightly r50918, Safari 4.0.2 (5530.19, r50918).

    I get: ReferenceError: “Can’t find variable: CanvasFloatArray” in in utils3D.js at line 163

    OS X 10.5.8, build 9L31a.

  11. yohei.shimomae Says:

    I just updated it so it should work in the latest WebKit now.

  12. Tower Defence Games Says:

    Just to let you know man, I get some error when I try to play this video … My browser is FF..

    Cheers

  13. nemo Says:

    Hey. Just wanted to mention a couple of odd bugs. Was going to visit your website but it is some flash thingy that does not degrade gracefully in w3m (all I can use right now), at all.

    1) almost immediately after initial edit/creation of a tower I get a grey tower radius superimposed on the game for the rest of the game, whatever I do

    2) I was doing some rapid building of towers when screwing around on lvl 1 and somehow I got $.5

    The screenshot below shows both of these issues. The 2nd smaller circle is the bug circle.

    http://m8y.org/tmp/cube_defense_alpha_bug.png

    Apart from that, awesome demo, way cooler than the stuff in:
    http://khronos.org/webgl/wiki/Demo_Repository

    BTW, that game in the screenshot is still running. I’m curious how long it will take them to overrun the defenses. Right now they are on wave 143 and I have $17,351,167 to spare.
    BTW, so awesome to be able to edit/copy the text portions. I like how you overlaid HTML on it like that.

  14. nemo Says:

    The grey circle is remaining from editing, and can be dismissed on certain circumstances. It appears to just be an artifact.
    The simple solution would be to make sure it is hidden when editing is complete.

    Another odd bug, at least in Firefox nightly, is the bullets “twitching” as they flight out in space, their coordinates jerking a bit.

    At this point I’m just curious how far the first round can go, and what will happen as the numbers get large.
    Phase 214
    Life 6
    $ 601158838
    Bonus 5%
    Score 943180

  15. nemo Says:

    Ah. The .5 was most likely from selling… Nevermind.

  16. Interfaces riches > De la 3D à toutes les sauces pour 2010 ? Says:

    [...] voir des expérimentations d’applications en 3D temps réel dans le navigateur comme ici avec Cube Defense : Un jeu de tower defense dans votre navigateur avec [...]

  17. nemo Says:

    Heh. Still watching this game suck up my CPU out of curiosity…

    Phase 475
    Life 6
    $ 205405585683149
    Bonus 5%
    Score 4560340

    BTW, another bug I’ve noticed, on and off, past few days is sometimes the shapes seem to get “stuck” on either bends in the path or edges of cubes. They kind of jitter there without moving until they are destroyed.

  18. nemo Says:

    Phase 614
    Life 6
    $ 181102692892726700
    Bonus 5%
    Score 7606000

    The attackers that get stuck are almost always the light blue. They either keep bouncing forever at the first bend, or else at the edge of the cube face.

    Maybe the movement increment is large enough because they are so speedy that it keeps triggering a collision check that kicks them back, and they keep repeating it forever.

  19. nemo Says:

    Just kind of watching out of curiosity to see if the game can ever end.
    Anyway, here’s a screenshot of stuck attackers.
    http://m8y.org/tmp/cubedefense.png

    In order to see the ever inflating currency, ran following:
    javascript:var x=document.getElementById(”hud”).getElementsByTagName(”div”)[0];x.style.width=”230px”;var y=x.getElementsByTagName(”div”)[6];var z=x.getElementsByTagName(”div”)[0];z.style.width=”50px”;y.style.width=”165px”;void 0

    Otherwise the game hasn’t been touched in a month.

  20. WebGL Musical Solar System - Wasif Hafeez Says:

    [...] been some nice progress around the web as well, most recently with Yohei Shimomae’s Cube Defense, a tower defense like game built with JavaScript and WebGL - probably the first WebGL game ever but [...]

  21. nemo Says:

    Well, about 5 weeks later, they finally broke through.

    Phase 773
    Life 0
    $ 423665851676042900000
    Bonus 5%
    Score 12027900

  22. Pepper Spray Says:

    Phase 753…dang it Nemo beat me!

  23. Simple Says:

    Well, is this not supporting?? It doesn’t work on chromium or firefox… T.T

Leave a Reply


Search Posts

  • Links

  • Categories