Tom Ortega II

Archive for the ‘Programming’ Category

Building Games with Flex: Tic-Tac-Toe V1 Code Explained Pt 2

In Flash*Flex*AS, Game Programming, Programming, Technology and Software, Video Games on October 3, 2008 at 8:24 am

In my last post, I explained my logic/thinking behind 2 of the 3 files that make up Tic-Tac-Toe V1: Main.mxml and GamePiece.mxmlClick here to play the game (right click to view/download the source).  In this post, I’ll breakdown the remaining piece.

GameBoard.mxml
This piece is the real workhorse of the game.  It houses not only the board where the pieces are laid out, but also the game logic itself.

Was that the best decision?

Probably not.  If I wanted to swap out the game rules but keep the same pieces, I couldn’t do that.  It’s not so common with Tic-Tac-Toe, but think of a card game.  One deck of 52 cards can play an almost infinite number of games.  Would it make much sense to put the Solitaire logic right inside the CardDeck class file?  Nope, it surely wouldn’t.  I was in a hurry though so I did. Read the rest of this entry »

Building Games with Flex: Tic-Tac-Toe V1 Code Explained Pt 1

In Flash*Flex*AS, Game Programming, Programming, Technology and Software, Video Games on September 30, 2008 at 8:37 am

Part of my goals with these posts is teaching Flex for those just getting started.  What better way to learn Flex than by building a game of Tic-Tac-Toe.  Code is code and lessons can be learned/shared despite the final output.  You’ll (hopefully) learn tricks and methodologies for helping you code non-game projects via the code that I share and explain in this series.

There are  3 files that make up the complete game (right click to view/download the source) :

  1. Main.mxml – This has the Application tag
  2. GamePiece.mxml – This is the X/O game piece
  3. GameBoard.mxml – This is the tic-tac-toe gameboard

I’ll go over the 3 files, explaining logic on why/what from both the Flex and gaming perspective. Read the rest of this entry »

Building Games with Flex: Tic-Tac-Toe Version 1

In Flash*Flex*AS, Game Programming, Programming, Technology and Software, Video Games on September 25, 2008 at 9:16 am

Getting Started

Note,  while this isn’t anything like PlayCrafter, it is my small step into the huge world that is game making.  To get into gaming, I figured it would be best to start with the language I use day in and out: Adobe Flex.  To be honest, I can’t remember the last time I coded just for fun with Flex.  Most non-Workday Flex code I’ve built on my own time has been for 360Conferences, for some technical training/presentation or for my articles on Adobe’s sites.  I forgot just how fun programming can be.

I set out late Friday night/early Saturday morning with one goal:  Exit the weekend with a working version of a game.  I didn’t want to put much game theory in.  I didn’t want to OOP the heck out of the code.  I just wanted to build something that I could play and post on the net to share. Read the rest of this entry »

Gaming: Playing both sides

In Business, Cell, Flash*Flex*AS, Playstation3, Programming, Technology and Software, Video Games on September 24, 2008 at 6:37 am

Being an OG – Original Gamer

For as long as I can remember, I’ve gamed (specifically the video kind).  Before I got married, I spent almost every birthday I can remember at Chuck E. Cheese’s (even my 21st!)  To me, birthday equated to gaming.  In addition to those special days, I have a lot of memories in life associated with gaming:

  • When I was 6 or 7,  I remember me and my dad going to our frequent hangout, an arcade down the street.  It was actually a miniature golf course, but we never did anything but game.  We’d play Vanguard together.  As you can see by this image, it had this unique setup.  It was one of the first games I can remember that had multiple buttons.  My dad would drive (use the control stick) while I sat shotgun (took control of the 4 direction shoot buttons).  Oddly, I think this contributed to my sense of it being okay to take the back seat for the greater good.  As long as the team wins, it doesn’t matter which position you play.
  • Read the rest of this entry »

Birthday Thoughts: Resource Utilization

In 360Conferences, 360Flex, Business, Community, Mac Pro, Playstation3, Programming, silvafug, Technology and Software, Workday on September 23, 2008 at 8:41 am

The phrase “Resource Utilization” has so many meanings in my life currently, that I have no idea where to start.

At Workday, I (relatively) recently got a new manager, Charlie Boyle.  One of his strengths is definitely resource utlization.  Every manager has their own style and no style is right or wrong.  However, Charlie has brought some great plans to the team.  He’s brought on some processes and tools that make our lives as developers more productive. I don’t think we as a team work any less harder, but we’re definitely working a lot smarter due to the resource management.

