Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon
15. July 2013

 

In the previous tutorial we looked at how to export a model from 3DS Max to vForge.  This time, we are going to look at exporting a mesh, then explore the difference between entities and static meshes.  As the title might suggest, components play a big part of the difference!

 

So in this tutorial we will cover:

  • Exporting a VMESH file from Max
  • Coordinate difference between systems
  • Creating a static mesh in vForge
  • Differences between Entities and Static Mesh Instances and when to use which

 

 

Exporting a VMESH file

 

 

First off, let’s look at how you export a VMESH file from 3D Studio Max.  We will be using the crate model we created earlier, but you can use whatever object you want.  Load it in 3ds Max and then select File->Export.

 

image

 

Once again I am saving the file in the root of our project ( MyFirstObject, see prior tutorial ) directory.  Make sure you set “Save as type” to VMESH then click Save.

 

 

Next you will be presented with a series of options:

image

 

I’ve highlighted two of the most important settings for you to be aware of.  First is scaling multiplier and this is pretty important.  The value of  1-unit can be defined in most modelling applications.  In vForge however, 1 == 1cm.  So if you’ve modelled your crate as 2x2x2, that means 2cm x 2cm x 2cm, also known as really really really tiny.  To make things even more confusing, in Havok Physics 1= 1 meter!   Therefore when exporting, we are scaling our dimensions by a factor of 100, so our 2x2x2 cube created in Max, with become a 2m x 2m x 2m cube when viewed in vForge.  Of course, you could always set up 3ds to work in cm’s if you wanted.  Finally, take note of the directory textures are being exported to.

 

Once ready, click OK.

 

Your newly exported model will be shown in the model viewer.  You can navigate using the WASD keys and look around using the mouse.  Chances are the camera will be extremely zoomed in when it loads.

 

image

 

Press ESC to close the viewer.  If you dont want it to show up in the viewer, simply uncheck Preview after Export.  Having an option to quickly see how your object will look in engine can be incredibly advantageous, but it can also get annoying.

 

Creating a Static Mesh Instance

 

 

You now have a VMESH file to work with, lets create one in our scene.  In your project, drag a Static Mesh Instance onto the Engine View:

image

 

Now go to the properties and locate MeshFileName:

image

 

 

Select our newly created Mesh object:

image

 

 

So, now your scene should have an entity and static mesh in it, assuming you are working from the previous project that is, like so:

image

 

But there might be a bit of an issue in your scene…

 

image

 

See, when exporting our static mesh, we applied a conversion from cm to m, while when we exported our model we didn’t.  This can be easily rectified in vForge however.  With your entity crate selected, go to properties and locate Scaling and set Uniform Scaling to 100:

image

 

And…

 

image

 

 

… that’s more like it!

 

So, now we have two crates, one is a MODEL attached to an entity, while the other is a vMESH attached to a static mesh.  So, what’s the difference?  Good question!

 

Meshes vs Models, what’s the difference?

 

In a word, weight.  This has nothing to do with mass either.  A static mesh is a much more computationally light weight object than a model.  A static mesh is basically just displayed in the scene.  Physics can respond to it ( so for example, you can run into it ), but it does not respond to physics… it is exactly what it’s name suggests… static.  It doesn’t move, it isn’t animated, it simply is there and you can run into it… that’s about it.  On the bright side, a static mesh takes a great deal less processing power to deal with and because it is static, there are a number of optimizations the engine can perform.

 

A model on the other hand is a great deal more complex than a vmesh.  A model can contain a great deal more information, including of course animations.  An entity is also a great deal more capable than a static mesh instance.  Plus of course there’s components… we will come to that in a moment.  Components are a huge difference though!

 

So, when do you use which?   If it is part of the world and doesn’t move or require an additional component, use a static mesh.  Otherwise use a model.  For the sake of performance, prefer a static mesh whenever you get the chance.

 

 

Components

 

Components are where a great deal of Project Anarchy’s functionality lies and the difference in options between a static mesh and an entity is pretty severe, see:

 

Components available to a static mesh:

image

 

Components available to an entity:

image

 

So, if you want to hook your 3D object up for more advanced physics, as a character controller, to Havok Behavior, etc…  you need to go with an Entity.

 

There is one final mildly confusing point, that you can completely disregard for now if you want.  Up until now I have used the terms VMesh –> Static Mesh Instance and MODEL –> Entity.  It is however possibly for an Entity to reference a static mesh, but not the reverse.  Again, if that is confusing… forgetaboutit!

 

From the code side of things, a static mesh is actually a VStaticMeshInstance_cl, while an entity is VisBaseEntity_cl.  As you can see from their prospective inheritance diagrams, VStaticMeshInstance is “simpler”.

 

