Unity3d 4.0 beta first reactions

Downloaded and installed the Unity3d v4.0 beta this last week and thought I’d write up a few notes based on what I’ve tried so far.

I haven’t used many of the new features yet (I haven’t purchased an official upgrade and so lack the iOS support I need to actually switch in earnest), but it seems to be quite solid (no new crashes so far), though it doesn’t fix the issue I’ve run into on my MacBook Air (HD3000 graphics) where Unity 3.5.x will hang or crash. Same thing happens with v4.0 beta, unfortunately. ¬†ūüė¶

My first suggestion is: if you want to keep 3.5.6 you need to rename your 3.5.x install before you install the 4.0 beta because otherwise the beta will erase and install over your 3.5.x install of Unity. ¬†Remembering just after you hit the install button and hurriedly switching to the Finder and renaming it isn’t good enough – the installer must save the FSRef or something because it’ll overwrite it in the non-default name in this scenario (whoops!).

@aras_p helpfully tweeted to confirm that renaming the Unity folder first should work, but I’ve not had a chance to test this yet.

The UI changes mostly seem like nice improvements, though the change to the Project View make it take up more screen space and on a 13″ MBA that’s unfortunate. ¬†I’m not totally sure I see the motivation for the change and it feels weird to me as an OS X user – maybe it’s modeled on some Windows UI convention? ¬†The decrease in screen space efficiency is definitely less than ideal for small laptop use in any case.

I was pretty excited to see the Terrain Engine getting some improvements. ¬†In particular the mechanism to use your own shaders more easily was something I really needed/wanted. ¬†Unfortunately it’s undocumented in beta 5 and while I figured out some of how it works and how to use it, enough of it remains a mystery that I’ve not yet figured out a solution that would allow me to use the Unity built in Terrain Engine instead of creating my own. ¬†The biggest hurdle is that I’m not seeing how to get the base image to stop being drawn or to let me render a base image that matches what my firstpass shaders is drawing.

Our game didn’t take much in the way of modifications to work with 4.0 which was a relief. ¬†The only change I really had to make was the change in GameObject.active and the way that game object activation works (all ancestors must be active for a child marked active to be actually activated). ¬†We are using activation & deactivation of various versions of character meshes for LOD purposes and for switching to batchable static meshes when there isn’t animation for performance. ¬†So this change to the way active state works was something we had to work around. ¬†From the Unity3d 4 beta release notes:

We have changed how the active state of GameObjects is handled. GameObjects active state will now affect child GameObjects, so setting a GameObject to inactive will now turn the entire sub-hierarchy inactive. This may change the behavior of your projects. GameObject.active and GameObject.SetActiveRecursively() have been deprecated. Instead, you should now use the GameObject.activeSelf and GameObject.activeInHierarchy getters and the GameObject.SetActive() method.

Less than an hour to fix and no other problems with the upgrade – nice job Unity devs!

Now if I could just get that HD3000 bug fixed and more documentation on the Terrain Engine so I can turn off the basemap drawing I’d be one happy camper!

Compute Shaders look interesting, but the documentation implies that they’ll only work on Windows computers (despite mentioning OpenCL which we have on the OS X). ¬†So I’m confused if they work on OS X or not. ¬†With 4 core GPUs on the iPad 4 it would be interesting to have these work on mobile devices where appropriate also (or perhaps it’s never appropriate?).

Multiple new items in the menus relating to Animation so that’s something I need to look into, though I don’t expect it to be useful for our current game.

So, what’s got you excited about Unity3d version 4?

Summer Game Project meets goal!

So anyone who’s following us on twitter (¬†@GeekAndDad¬†) probably knows we decided to spend the summer making an iPad version of a game designed by our neighbor (a game designer with significant experience designing and publishing successful games – can’t say more until after GenCon 2012¬†!). ¬†It’s been a HUGE project since we let him talk us into doing 3d (we liked the look of Unity3d so it wasn’t hard for him to convince us). ¬†We’ve learned a ton and our goal – a playable demo in time for GenCon 2012 – was ambitious, to say the least.

