NetRef – New iPhone App

December 8, 2011 · Posted in code, iphone, projects, work · Comment 

NetRef is our latest iPhone app, published through LTZ. With NetRef, you can look up all default passwords and IP addresses for those new or old routers. Once you set up your router, you can use the built-in Ping feature to ping and test the connectivity of the router. The Ping feature also includes DNS resolution so you can ping a web address as well as a IP address.

We developed the app with the help of Jonathan Cost who has a strong expertise in networks and network hardware. Check out http://netrefapp.com to download the app. We’re always adding more routers and features, but if you have any feedback, we’d love to hear from you!

 

Initial App Design

 

 

 

 

Router Manufacturers

Router Manufacturers

Router Detail View

Router Detail View

Ping a Server

Ping a Server

Reference Material and Tips

Reference Material and Tips

Router Manuals in PDF

Router Manuals in PDF

All models available

All models available

 

iOS Development Code Kitchen

December 6, 2010 · Posted in advice, code, iphone, projects, work · Comment 

I’ll be putting on a workshop on iOS and iPhone development this Saturday from 9AM to 5PM on the Virginia Tech campus. The event is free so if you’re in the area feel free to sign up:

http://www.ltzllc.com/2010/11/ios-development-code-kitchen/

The event will run all day and will be hands-on programming, but all levels of experience are welcome and encouraged to come.

Building a Game

July 9, 2010 · Posted in code, iphone, projects · Comment 

A lot of my peers went to school to become game developers. Instead, most went on to work for big software companies in northern Virginia. I studied human-computer interaction and wanted to fix everything from poorly designed user interfaces to frustratingly complex household items. Instead, I became a Mac, iPhone, Flash and game developer. In a way, we both went where the money was.

How to start your game

I’ll assume you already have a game idea. No matter how ambitious you want to be though, think in milestones

  1. Display some graphics.
  2. Animate your graphics, either manually, or with basic input controls
  3. Get hit detection working.
  4. Everything else! (level loading, artificial intelligence, etc.)

If you can even make it to the fourth milestone, you’re farther than 90% of most game developers. If you make it past milestone four, you’re farther than 99% of game developers. Only the passionate, motivated and able ship. This is how I’ve started all of my games and it’s important to achieve tangible results to keep yourself motivated. In fact, this same step-by-step process can be used in regular application development as well.

Design

Start your development with a skeleton application. This does one of two things: first, it forces you to plan the architecture of your application by creating the objects (in files) that you’ll need in your development and second, it provides an outline for you to work from. So first, think about what display controllers and object controllers you’ll need, what model objects you’ll need and then go ahead and create the files for those. Also go ahead and fill in some functions too for the basic functionality. The point is, make sure you break up the functionality into bite size chunks. It’ll make your life easier, trust me.

Put in the functions you think you’ll want and then just put in print or trace statements to make sure they’re being called correctly. Then, just build it piece by piece, usually starting with getting something like a player character on the screen (DisplayController, PlayerController, GameController), then getting him to move, moving him via inputs (InputController), then applying constraints like hit detection or getting him to jump (implementing basic gravity), etc, etc. Just keep introducing and implementing new features, one at a time, playing the game, realizing you want to tweak something and playing it some more. This is called iterative design.

Get those milestones done as quickly as possible, keeping your code organized in your skeleton application. Don’t worry about graphics at first. Personally, I stick in multi-colored boxes instead spending a lot of time on graphics I may not use in the end. Objects will be added as you realize you need them, but the idea is to keep it organized, simple and cohesive.

When designing your class structures and diagrams, keep the low level functionality, like file access and keyboard inputs, abstracted and hidden in wrapper classes. The reason you abstract objects is for a couple of reasons: One is to be able to add in hooks before and after a part of code. For example, instead of calling the system clock directly, you want to calculate the elapsed time if your game was paused or suspended on the computer. If you abstracted this in the beginning with a GameClock object, you’d only have to change it once, in a single place. If you called it directly, you’d have to go back to every place in your code and calculate that value. Keep object responsibilities where they belong!

Start Programming!

To start you off, check out a game template designed for the Corona SDK (free 30 day trial), written in Lua. I recommend you create a template of all your project tyes as it’ll help jump start your next big idea and also keep you organized from the start.

Naming Conventions – Why Your Code Sucks

July 1, 2010 · Posted in advice, code, projects · 5 Comments 