VStaticMeshInstance_cl Inheritance diagram:

image

 

VisBaseEntity_cl inheritance diagram:

image

 

It’s the inheritance from VisObject3D_cl that is absolutely critical.  That class itself contains the functions critical to movement such as GetPosition(), IncOrientation() etc…  basically the code you need to position and move an object in 3D space.  It is also what enables the more advanced parenting options and linking available to an Entity and other VisObject3D_cl derived classes.

 

 

TL;DR version… got a 3D object that doesn’t move and doesn’t change?  You probably want to export it as a VMESH and make it a Static Mesh Instance.  Otherwise, you probably want to export it as a MODEL and implement it as an entity. 

Programming


3. July 2013

 

Now that Project Anarchy is out, I’ve decided to take a look at what you actually get.  If you’ve never heard of it before, Project Anarchy is a collection of Havok game development tools made available completely free for mobile developers.  In this post, we will look at exactly what those tools are composed of.  To get started, head over to the download page and download the installer.  The initial download is just a downloader, the actual install is a great deal larger, just shy of 5GB on my system.

 

 

When I started this post, I expected it to be rather short… boy was I wrong.  Let’s just say, you get a LOT in this package.  This post will give you a pretty good idea of what you get in Project Anarchy and should give you an idea of it’s capabilities.

 

 

Getting started and help contents

 

After installing, you should have a folder structure like this:

image

One important thing to keep in mind, to develop for iOS you need a Mac and need to perform a different download.  Also it is important to note that the vast majority of Project Anarchy’s tools do not run on MacOS.  So basically, you will need a Windows and Mac machine if you want to do iOS development.  That’s pretty much normal at this point in time though.

 

A bit of a warning, Project Anarchy isn’t the only thing you will need to install.  To do Android development on Windows, you will also need the Android SDK and NDK installed, Visual Studio 2010 or higher ( Express works, but lacks Android debugging), as well as the Java 1.6 JDK.  Notice again, 1.6, not the newest version!  Seems a common trend for developer tools to require Java 6 instead of 7.  If developing for iOS, you need to have XCode and the iOS SDK installed.  There is a document specifically about getting start with Android and iOS that walks you through the process in more detail.

 

Documentation and learning resources

 

The documentation shipped with Project Anarchy is in a word impressive.  A great deal of the documentation is installed locally.  The directories that will be of immediate interest to most developers are \Docs\Vision\windows, \Docs\Vision\android, \Docs\Vision\ios, although confusingly enough, they seem to contain only slightly modified versions of the exact same documents!  So, if you want to shave 600MB or so from your install, you can probably start here.    The VisionEngine_Documentation_platformname.chm file is the master index, pulling all the other documents together.  Project Anarchy includes the following documents:

 

image

 

As you can see, a pretty comprehensive set of documentation.  The Startup Guide is the most logical place to start.  It gives you an overview of the various tools, a short Lua scripting primer, etc.  Perhaps coolest of all, there is a full sample project with assets that you can play around with.  These assets are referenced multiple times in the documentation.  There are actually a ton of assets for anyone to get started with, especially if you dont have immediate access to Maya or 3DS Max.

 

In addition to the documentation installed locally, there are a series of video tutorials available, covering vForge, Animation and the basics of scripting.  The quality of the videos varies massively from very good to… not.  There are also a series of courseware, which you can think of like tutorials that are targeted towards school curriculums.  The course ware series all revolve around the sample project you can download here (direct link, 100mb in size).  Additionally they have a StackOverflow style question and answer page as well as a remarkably active forum, considering the age of the project.

 

All told, the information available is quite good.  That said, I’ve done a fair bit of jumping into the documentation and it’s a mixed bag.  It’s well enough written and generally useful.  That said, it has some serious legacy issues, as much of this obviously was inherited from Havok tools, and they’ve been around for a long time.  For example, I found configuration details for Metrowerks Codewarrior… a compiler that might be older than some of the people reading this right now!  So there is a huge amount of documentation, but figuring out which parts you need might be a bit of a challenge.  In the end though, it’s much better than I was expecting and a very well documented and supported SDK.  You can tell they put some focus on documentation/new user experience, and it shows.

 

vForge

 

In many ways vForge *IS* Project Anarchy, in the same way Unity Studio is Unity.  This is where you create your levels, write your scripts, create landscapes, etc.  Basically it’s the glue that holds all the other pieces together.

 

Here is vForge with the RPG project loaded and the Arena scene open.  FYI, the RPG project is available at Data\Vision\Samples\Engine\RPG

image

 