I am happy to report today that we’ve delivered a build that we think meets this goal! ¬†It’s not pretty (Unity’s default terrain is kind of ugly), and it’s perhaps a tad simple in places, but on the other hand it has a ton of functionality and is a playable 3d game with some moderately complex game mechanics that make it interesting to play. ¬†Need some usability improvements to reduce friction and some performance improvements but I think it’s getting really close to being “Fun!” which is exciting. ¬†The artists we hired to do the 3d models have done a great job and the in-game characters are both cool and fun.

Turns out we finished just in time since Geek is heading off for his annual summer-traveling-with-mom and GenCon 2012 is NEXT WEEK! ¬†So, time for a few bug fixes, some polish, oh, and maybe we’ll try to sneak in “just one more character type” which just happens to have custom combat rules and‚Ķ well, you get the idea ūüôā

Hope your summer projects are going well also!

-Dad

Unity3d GUI.Label and GUISkin bug (in Unity 3.5.3)

Use a Custom Styles style in a Unity3d GUISkin for GUI.Labels to work around a bug in Unity3d with the default “Label” style.

Just ran into this apparent bug (which I reported to them) in Unity 3d v3.5.3f3 which I thought I’d document. Work-around included:

If you create a GUISkin and customize styles to use 24 point font GUI.Box and GUI.Button work as expected but GUI.Label does not pick up the font size set in the GUISkin.

The work-around is to use a Custom Styles gui skin style, in this case “myLabel” and then specify that to the third parameter to GUI.Label:

if ( GUI.Label( r, "hello", "myLabel" ) ) { ... }

will work and pick up your font size properly.

onward!

(A sample project demonstrating the bug & work-around is available here).

UPDATE:¬†So, I ended up tracking this down and found that it’s the “Word Wrap” checkbox that causes the font size to be ignored. ¬†You can use the default Label style as long as you uncheck the “Word Wrap” checkbox. ¬†Clarified the bug with Unity so hopefully they’ll fix it sooner than later since Word Wrap is rather useful…

UPDATE 2:¬†Turns out iOS doesn’t support dynamic fonts so to actually get the larger sized fonts there you have to import a font and set your GUISkin to use that. ¬† Readable GUI elements on iPad 3 – yay!

Unity3d debugging trick

So Geek was just trying to track down a bug with calculating collisions between units in our game.  In order to track down the points he was calculating as part of the collision detection during move he used Gizmos in Unity3d speak.  This is a very handy feature.

So at the start of the script file he created a couple of variables:

public var gizmoPoints : Array;

function OnDrawGizmos()
{
  Gizmos.color = Color.red;
  for (var point : Vector3 in gizmoPoints)
  {
    Gizmos.DrawSphere(point, 0.21);
  }
}

Then in the in the method where he does the move path checking via¬†Rigidbody.SweepTestAll there’s code like this:

...
gizmoPoints.Clear();
for (hit in hits)
{
  gizmoPoints.Add( hit.point );
  ...
}

So the idea is that for each point he found in from the sweep test gets added to the array and then if he has Gizmos turned on in the Unity3d Scene view he can see what points the sweep picked up on. ¬†Geek also had it draw the point his algorithm had picked as¬†the¬†best point in a different color so he could see where in the swarm of possible points his algorithm was picking the best point. ¬†Once he could visualize what was happening this way he found and fixed the bug in less than 10 seconds. ¬† Very useful trick to help visualize what’s going on. ¬†I’d used Gizmos once to actually draw the ray of a raycast as a debugging tool previously so this is now the second time this technique has proven useful. ¬†Recommended.

Geek Art: Geek & Dad Engine Room

Geek & Dad’s engine room.

This is the engine room here at Geek & Dad corporate headquarters…

Okay, just kidding, this is a picture I made with Bryce, a 3D modeling program which is currently free. This is the¬†fictional engine room here at Geek & Dad corporate headquarters.¬†Game engine room, that is. This is where we keep the game engines we’re experimenting with. Here you can see cocos2d-iphone, cocos2d-x, and Unity3D, which we’ve been considering for one of our projects.

