Tag Archives: shiva

Day 5 with Unity

Four days down and I’m making some good progress with Unity.

I decided the best way to tackle learning Unity was to build a complete game from scratch, starting with the UI, and incorporating the plugins I purchased as I went along, to minimise the amount of work I’d have to do.

Starting on day one, I created a new project, added NGUI to it and dragged a few buttons into the scene to act as a main menu. To keep things simple, I wanted to avoid creating a different scene for each menu, and instead created all the menu panels in the one scene.

This presented a challenge because of the way Unity handles inactive objects. Once an object is disabled, it can no longer be found using Unity’s search functions. The developer has to store a pointer to the object in order to find it again, or it can’t be reactivated.

Based on my Googling, Unity developers have been complaining about this problem for many years. As I understand it, the built in functions for locating objects are considered to be very slow, so it’s recommended not to use them anyway. The workaround was to create a singleton class (also frowned upon by some, but it works) that held pointers to all of the important objects in the menu system, such as the menus themselves and specific controls on the menus.

With my global class in place, it was very easy to extend it to include user preferences such as sound or music volume settings, using the Easy Save 2 plugin.

I wanted to build localisation in from day one, so the next step was to add a language selection page to the menu and add Localizer Package. This is quite a clever solution as it uses Google Docs to store a spreadsheet that uses Google Translate to provide translations for key/value pairs in the first two columns on the sheet. Obviously, since it’s machine translation, the result aren’t always the best, but it’s better than nothing.

The easy languages to translate are Spanish, German, French, Italian and English, because they largely use the same character set.  To this I added Portugese which is quite a common language online and fairly similar to the others in structure. Russian is also popular, so I created a new version of my font to include the Cyrillic character set.

Beyond these European languages, things start to get a bit more difficult. Arabic and Indian both have a basic alphabet, so they aren’t too different to the others to work with, but finding a suitable font with the characters can be difficult.

The other major online languages, Korean, Chinese and Japanese are composed of thousands of characters, and because Unity stores characters as bitmaps on mobile devices, it’s nearly impossible to translate on the fly. The recommended solution is to “bake” phrases into bitmaps and use those, instead of text. For now, I’m just going to stick with simpler languages because I don’t want to have to limit the amount of text I have in my app.

At this point, I have to say that things are going quite well. I now undersand Unity’s internal structure, I’ve successfully implemented PlayMaker, Localizer Package, Easy Save 2 and NGUI into the application, and it’s definitely saved me time. I’ve even managed to build an Android version of the app and try it out on my tablet, and it works just like it does on my Mac.

The next step is to create the actual game part of the project, which is probably going to take another five to seven days, just to get it to the functional prototype stage.

Meanwhile, Stonetrip are still keeping secrets about what’s going on with Shiva. Presumably, they are working behind the scenes to emerge from receivership and open shop in Estonia, but who knows? Unfortunately, none of the users do, and it’s all too little, too late for me. I’ve already made the switch to Unity, and there’s no looking back now.

Unity3D vs Shiva3D

In the hours following the news of Shiva’s (temporary?) demise, I purchased a copy of the Indie version of the Android compiler for Unity. I already knew that it would be suitable for what I wanted to do, so it wasn’t really a leap of faith. The only real concern I had was how long it would take me to get up to speed.

It did take a few hours to wrap my head around the way scripting works in Unity, and although it does work, I find it a bit untidy. Because of Unity’s strict object-oriented design, everything in a scene is derived from a basic object, which then has numerous scripts attached to it, to grant it the properties and methods that define it. Shiva’s approach is to uniquely define the properties of every type of game object, and then provide a collection of functions to manipulate it.

While I find the structure messy, I can see the benefits of doing it Unity’s way – in particular, with 3rd party plugins. The standard objects that Unity provides can easily be enhanced simply by attaching scripts defining new methods and properties.

Speaking of plugins, Unity has lots of them, and many are high quality. Shiva belatedly acquired an asset store late last year, but due to the smaller community there hasn’t been many plugins added, and potentially useful plugins are largely API wrappers for iOS.

Besides the smaller user base, I suspect Shiva’s biggest issue is that the plugin structure isn’t very flexible. It’s not straightforward to integrate with Shiva’s API, especially trying to call back to the game API from a plugin. Plugins also have to be written in native code, not Shiva’s scripting language, which makes it hard for anyone who only knows Lua.