My Silicon Valley Flex User Group (silvafug) is sorting being revamped as I write this.  At our most recent meeting, several of us got together to discuss how to better the user group in a variety of ways.  After Wednesday’s meeting, we’ll likely be officially announcing the launch of Silvafug South (and by default, Silvafug North).  There are a lot of great people in the user group with great ideas on how to make it better for everyone.  I look forward to working with them. Read the rest of this entry »

Help me teach you Flex!

In 360Conferences, 360Flex, Business, Community, Flash*Flex*AS, flex training, Programming, silvafug, Technology and Software on July 28, 2008 at 11:14 am

John posed a question to me the other day: What’s important to you?  I’ll leave out the obvious answers: wife, two kids, and church.  He was asking more in relation to business and in particular, our business: 360|Conferences.  So I was noodling on an answer for him.

Saturday morning, I finally caught up on a thread on an internal Flex list.  The list was about a fairly common problem we have in the Flex world.  There seems to be a nefarious void that people learning Flex tend to fall into.  One where they’re beyond “This is a file.  This a tag, made up of brackets and text in between them.” and below “I just rewrote the AdvancedDataGrid component to run 50% faster.”  I have feelings in regards to how to help folks cross that void, so I started noodling a response to the thread.

Then it dawned on me, my two noodles were of the same type: helping folks grow and learn. Read the rest of this entry »

Future of ActionScript (via ECMAScript) and language talk

In Cell, Flash*Flex*AS, Playstation3, Programming, Technology and Software on October 30, 2007 at 4:47 pm

Josh wrote up a nice post on the proposed ECMAScript 4 language. He basically took the 40-page spec and ripped out the juicy parts for all to see.

It’s funny to me the path of languages. Every language evolves over time. This evolution includes supporting functions/classes that are found in older languages. These languages become all the rage, then become old and lose out to newer language upstarts. Those upstarts in turn then take the time to evolve and garner all the functionality of the older languages.

Granted, I’m simplifying things greatly. Sure each language brings something new to the table, lest why would we abandon the old ones to begin with? Things become faster and older concepts can be implemented in cooler, more efficient ways.

The things that I’ve been hearing lately is that horizontal scaling is becoming more important than vertical scaling. Meaning, instead of writing code that uses a processor at 100% for 1 second. You need to learn to write your code so that it can parse that work to 100 processors that take 10 milliseconds each to compute it’s part. That’s why I bought my PS3 last year. If life ever settles down long enough, I hope to be able to learn to how create apps that utilize all the cores in the Cell processor like the Interactive Ray Tracing (IRT) app. This youtube vid shows the IRT in action and visually shows each processor in use. Friggin’ sweet.

Yeah, Flash player is single threaded, but Flash/Flex ain’t everything, right? Plus, Adobe has smart folks. They’ll figure out something to utilize those multi-core processors out there, besides video encoding. 🙂

New Flex Blog to add to your Favorite Feed Reader

In Business, Flash*Flex*AS, Programming, Technology and Software, Workday on August 31, 2007 at 9:43 am

Workday UI Blog at http://workdayui.wordpress.com(feed)

As many of you know, I joined Workday, Inc. back in June. Many people have asked, “Where do you go after eBay?” Well, for this developer, it was a company that’s doing some crazy, exciting things with Flex. Workday is an ERP SaaS company. For our frontend, we use Flex.

The exciting thing is that Workday’s choice of Flex wasn’t on a whim. They specifically chose Flex because of the amazing things that Flex can do that traditional web apps cannot. Here’s our app in a nutshell. It’s a custom built Flex VM built atop of Cairngorm. A UI server sends us a view and a model, which we then render together on the fly. We, the developer, create low-level components that the application makers then use as building blocks for our products. Therefore, the things we do vary greatly from creating a custom component one day, to creating an effect on another or tracking a logic issue in Cairngorm. And I literally do mean day to day as those were my last 3 days. One thing you will never be at Workday is bored.

At eBay, my users were a group of 20. Here, it’s literally the entire company (138 people and still looking for more). I say that on two levels. First, it’s our HCM system. We use our product just like our customers to track employee data. Secondly, our products (HCM, Financials, Payroll, etc.) are built on inhouse tools. Those tools are the exact same system as the final product. There’s nothing more rewarding than walking around the office and seeing YOUR work on EVERY employee’s screen. It’s just awesome to know you empower not only end customers, but also your coworkers.

One thing Workday is looking to do is give back some of our knowledge and experiences back to the community. The way we will do that is by sharing items on the Workday UI Blog at http://workdayui.wordpress.com(feed). There you will find posts on hard hitting technical Flex issues such as Memory Leaks in Classes to lighter UI topics like Fun with Icons. The things we’re doing here are pretty amazing and I hope you follow along not only to learn from us, but to share your knowledge with us as well.