How many iPads of each model have been sold?

As part of the performance tests Geek & I did today, we looked into how many iPads of each model have been sold. ¬†We’ll know a lot more once Apple announces their 3rd quarter results (April 1 – June 30, 2012), but based on their press releases it looks like the numbers are (very roughly):

  • iPad 1 : ¬†15M+ (somewhat over 15M) sold total before discontinued.
  • iPad 2 : ¬†46M+ (approximate as of 3/31/12, iPad 3 went on sale 3/16/12. The iPad 2 is still for sale at reduced price).
  • iPad 3 : ¬†6M ¬†(approximate, as of 3/31/12).
Largely based this wikipedia entry¬†and the last two quarters of Apple reported results (didn’t go back and look at every one of the apple reports).
During the last two quarters Apple sold:
 Q1 Р15M iPads during the quarter ending Dec 31, 2011 (all iPad 2)
 Q2 Р11.8M iPads during the quarter ending March 31, 2012 (mostly iPad 2, 3M-6M iPad 3 judging form news reports. Note that this is traditionally their slowest quarter)
So we pretty clearly need to support the iPad 2 and newer, which, as it turns out, shouldn’t be too difficult if you look at the performance numbers in Geek’s blog post from today.

Cocos2D-iPhone Performance tests

So, I did some tests of cocos2d’s performance as a preliminary to a summer project. I created a 1-layer max size isometric tmx map (16k tiles) and randomly placed z-ordered animating sprites over it (with no CCSpriteBatchNode), then scrolled around. Below are the FPS on a variety of test devices (arm6 is no thumb, arm7 compiled to thumb; Xcode 4.2.1, LLVM-gcc):

Device 100 Sprites 600 Sprites
iPad 1 17-21 8
iPad 2 60 55-60
iPad 3 60 60
iPhone 3GS 50-60 27-30
iPhone 4 60 25-40

TMX map to 3d unity models via python and Blender…

Geek spend yesterday afternoon writing a quick prototype python script that takes as input a TMX tilemap from Tiled and turns it into a 3d OBJ file that Blender can import. ¬†He decided that the TMX tilemap should be setup so that each layer is at a particular z value and he’s making voxels out of each “tile” with a fixed thickness, just as an initial test. ¬†The script also makes a materials file out of the TMX file tile image file and applies that to the voxels. ¬†Seems like a pretty cool idea to me. ¬†Here’s his very first test picture (click to enlarge):

Script generated 3d model from TMX tilemap file and tiles, imported into Blender

I’m hoping he’ll write a tutorial on how to do it, but the basic idea is that he’s reading in the TMX tilemap file and parsing it one layer at a time, outputting the coordinates and materials references in OBJ file format as well as generating the appropriate materials file. ¬†Relatively straight-forward, but not something I would have thought to do.

Update 1/14/2011 –

Geek played with this some more today and added support for hexagonal tile TMX tilemaps. ¬†Here’s a first test image:

Hexagonal TMX tilemap conversion to 3d model first test

Update January 30, 2011 –

Geek’s been playing with this more over the last couple of weeks and he’s got support for using TMX tiles to indicate placement of 3d models instead of just expanding tiles into the third dimension. ¬†A config file specifies what model file to use for each tile id. ¬†First tests of that were trees, and today he’s added initial support for castles (battlements are tricky!).

All 3d models are just quick test models and textures likewise are whatever he could find for free on the net. ¬†The underlying technology he’s created that takes the TMX file, config data, texture files and 3d models and converts them into an OBJ file with materials, textures and 3d expansion of the 2d TMX file should work with more “real” parts.

Here are a couple of images from Blender after importing the OBJ files his python code has generated from the TMX files:

3d tree model replacement test on extruded hexagonal tilemap
Test castle with battlements 3d model insertion into extruded 2d hexagonal TMX tilemap

Geek & Dad’s new favorite tabletop game

So grandma gave the family Bananagrams for Christmas this year and it has rapidly become our favorite tabletop family game. Fun to play with just Geek & Dad, and also fun with Mom for a three player game.