I started off browsing through Unity’s asset store, and despite tremendous willpower, my cart was repeatedly loaded up with the following add-ons:

  • NGUI: like Shiva, Unity’s default GUI needs some love. I’d written an elaborate GUI layout tool that used XML files for my Shiva apps and I didn’t want to go through that again. I’ve read that Unity will be getting an improved UI system, but since it’s not happening this week (or on any specific date), I’m going with NGUI. I doubt learning it will be wasted time, because Unity’s solution should be similar as they are both being created by the same developer.
  • Playmaker: Increased productivity through code avoidance. I had a bit of play with it today, and I can see that it could be very useful in many situations, especially prototyping.
  • Easy Touch 2.5: A package to handle touch gestures. It was only $20 and included a joystick which was a pain to setup in Shiva the first time I did it. I may still buy FingerGestures though, because it supports Playmaker, assuming I become a Playmaker disciple like so many others. One day perhaps, Unity might be considered an essential add-on for Playmaker?
  • Localization Package: An efficiently titled, simple method for handling basic app localisation. I’d actually written something similar to this for Shiva too.
  • Multi-platform Toolkit: Very important, and yet again, something I’d crudely implemented into my Shiva apps.
  • 2D Toolkit: Sprites! Another module I’d written for Shiva. I gave up on my sprites because Shiva hasn’t yet been given the ability to directly call functions in one script from another. Everything has to go through events, which are slow. This meant that in order to implement sprites, I’d either have had to write a plugin in native code, or copy all the sprite functions into the scripts that needed access to them, resulting in code duplication and maintenance issues. Couldn’t be bothered.
  • Rage Suite: After I’d bought 2D toolkit, I found out about this gem. 2D vector sprites, similar in style to Flash. I ended up buying the full pack, including Rage Spline and its add-ons, because I wanted the SVG importer which is going to save me a lot of messing around.
  • Edy’s Vehicle Physics: I bought this out of curiosity. The last thing I’d played with on Shiva was the vehicle physics demo that is supplied in the samples. Shiva’s version works, but would need a lot of work to bring it up to the standard of Edy’s, which also runs surprisingly well on mobile devices.

I started writing this as a comparison of Unity and Shiva, and it’s turned into a quick review of some of Unity’s 3rd party plugins.

At the end of the day, both Shiva and Unity do the same job. A Unity game might look more professional because of its shader support, but Shiva is easier for a novice programmer to learn, and it has better cross-platform support.

What really sets these apart are the 3rd party plugins, of which Unity has far more of far higher quality, thanks to the way it’s implemented and the larger user base.

In total, I’ve probably spent $500 over the past few days of testing. For that money, based on my experience, I’m convinced that I’m going to save myself many, many months of my time, which is incredibly important because the software industry moves so fast and I’m just a team of one.

Review: Learning ShiVa3D Game Development

The hard part for new ShiVa developers is getting familiar with the tool. It's very flexible and full-featured, but unless you come from a 3D programming or modelling background, its got a very steep learning curve because you may not know what to expect from it.

Learning ShiVa3D Game Development by Wade Tracy aims to address this by walking the reader through creating a simple 3D game, and exporting it as an Android executable that can be run on a phone or tablet.

Chapter one begins briskly with installing Shiva. Following this a project is created, a 3D spaceship model is imported and some code is written to create a scene when the game starts. This will become the framework that is built upon in later chapters, culminating in a playable game at the end of the book.

The second chapter focuses on navigating ShiVa's menu system and gives a brief overview of all of its modules. It also includes a reasonable summary of ShiVa's custom Lau programming language and some of its 1,500+ API commands. If you already have some experience as a programmer, then you shouldn't have much trouble with Lua, but if you are new to programming, then you may need other reference material when it comes time for you to write your own game.

A WIP shot of the game you'll be making

Chapters three, four and five go into more detail on the features that the book makes use of, such as sound and music, physics, lighting and particle effects like explosions or flames.

By chapter six, the game is largely complete and just needs to be tied together using a menu system, and in-game scoring overlays

The last chapter deals with converting the game into an APK file which is what runs on Android. This is handled by a separate application called the Authoring Tool, which can also export the app to many different platforms besides Android. Blackberry apps are easy to build using the Authoring Tool, but Apple requires iOS developers to use a Mac to build their apps for iPhones and iPads. Stonetrip has provided a specific version of the Authoring Tool that will run on a Mac, but this is not covered in the book.

I'd recommend ShiVa3D Game Development for people who are already have some familiarity with programming, but are new to 3D game development. Although it doesn't cover every feature of ShiVa, it does provide a good overview of what ShiVa is capable of, and what you can expect to be able to do with it. Even though the book specifically targets Android, nearly everything up to the last chapter is still relevant and useful for developers who want to work on Blackberry, Apple's iOS or other platforms supported by the Authoring Tool.

Learning ShiVa3D Game Development is available from Pakt Publishing or Amazon

A Berry busy day

Earlier today this blog and my app, Solar Explorer were both posted to CrackBerry.com, causing a spike in Playbook app sales (over 120 so far) and a big surge in traffic to this site.

Normally I’d see about 75 visitors a day, but in the last 11 hours there’s been nearly 1,000!

As a result I’ve been playing with the caching settings on the site because the it’s managed to chew through about 20% of a normal month’s bandwidth allocation.

It’s got a fairly big buffer, but it’s almost midnight here in Australia and I don’t want to wake up to a dead site.

If you’ve seen any strange behaviour in the past hour, don’t worry, it’s just me breaking stuff.

It should be working again now and I promise I’ll leave it alone for a bit.

Thanks to everyone involved, today has been a lot of fun :)

I’ll see what I can do about getting more Shiva devs to bring their native apps to the Playbook as well.

I know a few others are in the same boat I am, waiting for a Playbook to arrive to use for testing more apps.