Saffron – My prayers have been answered

In 360Flex, Business, eBay, Flash*Flex*AS, Programming, Technology and Software on May 31, 2007 at 12:24 am

Ryan dropped a post on Saffron. Recently, I did a big write-up internally at eBay about a tool to help our XUNI development (Flex-based framework) go smoother when integrating with the Java folks.

In our current development cycle, I’d say 20 to 30% of our Flex dev time is building the actual Flex code for the UI parts, the remaining 80 to 70% is spent on integration. When you try to do concurrent development of the front and middle tiers, the part that suffers is communication and clarification of your data model. Let me show you the problem that we experience:

  1. Middle tier gives you a Transfer/Value Object (i.e. what gets sent from them to you that houses the data they have and you need) at the beginning of the project
  2. You (the flex peep) code to that object
  3. If you’re lucky, you get a stub web service call that sends you back one of these objects
  4. You test your code against the stub and tweak your code until it works perfectly
  5. Middle tier changes the object for justifiable reasons. However, due to schedule and delivery timeframe, they forget to inform you of the change and most definitely do not update the stub web service
  6. Integration testing comes and it doesn’t work obviously
  7. You tweak your code so it works with the new object
  8. After all integration bugs are solved, you hand it back to the Business Systems Analysts or user for a test run. They say the data is wrong and needs to change again
  9. Both you and the middle-tier folks make the changes and finally wrap up the project

Sound painful? Yes, it is. What would help is a tool that all parties (users, Business Systems Analysts, java devvers, Flex devvers, heck even QA) can use to visualize the data objects and spit out code for the front and middle tier developers to stay in sync with.

The parts of Saffron that I’m most excited about are:

  • Wireframe editor allows both developers and/or designers to create wireframes for their projects
  • Allows for Actionscript 2, Actionscript 3, PHP4 and Java Code generation directly from the app.
  • Enterprise level capability having the ability to support models with hundreds of classes without performance degradation
  • Integrated Version Control

I’ll admit that I don’t know Samuel Agesilas Paste personally, but if you do tell him to drop a line to info@360flex.com because the developer world needs him to speak about Saffron at our 360|Flex Conference in August!

Flash: Can get you rich and/or provide a better UI

In Business, Flash*Flex*AS, Programming, Technology and Software on May 30, 2007 at 10:10 pm

This is why I love the Flash platform. Jeff Atwood has two good posts (Yes, more Jeff, I tend to “catch up” on blogs when the post count gets high in the Google reader)

Post 1: How to Get Rich Programming

This is something that I hope to do someday. Hopefully, I’ll be as successful as Paul Preece with his Desktop Tower Defense. To be honest though, monetary success isn’t even a requirement. I’d be happy doing something like Snowcraft. That little game had me playing for hours back in the day, and still takes up too much of my time when I open it. (Yes, I realize that it was made with Director, but the same could be accomplished in Flash now.)

Flash is so incredibly good at creating fun little games. Heck, Flex can even let you build games as Joe’s Connect Four shows you. I think that’s why I like being a Flex programmer. While I may be programming “serious” apps during the day, I know that all that time put into coding is going to pay off someday. I’ll be playing with my boys and wham! Inspiration is gonna hit. I’ll quickly jot down the idea and all my flexy flashing knowledge will later help it take shape. Now, if I could just find where I last left inspiration.

Post 2: Zoomable Interfaces

This post deals with something that I’ve always felt is missing in UIs, zooming. I have to agree that it is by far the most intuitive thing to the human mind. We manually zoom to objects in our daily lives by walking up to them. Movies and photos all take advantage of zooming to play with our emotions. It’s just something we know intrinsically.

Adobe Lab’s JamJar app utilized zooming to create an ever expanding workspace. The best use case for this type of interface though is best explained in Aza’s talk at Google. He demos this little experiment that you should take for a spin. An hour into the talk is when he shows the tool. During the demo, he talks about how his dad was helping a company work with the medical field. Nurses were given a tool that let them zoom in and out from patient’s medical charts. When the zoomed in far enough, they were able to edit. It took the nurses 45 seconds to figure out how to use the system. That’s is sickly fast and all apps should dream of a 45 second learning curve. The nurses themselves then began thinking higher and said, “Don’t stop at just charts, zoom out to see the room, zoom out to see the ward, zoom out to see the floor, zoom out to see the hospital, zoom out to see the chain of hospitals.”

I’ve currently got two experiments going on in Flex. When I finish those two things, I’ll move onto a zoomable experiment. I can’t wait to do my take on this UI concept. If you know of other examples that use zoom very well, please post links in the comments so I can check them out.