The fun part is that we are all about equal in skill so there’s a real challenge for everyone! ¬†In this game Dad won, but only because Geek got some tough letters all at the end.

Game 1 - Dad
Game 1 - Geek

The other thing that helped Dad was that his layout was very spread out and this makes for more places to attach words.

Geek gets some serious “woah” credit for his complex multiword interplay, but in Bananagrams that doesn’t necessarily end up being a winning strategy.

As you can see, Bananagrams is sort of a free-form Scrabble or crossword type puzzle game and it’s all about using all your letters first. ¬†However, you keep drawing new letters whenever someone uses up all their letters until there are not enough letters left for everyone to draw – and then it’s next person who finishes WINS!

One tricky aspect of the game is that you can toss back a letter that is giving you a hard time. ¬†In the second game we played, Geek used this strategy near the end to foist the Q off on Dad, even though Geek had all the u’s except for one! Very mean, er, effective! ūüôā

Here’s Dad’s hand for the second game, and as you can see, all is good except for that darn Q which Dad picked up as his very last letter!!! ¬†aarrrgggg!

Game 2 - Dad
Game 2 - Geek

Now with Bananagrams it’s not necessarily a big deal to pick up a difficult letter because you can tear apart what you’ve built so far and completely rebuild, which is what Dad was about to do after picking up that Q, but then Geek cried “done!” ¬†sigh. ūüôā

Next you can see Geek’s winning layout here. Got some great words there Geek!

One of the best parts about this game?  It was created by a family for their own entertainment and only became a commercial game after their friends urged them to produce it!  Indie Dev Рnon-computer style Рbravo! (story here)

Dad really likes the fact that they didn’t go “cheap” with the production aspects of this game. ¬†The banana bag that holds the letters is well made from cloth (not plastic) and the tiles are weighty like quality dominoes and feel good to hold and manipulate. ¬†A big company might have used light weight plastic that was too easily bumped out of position and felt wimpy and annoying. ¬†Not these – very nicely done.

All and all, Bananagrams gets the coveted¬†G&D Recommended rating. ūüôā


Update (January 8): so all three of us played using both the standard rules and Bob’s suggested alternate rules and we have to agree that we like his alternate rules quit a bit! ¬†Really does encourage longer words and that makes for a nice additional challenge. ¬†Here are some pictures of some of the best of the 4-5 rounds we played:

Two amazing words by Geek - 341 record score
Dad's hand - 288 (too many free letters) - Geek Wins!
Geek got some tough letters there at the end! But wow, what a great big main word!
Dad's best hand of the night; double win, but only 314 points

Geek present: tools for making trading cards!

Geek’s been working on this trading card game off and on for a year at least and he’s finally gotten XM3RPG (more on that later) finished enough to get back to the trading cards. ¬†He’s been using normal paper printed test cards and playing with a few friends to play-test the game but cutting all the cards out with scissors¬†is a pain and it’s hard to make them even so he really wanted a paper cutter this year for a gift.

Good paper cutters are made of metal – don’t get the plastic because the torque of the cutting arm always breaks them at the joint between the cutting arm and the plastic base. ¬†Yes the good ones do cost more, but this one we got wasn’t so bad: ¬† Dahle Vantage 18″ Paper Trimmer (Amazon link benefits G&D – Thanks!) and he has been asking for a long time and is ready to take this out for play-testing in public and wants a higher quality prototype for that.

picture of the new paper cutter

After pricing professional printing services, color copying and printing our own, Dad also sprung for a Brother HL-4150cdn High-Speed Color Laser Printer and a ream of Hammermill “Color Copy Digital Cover” 100lb 8.5″ x 11″ paper (the heaviest FedEx/Kinkos had – they had 110lb paper, but the 100lb coverstock was thicker and stiffer, also smoother, more glossy). ¬†Cost more at first, but will allow us to retire the expensive-to-feed inkjet whose cartridges gum up with disuse and increase their operational cost even more.