You can navigate around the scene using the mouse.  Aiming with mouse, left mouse button to move in the direction your are looking, right mouse button to change your look direction.  You can also configure it to use WASD keys for navigation if that is your preference.  See where it says “Default Layout”, this is where you can change the layout between the various things you might want to do in vForge, such as script editing, particles, etc.  You can also define your own custom layouts, or use almost every panel as undocked, which is nice on a multi monitor setup.

 

In Engine View, this is where you can place items in the scene.  Here for example, I instanced a BOSS shape from the Shape Creators tab by dragging and dropping onto the Engine View.

 

image

 

Press the Play icon in the Engine View toolbar, and your game will start playing, UI and all ( animated obviously… ):

 

image

 

So, vForge is where you place game objects, but that’s just scratching the surface.  There are a staggering number of tools embedded in here… see:

 

image

We will look at many of them shortly.

 

Script Editing and debugging

 

For example, opening the Script Panel, brings up a script window.  Here is the Boss script:

 

image

 

As you can see, the script editor has full intellisense support, well if that wasn’t a trademarked Microsoft term that is.  What’s the non-trademarked term… code hints?  Anyway… it has them, and I love ‘em.  It’s not as detailed as you might be used to in Visual Studio, but its a great help.  That ? icon to the right brings up context sensitive help too, so highlight a function name and click that button and it will open the reference help to that entry if found.  Handy.

 

Each of these floating panels can also be docked within the main editor, here is the script panel docked below the Engine View for example:

 

image

 

The script editor looks remarkably simple, but there is a great deal of functionality hidden in there.  For example, there is a full snippets library:

 

image

 

In addition to the Script Editor, there is also a full script debugger:

 

image

 

With all of the traditional components you would expect, breakpoints, watches, type inspection, it even allows you to connect to a remote device for debugging.

 

Perhaps coolest of all, by clicking the highlighted debugger, you can invoke the code profiler.

 

image

 

Allowing you to identify performance bottlenecks in your scripts. 

 

 

Terrain

 

Creating Terrain in vForge is a straight forward process.  In the Shape Creators tab, simply drag a Terrain over to your scene:

 

image

 

You will then be prompted with this dialog:

 

image

 

Then its a matter of configuring your terrain:

 

image

 

And presto, our landscape, using the default settings and sand texture:

 

image

 

Now fire up the Terrain Editor and you can raise, drop, smooth, paint, etc… your terrain.  Select the tool, and hold down SHIFT or CTRL and Left Click to paint.

 

image

 

And after playing around for a few minutes:

 

image

 

Obviously I am just playing around and using a fraction of the tools.  You can paint mesh (instances) directly on to the terrain, paint billboards ( textures that always face the user, useful for grass and similar effects ) as well as set up sky boxes including full day/night cycles.

 

In fact, there are dialogs for editing the sky:

 

image

 

Editing time of day, including the effect, sunset and sunrise times:

 

image

 

As well as fog editing and post processing effects ( glow and tone mapping, two settings you chose when initially creating your project ).  So the terrain editing tools are fairly comprehensive.

 

Particles

 

Of course, particles are a heavy part of almost every modern tool and of course, vForge includes a suite of tools for working with/ creating particle systems.  In the form of the particle editor:

 

image

 

This is one of those things I have always sucked at, so it was comforting to see the templates when I clicked the Create a new particle effect button:

 

image

 

The actual editor has a few hundred different settings for your particle system, if you create a particle system, then set it to your newly created system, you can press the play button and watch your change in real time.

 

 

Physics Integration

 

As you can see, Havok Physics is also directly integrated into vForge

 

image

 

Of course, that is only part of the physics equation…  the global part.  You are of course going to need to add physics to your scene.  This is accomplished by means of components.  Add an entity to the scene, define its model type, then you can add a component easy enough.  In this case, i’ve add an entity with a ball model.

 

image

 

Here we selected then entity then added the Havok Rigid Body controller.  As you can see, there are a number of parameters you can play with for Rigid Bodies:

 

image

 

Of course, rigid bodies aren't your only option when it comes to physics.  There are a number of constraints you can add as well ( under the Shape Creators ), such as adding a Terrain constraint to the Terrain object, which will then cause our Rigid Body Ball in interact with the terrain.

 

Mobile Helpers

 

Mobile development has it’s own special difficulties, two of which Project Anarchy has a nice solution to.

 

The first common issue is the deploy cycle.  Generally what you do (on Android) is create an APK, which is your application and all of it’s data bundled together into a single package.  So what happens when you change a few small things then want to test it on device?  Well, you create a new APK file and deploy it.  As your application grows in size, this process gets more annoying.

 