I’ve seen a lot of poorly written and ugly looking code in my time. That’s not even considering the undocumented and uncommented code. We all know we should comment our code but how many of us do it consistently? I admit, when I’m in a coding frenzy, stopping to write comments just gets in the way of my thought process and can be distracting. I will however write a bunch of comments before I write the code, of the operations I think I need, in order to give me an outline of where I need to get to. For example:

// Get URL string for video file
// Load video file from URL request
// Load video file into video player
// Set up video player
// Play video

I may not know all the APIs to load and play the video just yet, but at least I’ve given myself an outline and as I fill in the code below each comment, I can see exactly what I’m doing and where I need to go.

Why Your Code Sucks

The point of this article is not to talk about comments, but how to avoid writing them in the first place within your functions and still be clear for everyone else, for the most part. This is your code:

newPlPt = crt2pl( nmc.x, nmc.y );

Not even a comment could concisely convey the meaning of that hideous statement. Instead, why not:
newPolarPoint = cartesianToPolar( newMediaContext.x, newMediaContext.y );

Well written code is self documenting. Let me restate that: if you can write code so that someone can jump to any point of that code and understand what’s going on at that point, read it like a sentence, and not have to decipher minute details like what each variable means, then you don’t have to comment most of your code.

There’s no reason you need to shorten the names in your code. Most programmers have never had file size limitations to deal with, so there’s no reason for it. Stop pretending you live in the 1960s and embrace nearly infinite file storage. To save keystrokes perhaps? Please, use a real IDE with code completion and stop doing stupid things like:

public function updateP( p:Player, d:MovieClip, b:MovieClip, t:Textfield);

Function Names

Also, because your functions are essentially actions, they need to reflect that in the name, so put a verb in the beginning of your function such as: getData(), setStatus(), enableWiFi(), hideControls(), handleGraphicException(), launchBall(), etc.

Class Variables

Get rid of the underscores in front of your class variables. For example: _dg; _myNumber;. All class variables should be private anyway, so why do you need that ridiculous convention? It’s a hold over from C where there was no “private” keyword, so you’re using it and you have no idea why.

Also, what’s with the “my” naming convention? You sound stupid when you have those: myInstanceName, myMovieClip, myGraphicsContext. Of course it’s yours, whose would it be, if not yours? If you’re programming with a colleague, do you refer to his variable references as yourInstanceName? Or hisVideoFileURL? Of course not. Don’t be that stupid; you’re reading too many stupid online tutorials by uncreative people who only code because they have nothing else better to do while living in their parent’s basement.

In the very least, be consistent with your naming conventions.

Hungarian vs. Polish notation

Depending on which language you’re coding in,  you may need to use a notation to help you with type casting. Let me rephrase that: if you’re using a loosely typed language, use Hungarian notation. You should probably use this with strongly typed languages anyway because with abstract types, you never know what you could get into and it’s just generally less confusing.

Hungarian Notation: vendorNameTextField or vendorName_txt

Polish Notation: txtVendorName or textFieldVendorName

Why not Polish notation? Not only is it ugly, but why would I sort on variable type instead of the variable name like I can do in Hungarian notation? The notation names come from how the speakers of those languages modify their verbs and nouns. To say: “My ball” in Hungarian is:  “labdám” where “labda” is the root word and the ‘m’ singifies a first person possessive. Hence the ending of the word shows the crucial information. It’s the opposite in Polish notation where the beginning of the word is modified. In the interest of full disclosure, I love the Polish, but I am Hungarian, but I promise that’s not why I prefer one over the other.

Final Thoughts

In the end, be consistent, be clear and spell out your variable and function names.

Corona Game Template in Lua

June 27, 2010 · Posted in code, iphone, projects · 14 Comments 

This is a template I threw together for the Corona SDK from Ansca Mobile. Since Lua is not a language most people are familiar with, I figured I’d throw together some sample code for Corona and share what I learned so far with the rest of the Corona SDK community by including the template here.

The template includes example code for:

  • Display groups
  • Orientation and accelerometer
  • Touch with buttons
  • File reading
  • Example level file for scripting game play

The template separates functionality into modules for an object oriented approach. I’m still learning the techniques for Lua, so if you notice a better way to do it, please don’t hesitate to let me know in the comments below. Some things in the template are not the best way to accomplish some things, but should give people a good idea on best practices of software design. This will also with work Corona’s Game Edition.

If you find the template useful, take a look at some of our current applications to support us. It’d mean a lot.

Download the Template Code

Also, check out the links on the side. Thanks!

Next Page »