tjlahr

Members
  • Content count

    2
  • Joined

  • Last visited

Community Reputation

107 Neutral

About tjlahr

  • Rank
    Newbie
  1. It's perfectly valid to leave your variables 'undefined' at the top of your scope. In fact, it's what the JavaScript interpreter does anyway though a mechanism called [url="http://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting"]variable hoisting[/url]. Devs often do this explicitly at the top of their scope in a single, comma-seperated list like this: [source lang="jscript"]function(){ var array, number, string; // or var array = [], number = 0, string = ''; // function body... }[/source] I prefer the latter method, because it helps the routine document itself. As for testing against null: I'd be careful. It's one of JavaScript's many quirks that null and undefined are strage cats and can behave unexpectedly ([url="http://bonsaiden.github.com/JavaScript-Garden/#core.undefined"]more info here[/url]). Everyone's needs are different but I would reccomend using if(typeof array !== 'undefined') if you must check for variable initialization.
  2. Beginning Water

    I'm excited about a game idea I have but I'm new to game development so I feel a little disoriented. I'm hoping somebody can help me with next steps... I'd like to write a game that gives the player control over a small watercraft in an endless body of water. It doesn't have to be visually realistic and 100% physically accurate. Imagine a toy boat in a cartoon ocean- basically that. The main problem I'm having is that, as I search around for information, most of articles about water either deal with water simulation (as in enormous particle systems modelling complex fluid dynamics) or water as a visual effect (how to create ripples and stuff like that). I've done enough research to understand that I'd like to fake this as much as I can. Some one on stackexchange talked about using 'force blocks', but I'm not sure what that means. In terms of experience, I'm a professional web developer and have a ton of JavaScript and Ruby experience. I also work with a handful of smart devs who could help out. But none of us have ever worked in 3D and don't really know where to being modelling this thing. We could build this in HTML5 canvas / JS but I think handling 3D in that environment is going to be tricky. Or, we could grab a game engine like Unity but, at this stage, I don't need a full bells and whistles system. My goal right now is to build a small piece of moving water and drop simple 3D models in it and have them bob in the waves. Does anybody have advice on: 1) What environment could get us setup with something like this without introducing the overhead of a full-blown "game engine" and 2) Any advice on how to simplify the water / watercraft physics as much as possible so that we can model them with relative ease. Thanks T