Enter vFileServe, which can either be run in vForge or as a stand alone application.

 

image 

 

Essentially it acts as a virtual file system.  You deploy an application to your device ( using the Prepare Devices Button), which then syncs files between your device and vFileServe using wireless.  This allows you to make changes and do rapid on device testing.

 

Another common problem with developing for mobile devices is emulating the controls.  Multi-touch and motion controls specifically are often difficult to replicate on a PC.  For this Havok provide the vRemoteInput plugin, which enables you to use a mobile device to control vForge.  It is enabled in code however, so there is very little I can show in terms of screenshot.  Basically once enabled, when you go into “play” mode, your game can be controlled using your devices touch screen and motion sensors.

 

Shaders

 

There are also comprehensive tools for dealing with shaders.  The first and easiest to use is the Visual Shader Editor:

 

image

 

This tool enables you to create shaders by linking items and operations together.  For those that prefer direct access to their shaders, there is also an editor:

 

image

 

On top of this, there are panels for creating and managing shader libraries, property inspectors and more.

 

Havok AI

 

AI is obviously a big part of game programming and the user is often left to roll their own.  Not so in Havok, Project Anarchy includes the Havok AI suite.  This is a combination of a set of tools integrated into vForge, as well as many AI related functions available to the programmer.

 

Here are global AI settings:

image

 

In vForge, you have the ability to set up Nav meshes, which consists of geometry that define the navigable portions of your game:

 

image

 

You also have the ability to makes paths ( bezier splines ) for AI to follow, triggers and more.  The majority of Havok AI seems to be on the developer side, with a large number of api calls for things like determining the best path, etc.  I need to look into Havok AI in greater detail later.

 

Havok Animation Tool

 

This is another entire application, seemingly for making animation state machines, so basically for “gamifying” your rigged animations.  Yeah, I think I made that word up.  Truth is, I am not an animator, so this is way outside my pay grade…  anyways, here is Havok Animation Tool running an included example project ( located at C:\Users\Mike\Documents\Havok\Havok Animation Tool 2013.1.0.0-r1\GameAssets\Hero on my PC ).  You can control the characters animations using a game pad.

 

image

 

Again… not my realm of knowledge, so I know very little about this tool.  I believe this was a good part of the product known as Havok Behaviour.

 

Other Tools

 

There are a collection of other tools that are part of Project Anarchy as well.

 

One is the Visual Debugger

image

In Havoks words:

The Havok™ Visual debugger (VDB) is a very convenient tool to monitor the physics representation of a scene in real-time. By watching the physics objects in the visual debugger, you can quickly locate any potential errors, which may not have been located by viewing the scene in vForge alone.

 

vFontGenerator

image

For creating fnt bitmap font files.

 

vSceneViewer for viewing scenes (outside of vForge)

image

 

vModelViewer the name pretty much says it all, for viewing Project Anarchy model files:

 

image

 

vAnimTool You can load a model and anim animation file preview and edit animation sequences:

 

image

 

Art Pipeline Tools

 

There are plugins for Max and Maya for exporting 3D content.  I don’t have either currently installed, so I can only show this screenshot taken from the documentation:

 

image

 

So then… what happens if you don’t have Max or Maya?  Well, you are out of luck.  There is a 30 day fully functioning trial available, but unless you are a student there is a 5000$ pricetag at the end of that trial.

 

Fortunately, that is just a temporary problem, from the ProjectAnarchy answers website:

 

Based off the community feedback we are currently working and testing an FBX importer. We realize that many users in the community use other modeling packages and the FBX importer will help those users with being able to get their assets in.

 

Once that importer is available you will suddenly be able to use tools like Blender, Cheetah, Poser/Daz, Silo, etc.  Basically any tool that exports FBX, which is just about every modern app.

 

Summary

 

There’s tons of functionality packed in this engine, and this is just looking at the tool side of the equation.  Of course there are dozens upon dozens of APIs behind the scenes as well.  In the future I will look closer at how you actually put it all to use.  Let me know if there is anything you specifically want covered.

 

I will say, I am a lot more impressed than I thought I was going to be.  I thought it would be a bunch of poorly documented tools mashed together with minimal documentation.  In reality, it’s a remarkably cohesive and powerful package that covers almost all of the bases.  They certainly have my interested piqued.  Good job Havok!

General Design Programming


2. July 2013

Back in March I reported that Ludei was bringing WebGL support to their HTML5 performance wrapper, CocoonJS.  Today I received the following email:

 

