Interactive simple 3D graphics for a website

Discussion in 'Mac Programming' started by toddburch, Apr 24, 2007.

  1. toddburch macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
    #1
    If I wanted to allow visitors to my website to interactively draw a simple house, by allowing them to specify room sizes (dialog box style), then have each room represented by a 2d or 3d graphic, and then allow the visitor the ability to drag the rooms into their preferred configuration, what prebuilt application options would I have?

    Steping further into the requirements realm, it would be nice to not allow them to do invalid actions, like overlap rooms or leave holes in the house where rooms should go, and also, I would like to be able to calculate square footage as they design the thing. Prebuilt rooms or other components (like doors or stairs) would be nice to have as well.

    The key thing here is leveraging "prebuilt" technology that would deal with cross-browser support, etc.

    Todd
     
  2. toddburch thread starter macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
    #3
    Good guess, but wrong.

    My middle name is "Mr. SketchUp!", and the only flaw in your answer is that SketchUp will not run in a browser, or over the net. It runs great on your local machine, and on your local network (if so licensed). It's not a web app.

    If it did, it would be the cat's meow.

    Todd "Mr. SketchUp!" Burch.
     
  3. Eric5h5 macrumors 68020

    Joined:
    Dec 9, 2004
    #4
    Take a look at www.unity3d.com. You can publish 3D web-browser apps that run on Safari, Firefox, and IE, Mac or PC. Users just have to download a plug-in once, like Flash. (The only caveat is that web-browser apps on Windows have a watermark unless you buy the Pro version of Unity, but it's not too obtrusive.) It's extraordinarily flexible and capable, and can accomplish exactly what you want, though it will take some programming. Currently you use can Javascript, C#, or Boo (which is similar to Python).

    --Eric
     
  4. Legolamb macrumors 6502a

    Legolamb

    Joined:
    Nov 27, 2006
    Location:
    North of where I'd like to be
    #5
    Kewl:cool: Now you've got your work cut out for you! What, it's like going to be hard for you?
     
  5. toddburch thread starter macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
    #6
    I think I will! Looks great. I downloaded the architectural demo and it's pretty impressive. I think I'll give them a call tomorrow.

    Thanks!
     
  6. Eric5h5 macrumors 68020

    Joined:
    Dec 9, 2004
    #7
    You're welcome. If you go for it, make sure to stop by the forums if you have any questions. I can tell you first-hand that the service is great, and it's probably my favorite app of all time. I could go on, but I don't want to start sounding like a paid advertisement or something. ;)

    --Eric
     
  7. toddburch thread starter macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
    #8
    I talked to the San Francisco office today. Quite helpful. I'll read all the doc on their website, and then download the trial. They said while this would not be a typical use of their software (the typical use being game development), it should work quite well.

    I'm pumped! (Not about having to get out the Javascript book - but about the possibilities!)

    Thanks again. Todd
     
  8. Eric5h5 macrumors 68020

    Joined:
    Dec 9, 2004
    #9
    Kinda funny that they would say that...while the primary purpose was game development originally, judging from the projects that people have actually been using it for in the real world, gaming has almost been secondary so far.

    But yeah, the possibilities are endless. :) You can take your concept as far as your time/budget/talent allows for. I'd say a no-frills version of the application outlined in your first post would only take several days or so to complete, assuming good familiarity with Unity. How long it takes to get that familiarity varies depending on your experience of course, but fortunately Unity is really fun to use.

    --Eric
     
  9. toddburch thread starter macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
    #10
    Eric, all the demos I've seen so far run (pretty much) full window, without any other HTML stuff (like a form, text, text boxes, or anything else for that matter). Is Unity the kind of app that can be (for lack of a better term) quarantined into a certain part of an HTML page (like an applet can)?

    I take it you are using it as well? What have you done with it?

    Todd
     
  10. Eric5h5 macrumors 68020

    Joined:
    Dec 9, 2004
    #11
    You can publish content with Unity in several ways: stand-alone apps, web pages, or Dashboard widgets. When you publish as a web app, it behaves essentially like Flash, with the content embedded into the page however you like. (Although users can manually switch to a full-screen mode by right-clicking on the area.)

    For example, this is a web-player of a commercial digital fishtank that someone completed recently. In fact they have Flash and Unity on the same page. This is a game that someone announced today (click on "try it now free" for the web player).

    I've been working on a few larger projects, but what I've completed so far has been small apps and games for some people locally. This is a silly game I made for a family member's birthday last year, in a few hours--obviously I spent that time on the game, and none whatsoever on the web page. ;) The attached pic is from something I did as a test for one of those larger projects, to see what sort of techniques I could use to get large areas and lots of objects, but still get good performance. (Which turned out quite successfully...typically between 70 and 200 fps depending on the detail, on my G5.)

    --Eric
     

    Attached Files:

  11. toddburch thread starter macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
    #12
    Eric - that birthday candle game is hilarious! (10,500 on my second play!) In terms of lines of code, (Javascript?), how many lines would say you coded up for that? Also, did you make the graphics in unity or import them from another app?

    Couple of things: (constructive feedback)

    1) It would be nice if it shot faster. Maybe cut down the reload time by 1/2. Is the reload time predicated on the sound file, or other parameters?

    2) When I finished playing, I left it up and came back to this Safari session to reply. However, whenever I moved my mouse into the bounding box of the game (that was hidden by this session), the mouse diappeared. The text cursor works & displays fine, but the mouse doesn't display, but it does work (which is tricky, 'cuz you can't see it!). Would that be a unity bug? (It failed the same way with Dashboard active too.)

    3) Not sure if this is the design, but the game started replaying after (either) a period of time with no attention, or, when I typed the spacebar in this session? Could it be that it might still be listening for keyboard events?
    (More investigating - yes, it's the space bar that starts it, when pressed in this session with the other session (not other tab, but separate Safari window) still open.

    4) The candle target is quite specific. I really didn't shoot out that many. Very tough to hit, and tougher as the game progresses.

    5) My son, the smarty-pants, just scored 11,700. Jerk.

    6) I'm guessing that "presents" count is based on how many aliens you successfully shoot. If so, it's not counting right. I had 8 or so alien kills, and it only counted 3.

    7) Aliens go faster as the game progresses - nice!

    All in all - a VERY good job! I was laughing out loud! (I'm not your typical computer game-playing aficionado. For fun on a computer - I write code!)

    I saw the fish tank yesterday. Very nice. I also saw the Danish Astronomer game. That seemed like quite an effort to put together.

    Todd

    (By the way - nice looking woods scene!!)
     
  12. Eric5h5 macrumors 68020

    Joined:
    Dec 9, 2004
    #13
    Unity's very object-oriented. What you do is write individual scripts for each object that you want to control, rather than one monolithic program. There are a dozen or so scripts in this case, ranging from just a few lines, to about 100 I think for the most complex. I'm too lazy to go through and add them up ;), so I'm going to guess around 300 lines total (yep, Javascript). The cool thing is, because of this approach, you can frequently take scripts from other projects and re-use them with little or no modification. There are three or four scripts for that game that I just ripped off from other stuff I did...saves work. :)

    There are a few 3D primitives in Unity (cube, sphere, etc.), but normally you create graphics in other apps. Unity is for getting everything to work together. The pipeline is fantastic...you can actually modify graphics or models while your project is running and immediately see the changes. There's no re-importing, either; you just save the file in whatever app you're using, and it's automatically updated in Unity.

    Good feedback, thanks. :) I had the idea to do that game almost at the last minute, so it didn't get any playtesting or anything. Yep, I also got complaints about the reload time from others. ;) The delay is just a variable that I could set to anything. I tried for something that would add some challenge, but it seems most people would have liked it to be shorter. There was also confusion about the presents count...I tried to explain a little in the text below, but it's still not clear enough. It's actually correct; it starts out at 3 and goes down by 1 every time an alien successfully makes off with a present, so you don't want it to hit zero.

    Possibly. Up until the most recent version, the mouse cursor would always be visible except in full-screen mode, and even then it's always visible unless you specifically turn it off. But now you can make it disappear in windowed mode as well, though it has the behavior you noted. If you don't turn the mouse cursor off, this won't happen. It might just be an OS X thing; I think this can happen with other games in windowed mode as well.

    Yep. It depends on how you implement the input events...probably the way I did it wasn't ideal for a web player.

    Heh...I use a gaming mouse as my usual mouse, and I was concerned that I was actually making it too easy. ;) Makes you appreciate the value of playtesting on a variety of different setups....

    Thanks! Unity makes it fun to make stuff like that. I love the built-in physics engine...when you shoot a UFO and the present tumbles onto the table, for example, that's almost completely unscripted. I just get rid of the UFO and let the physics engine take over, and gravity (plus mass, drag, friction, etc.) does the rest.

    --Eric
     
  13. toddburch thread starter macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
    #14
    Eric, I had another issue. I'm going to report to the unity forums, but wanted to get your feedback as well.

    I sent an email to my Windows machine with a link for your game (so my son could play). He installed the plugin as directed. When he went to play the game, the graphics came up, but no mouse cursor. When moving the now invisible mouse cursor over the menu bar options, (in windows) we could see them become blue as the mouse moved into them and then back out, but no mouse cursor.

    Closing the IE 6 browser window caused the PC (Win XP Pro Service Pack 2) to reboot, and then it was in a reboot loop. We turned it off and back on, and it booted correctly. Trying the game again caused the exact same behavior.

    Known problem? Something I did? (Normally, especially on Windows, I take the helm when new software is downloaded, but this time I let my son do it, and I didn't watch over his shoulder... ??)

    (BTW, on the Mac, he's scored as a high as 22,200 with only 4 candles to blow out. Now he's a braggart!)

    Todd
     
  14. Eric5h5 macrumors 68020

    Joined:
    Dec 9, 2004
    #15
    Not a known problem...I've seen it run on two different Windows XP machines, and everything went flawlessly, though I don't know exactly what version of XP was running in either case. I don't think there's anything your son could have done wrong, since installing the plug-in is an automated process. So yes, I expect OTEE would appreciate a bug report.

    These young'uns and their video game skillz.... :rolleyes:

    --Eric
     

Share This Page