This printer can be setup to have a straight print path using the manual load paper feed on the front and opening the back to prevent the turn to deliver the paper to the top of the printer. ¬†Driver for Mac OS X 10.6 seems to work well (access to duplex options, print quality and color settings, “Thicker” paper setting, and so on).

Here’s a picture of some finished cards, a sheet of uncut cards, and a ream of the paper we are using:

picture of printer, paper, uncut page, cards and sandpaper

If you zoom in ¬†you’ll see a clue to what that stuff to the right between the finished cards and the ream of paper is for ūüôā ¬† See it? ¬†NO? Ok, I’ll tell – it’s 100 grit and 220 grit sandpaper! “Huh? What for?” you ask. ¬†Dad piled all nine cards together and held them tightly near each corner while using the sandpaper to round the corner as a test. ¬†Happy to report that it worked pretty darn well! ¬†Dad will likely build a jig with two card shaped pieces of wood to use as end-pieces on either side of a stack of cards (maybe 30 at a time?) and then use a wood clamp to clamp it all together. ¬†Then we’ll try using the random orbital sander to “zip zip” and get a pile of rounded cornered cards!

Observent readers will notice that the cards are all the same and that they have a placeholder image of a gem on them. ¬†Yes, this is a gem based trading card game and these are topaz gem cards in particular. ¬†In this game the base gem cards are like “land” cards in that other trading card game in that you need a lot of them to play with the more interesting cards. ¬†More details when we’re ready to release this. ¬†Considering trying a kickstarter project to fund a professional card printing run to get high quality cards and reasonable per-card cost.

Pretty fun stuff. ¬†Geek is hoping to get 10+ decks put together tomorrow so we can take them to Guardian Games for a public play-test with people who might be willing. ¬†We’ll see if we can get this all together by 3pm! ¬†The rules still need to get written down, cards printed, cut (that’s the time consuming part), the corners rounded and actual decks built. ¬†Should be a busy day! ¬†Perfect winter break funky weather activity though.

Oh, making the card pages to be printed? ¬†Well, that’s a bit complicated… see it started in Pages, spent time in filemaker (when a database seemed better for management as the number of cards grew), then back to pages, through a spreadsheet (Numbers & Excel both actually) and then through BBEdit (to create XML) and finally to a python program that takes the XML files, the image files and builds pdf files from them. ¬†Then we open those in Preview and print them 9 per page. ¬†This evolution was over six months as the project as grown. ¬†Dad’s already starting to design a cocoa app to do all this more easily, but he’s got a game to finish first!

BTW – this printer¬†does a great job on black and white text. ¬†And the color is quite good. ¬†Haven’t tried photos on photo paper yet, but photo printed just to plain xerox paper actually looks pretty good. ¬†Certainly as good a the expensive color copier at Mom’s work. ¬†Very vivid color, quite fast (once it warms up), and a reasonable cost laser color printer – nice! ¬†It’s also a duplex printer and has ethernet. ¬†The HL-4570cdw adds the wireless networking and maybe a little faster. ¬†Didn’t have on in stock at Office Depot and they were $200 more expensive. ¬†So Dad observed that ethernet cables are cheap and got the HL-4150cdn ūüôā

What was the Mom doing while Dad was getting this setup and tested and Geek was at a big gaming party at a friends house?  THIS:


kitchen counter mess

Yep, making a terrible¬†MESS in the kitchen! ¬†I even had fragments in my water glass back next to the cookie jar! ¬†Luckily it was all for a good cause…

picture of Truffle filling cooling

What’s that you say? ¬†Why it’s¬†Truffle Filling cooling – YUM!!! ¬†Yep, she’s making home-made truffles again (with that giant chocolate bar Dad posted a picture of to twitter if you happened to see it awhile back). ¬†These are Earl Gray tea steeped in whipping cream and chocolate filling which will either be dusted in cocoa or dipped in pure chocolate – I have to figure out how to get on her xmas list! ūüôā ¬†She even got these cute little mini-take-out style boxes to make truffle gift boxes:

picture of a pile of empty boxes to be filled with home-made truffles for Christmas gifts.

Busy evening!