The latest version of our Cloud and Launcher is available now! 
The wait is finally over! CocoonJS1.4 is NOW available in Google Play! We are still pending approval with the Apple App Store, so please check daily for its debut! This version includes the following awesome features:

  • WebGL support is now available! For the first time ever, publish your 3D games to iOS and Android devices!
  • Convenient 1-click Publishing to 5 App Stores -- bundles generated for: Apple, Google Play, Amazon, Chrome Store, Pokki
  • Improved Configuration Options for the Ludei Cloud Compiler
  • Updated Third Party SDKs -- advertisements, social integration and in-app payments
  • Improved Resources Management
  • Improved Audio Implementation that supports more HTML5 features
  • Improved webview support allowing you to develop HTML5 web apps while still having all our extensions available to monetize and make your game or app successful
  • And much more!! Click here to read the blog post!

 

This means you can now develop WebGL games and use Cocoon to deploy them to iOS and Android.  I am not sure if you ever tried running a WebGL application in a mobile browser… it's appalling.  None of the official browsers support WebGL, and the few that do ( Dolphin? ) got abysmal framerates.  So, if you want to run a high performance WebGL based game on mobile devices, CocoonJS is about your only option.

If you've never heard of CocoonJS, it's basically a high performance, striped down browser optimized for gaming.  It acts as a host for your game, so you bundle your game and Cocoon together to create an App Store deployable application.

 

In the same release, Ludei also announced:

Ludei Secures $1.5M in Funding 
We just announced that we recently received $1.5M in funding from key venture capitalists and angel investors, further validating the increasing industry support of HTML5 development. Click here to read more.

So you don't need to worry about they going anywhere sometime soon!

News


25. June 2013

 

A few months ago during GDC, Havok announced Project Anarchy, which was a collection of their game development tools made available FOR FREE for mobile developers.  Then we had the long wait for it to go live.  Fortunately today I received the following email:

Havok

Hey Everyone,

Our team has been hard at work and is happy to announce that the beta version of Project Anarchy is now available to download!www.projectanarchy.com/download

We've also transformed www.projectanarchy.com into a community site which is loaded with resources to arm and inspire developers including:
  • The Project Anarchy Software
  • Online Discussion Forums for Community Support
  • Lessons & Tutorials
  • Videos & Documentation
To join our online community and download Project Anarchy, go to:http://www.projectanarchy.com/user/register

NOW THAT WE'VE LAUNCHED, WHAT’S NEXT?
There's lots of stuff in store for Project Anarchy and the Project Anarchy online community! Here are a few highlights…

Tech Updates
Project Anarchy will have regular updates that will include ongoing new features and enhancements and we already have our next release in the works with Android-x86 support due in the coming weeks.

Arming the Project Anarchy Community with Resources
We'll continue to build and refine Project Anarchy related resources including lesson plans, tutorials and videos that help make game development faster and easier. New resources will be available on the Project Anarchy online community.

Education for Future Game Developers
We'll be reaching out to schools around the globe and continuing to develop courseware to help future game developers learn the ropes and exercise techniques such as math, programming, computational geometry, simulation, and character animation. Lesson plans are available via the online community at: http://www.projectanarchy.com/training

Engaging with our Developer Community
We'll be attending a range of events worldwide to maximize our face to face time with developers, share beers and talk games. You can check out a list of all of the events Project Anarchy will attend, here:http://www.projectanarchy.com/events

If you are around for any of these events and would like to get together, let us know!
 
Project Anarchy Developer Contest
We'll be hosting a developer contest in the near future and are looking forward to seeing some great innovations resulting from the combination of your talent plus the comprehensive toolset that is Project Anarchy. More to come on this soon, so stay tuned!

BIG thanks to all of our followers for your support, excitement and patience. We hope you all have fun with the tech! Be sure to sign up for our developer community!

For more information on Project Anarchy, visit:http://www.projectanarchy.com/about

-The Project Anarchy Team

 

So head on over to the download page before their servers get swamped!


17. June 2013

I mentioned last week about a new blog tutorial series covering creating a game engine from scratch, quite literally.  The series deals with the low level stuff we just don't normally deal with these days as Direct3D, OpenGL or WebGL take care of a lot of this for you.  Sometimes knowing how these things work can be a huge benefit.

 

By the end of part two, he had covered creating a wireframe 3d cube.  Today he has just released part 3.  

 

In part 3 he covers exporting a 3D object from Blender using the babylon plugin, to export to JSON.  He then covers loading in the JSON data and rendering it using the existing wireframe code.  The next section is supposed to cover rasterization and z-buffering, so stay tuned.

 

The end result after part 3 is:

Cool and ( these days ) unique series, keep 'em coming.


GFS On YouTube

See More Tutorials on DevGa.me!

Month List