Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

1. November 2012

 

In the last couple days a few very useful tutorials have shown up on the Moai forums, I thought I would bring to your attention.

 

Resource Manager with Multi-Res support

This is an intermediate level tutorial, as the author suggested, there aren’t actually all that many tutorials serving this skill level.  He has a couple more tutorials in the works, hopefully at the same link.  In the author’s words, this tutorial:

The resource manager that we will be creating will actually be divided into several parts, each adding specific functionality and some really handy features. As far as the application (your game logic) is concerned, there is a namespace called 'ResMan' that provides functions for retrieving any type of data that it needs. This tutorial will start with a simple interface in the ResMan namespace for retrieving images and fonts, as the tutorial progresses the interface will be expanded to include more resource types as well as implement some very handy functionality.

 

 

Extending MOAI Lua host with additional 3rd party libraries

Another slightly shorter tutorial, this one is also at the intermediate level.  In the authors own words:

This is a brief how to which I'm posting here because it might save you 5 minutes (or me 5 minutes if I do this again). Recently I added lua 'bit ops' to the MOAI host so I could have bit flags. It was completely painless and here's a little recipe:

 

Basically it illustrates how to add another lua module to the Moai host, in this case bit ops, very handy.

 

Nice work guys, keep ‘em coming.  I really have to start a new Moai tutorial soon…

Programming , ,

31. October 2012

 

Microsoft have just release their Windows Phone 8 SDK, you can read the announcement right here.  They have also launched a new Windows Phone 8 Dev Center, that you can access here.

 

And apparently, Microsoft don’t want anyone to use it…

System requirements

Supported operating systems: Windows 8, Windows 8 Pro

    • Windows 8 64-bit (x64) client versions
  • Hardware:
    • 4 GB of free hard disk space
    • 4 GB RAM
    • 64-bit (x64) CPU
  • Windows Phone 8 Emulator:
    • Windows 8 Pro edition or greater
    • Requires a processor that supports Second Level Address Translation (SLAT)

 

Windows 8 only?  Really Microsoft, really?  Your platform isn’t exactly the most popular these days, you can’t seriously be trying to push Windows 8 adoption with your developer tools?  This hopefully is just a mistake, I’d like to think Microsoft isn’t really run by idiots.

Anyways… assuming you are one of the 12 people running Windows 8, you can download the SDK right here.  You can still download and install it on non-Windows 8 versions, but apparently the emulator is disabled, pretty much leaving you dead in the water.

 

As for new technical features, those are highlighted here.  A quick summary of some of the most relevant options are:

  • Direct3D XAML interop, allowing you to build D3D apps that work with XAML.
  • Multitargeting, allowing you to target Win Phone 7 and 8 with one project
  • XAML and native code profilers

 

Microsoft also released this video on Native C++ game development with Windows Phone 8

Native C++ game development with Windows Phone 8



 

 

If you are interested in developing for Windows Phone 8, you may want to sign up now, as:

Windows Phone 8 is out, the tools are available, and devices are about to be released—it’s time to get coding. As an added incentive, for the next 8 days individual developers can register for a Dev Center account for just $8 (a 92 percent savings). Please note because this is a very limited time offer. You’ll be charged $99 USD or equivalent in your local currency, and we’ll refund the difference in the next 30 to 45 days. Watch for more details on Dev Center soon.

 

Why 8$?  Anyways, any interest in developing for Windows 8 Phone?  I personally love Microsoft’s platforms and development tools, by far the best in the industry.  That said, I just dont believe in … well, anything they are doing lately.  I expect Windows 8 to be a gigantic flop and a senior executive house cleaning to occur.  For the record, I owned Microsoft stock up until about 2 months ago.  Shows what faith I have in their current strategy.

News

30. October 2012

 The following is a guest tutorial post written by Michael Habalcik on using the freely available Moscrif game development suite to create a simple mobile game.  I hope you find it informative.

 

 


 

Balloons game demo in Moscrif SDK

 

We are proud to present one of very first tutorials about “a new kid on the block”. Moscrif is the new member of cross-platform development tools suited for a modern mobile game developer.

 

Moscrif overview

Moscrif SDK is a development suite solving the problem of supporting an increasing number of mobile platforms. The number of these platforms is increasing making it almost impossible to go native for every one of these. With Moscrif, only one development cycle is needed allowing you to publish the game to the most popular platforms. With the current support of iOS, Android, Nook or Kindle you can reach up to 80% of the mobile market audience. New Windows Phone should be supported in the near future reaching even more mobile users.

 

The key advantage is the need of just one code base. Because Moscrif uses JavaScript, it is extremely easy to adopt for experienced developers as well as for beginners because JavaScript is one of the easiest languages to learn with a countless number of tutorials all over the net.

 

Other benefits:

 

      Graphics performance - Moscrif applications are able to achieve 50 frames per seconds (one of the bests in the industry)

      Hardware acceleration – the amazing graphics performance is achieved with the contribution of fully OpenGL hardware acceleration

      Code one, run anywhere – the only one code of application can run on almost 90% of devices

      Reuse your knowledge – Moscrif uses JavaScript language which makes no problem for everybody who has ever developed web application or desktop applications in C, C++, Java etc.

      Publish on your own computer in few seconds – some other cross platform tools requires sending the source codes to theirs servers and publishing process sends some hours. Moscrif makes it on your own computer in few seconds.

      Free license - Moscrif is one of only few similar tools offering a free license

      IDE - Moscrif comes with its own IDE which is a part of the SDK

 

The Moscrif is available for free download on its homepage http://moscrif.com/download.

 

The balloon game demo

 

To present the capabilities of Moscrif, we have created a simple game demo based on shooting down the balloons. This game contains only one level and simple game menu, but with only few additional lines of code it can be transferred into a full game ready to hit the app stores.

NewImage NewImage

 

Starting a new project

 

To create the project the Project wizard (click File -> New -> New project) will be used. We have selected the new 2D Game option as it is exactly what we are looking for.

 

New Project

In the next step we set few of the most basic project’s properties like the landscape orientation. We have also checked the box2d library to be added into the project. As we are interested in some basic game menu as well, the option called Screens select Game with Menu is checked as well.

 

NewImage

In the next step we set few of the most basic project’s properties like the landscape orientation. We have also checked the box2d library to be added into the project. As we are interested in some basic game menu as well, the option called Screens select The wizard will create a new project with three precreated scenes: menu, single and multiPlayer.

 

In this sample we are only going to use a single player mode. Therefore, we need only 2 scenes - one for the menu and one for the game itself. So you can delete the multi player scene (remove also the include command in main.ms file). Game with Menu is checked as well.The wizard will create a new project with three precreated scenes: menu, single and multiPlayer. In this sample we are only going to use a single player mode. Therefore, we need only 2 scenes - one for the menu and one for the game itself. So you can delete the multi player scene (remove also the include command in main.ms file).

 

The whole game code will be in singlePlayerScene file, so we open it for editing. As seen on the example below, our scene class is extended from the PhysicsScene base class. The Scene base class creates a basic scene without the support of physical engine. Because Scene class is not sufficient for use as we need the support of physics engine, we use PhysicsScene class instead.

 

Following, a new instance of b2World object is created in the init method taking 4 parameters:

 

1      gravity on the x axis

2      gravity on the y axis

3      true/false doSleep parameter. We use True to improve the performance

4      true/false allowing the collisions between the objects within the scene

 

We set the gravity on the y axis to -9.81 what is equivalent of real earth’s gravity.

 

Example: applying physical engine in the scene

 

class SinglePlayerScene : PhysicsScene

{

    // constants

    const maxForce = 2000;

    const forceStep = 0.1;

    const maxDistance = 3*System.height / 5;


    function init()
    {
        super.init();

        this.start = System.tick;

        this.world = new b2World(0.0, -9.81, true, true);

….

 

Physical engine

 

To simulate the real world’s behavior Moscrif relies on powerful box2d physical engine. This engine is used by many platforms and many well known games rely on it like: Crayon Physics Deluxe, Limbo, Rolando, Fantastic Contraption, Incredibots, Angry Birds etc.

 

The main part of the physical engine is the world which consists of the bodies and the joints. It manages all aspects of the simulation and contacts between the bodies. Bodies interact together according to theirs properties which specify the density, friction and/or bounce.

 

The engine supports three different types of the bodies, which behaves differently. Static bodies do not move under the simulation and collide with dynamic bodies. The dynamic bodies are fully simulated and collide with all other bodies. The last, kinematic bodies do not move under the forces, only according to its velocity. They interact only with dynamic bodies. In Moscrif, bodies are created as an instance of PhysicsSprite class or class extended from the PhysicsSprite class. The position of bodies and collisions are recalculated in small time intervals.

 

Example: making a time step in physics simulation

 

function process()

{

    // timestep in physics simulation

    var timeStep = 1.0 / 40.0;

    // recalculate physics world. All objects are moved about timeStep

    this.step(timeStep, 4, 8);

….

}

 

The Balloons

 

Balloons are managed by their own class extended from the PhysicsSprite class. Every balloon is made of several frames that are changed every 100 milliseconds creating a simple and realistic animation. When a balloon reaches the top of the screen an end event is raised.

 

Image: balloons frames

NewImage

 

 

 

Example: creating the balloon class

 

class Balloon : PhysicsSprite

{

    function init()

    {

        super.init();

 

        // set image with frames

        this.image = GFX.ballon;

        // set frame dimension

        this.frameWidth = GFX.ballon.width / 5;

        this.frameHeight = GFX.ballon.height;

 

        // start timer

        this.timer = new Timer(100, true);

        this.timer.onTick = function()

        {

            // move to next frame

            if (this super.frame == 4/*number of frmes*/)

                this super.frame = 0;

            else

                this super.frame+=1;

 

            // check if the balloon does not passed the top of the screen

            var (x, y) = this super.getPosition();

            if (y < 0)

                this super._endHandler(this super);

            // speedup

            this super.setLinearVelocity(0, this super.getLinearVelocity() + 0.07);

        }

        this.timer.start(100);

    }

 

    // end level event

    property end(v)

    {

        get return this._endHandler;

        set this._endHandler = v;

    }

}

 

Balloons start from the random position at the bottom of the screen in time intervals.

 

function _setTimer(i = 1)

{

    this._timer = new Timer(1, 1);

    this._timer.onTick = function()

    {

        // create ballon

        this super._createBallon(i);

        // decrease the time between two ballons

        if (this super._time > 200)

            this super._time -= 3;

        i += 0.1;

        this super._setTimer(i);

 

    }

    this._timer.start(this._time);

}

 

The Ball

 

The ball is fired from the bottom of the screen. The angle and force of the fire are controlled by the user touches on the screen. When user taps the screen the first angle and force is calculated. The force is calculated as a rate of distance of user’s touch from the ball’s start position and its max distance which is equal to the max force. The angle is calculated using the trigonometric function tangents as a rate of distance on y and x axis.

 

Example: calculating the force and angle

 

function pointerPressed(x, y)

{

    super.pointerPressed(x, y);

 

    if(this._ended) {

        this._goBack();

        return;

    }

 

    // calculate distance on both axis

    var distanceX = x - System.width / 2;

    var distanceY = y - 9*System.height / 10;

    // calculate angle

    this._angle = Math.atan2(distanceY, distanceX);

    // total distance

    var distance = Math.sqrt(distanceX*distanceX + distanceY*distanceY);

    // max distance (max distance is distance which equal the max force)

    if (distance > maxDistance)

        distance = maxDistance;

    // calculate force

    this._force = (1.0*distance / maxDistance)*maxForce;

}

 

When user drags his finger the angle and force are recalculated in the same way as when he presses it. Finally, when user releases his finger the ball is fired.

 

Example: firing the ball

 

function _fire()

{

    // if can not fire do nothing

    if (!this._canFire)

        return;

 

    // add new ball

    this._ball = this.addCircleBody(GFX.ball, #dynamic, 1.0, 0.0, 0.0, GFX.ball.width / 2);

    this._ball.setPosition(System.width / 2, 9*System.height / 10);

    this._ball.id = #ball;

    this._ball.bullet = true;

 

    // start veloity of the ball acording to angle and force

    var velox = this._force*Math.cos(this._angle)/this.scale;

    var veloy =-this._force*Math.sin(this._angle)/this.scale;

 

    //apply velocity

    this._ball.setLinearVelocity(velox, veloy);

 

    // diable next fire

    this._canFire = false;

    // allow fire after 500ms

    var t = new Timer(1, 1);

    t.onTick = function ()

    {

        this super._canFire = true;

    }

    t.start(500);

}

 

Contacts

 

When two bodies collide together a beginContact and endContact events are raised. The events have only one parameter – a list of all contacts in the world. Every record in the list contains information about both bodies of the contact (accessible by getBodyA and getBodyB methods).

 

Example: managing contacts

 

function beginContact(contact)

{

    var current = contact;

    while (current) {

        // get both bodies in contact

        var bodyA = current.getBodyA();

        var bodyB = current.getBodyB();

        // check if a ballon was hit

        if (bodyA.id == #ball && bodyB.id == #ballon) {

            // destoy ballon

            this._bodiesToDestroy.push(bodyB);

        // check if a ballon was hit

        } else if(bodyB.id == #ball && bodyA.id == #ballon) {

            // destoy ballon

            this._bodiesToDestroy.push(bodyA);

        // check if something hit the border (only ball can)

        } else if(bodyB.id == #border) {

            this._bodiesToDestroy.push(bodyA);

        } else if(bodyA.id == #border) {

            this._bodiesToDestroy.push(bodyB);

        }

        // get next body

        current = current.getNext();

    }

}

 

Summary

 

As you can see, creating mobile games using Moscrif SDK is straightforward and even the beginners should be able to create a killer game. So are you going the make the new Angry Birds? It’s free, so why not to try it …

 

The source code of this sample can be found at https://github.com/moscrif/samples/tree/master/sampleBallons

Programming

29. October 2012

 

Since I've been working on a Mac more and more often these days, I've been looking for an alternative to the wonderful Windows Live Writer for Windows.  I started with a trial of MarsEdit, which I really liked, except it's inability to display formatted source code ( a big deal for me ), its lack of tagging ( not a really big deal, but a nuisance ) and the lack of image formatting options.

 

Then I found and discovered Adobe Contribute, which has a 100$ price tag.  It started off strong but quickly took a jump off a cliff into the land of truly awful.  It seems to be poorly supported by Adobe, has documented features that don't appear to exist anymore, has some gigantic bugs ( such as the Paste menu never being enabled! ).  It did however have incredible table formatting tools!  I know in the age of CSS, table is a bit of a swear word, but damned if a lot of your data isn't in a tabular format.  The image formatting options were easily the best of all packages I've used, including Live Writer.  But good tables and good image positioning tools don't even come close to making up for the brutal flaws, especially at a 100$ price point.

 

I then tried out Qumana, a completely free option:

Qumana screenshot

At first glance, it pushes all the buttons.  It doesn't support tags ( only Live Writer seems to ), but image formatting is decent, and you can directly edit the HTML of your post, so if you know HTML, the sky is the limit.  I attempted to write the previous post with Qumana and ran in to a gigantic deal breaker attempting to insert an IFrame… you can't.  I pasted the HTML code for a Youtube video, then when I switch back to WYSIWG view, poof gone.  Game over.

 

So then, back to MarsEdit, which I went ahead and purchased.  In the end, MarsEdit was easily the best option of what is available for Mac.  The biggest sellable point was the ability to drop to and edit HTML, which is nicely preserved when switching back to rich text mode.

 

Now, Red Sweater, if you are listening, please add the ability to create plugins, or failing that, the ability to post formatted source code.  Also, tag support would be nice!

 

If you are a MarsEdit user, and currently post code samples on your blog, how are you doing it?

General

27. October 2012

 

 

It's odd how news arrives sometimes, it always seems to arrive in batches and today's post is no exception.  Earlier this week I read about a recently launched 3D modeller that works within Unity3D.  That piqued my interest for a few minutes, then something shiny came along and I forgot about it completely.  Then a day later a different product was announced that also enables 3D asset creation within Unity.

If you've not heard of it, Unity is a massively popular game creation suite, that enables developers to create games for PC, Mac, iOS, Android and more.  Prices range from free to around the 1,500$ mark.  The biggest catch has always been the content creation side, take a look at our 3D application list for an idea of the typical price tag attached to these application.  Up until now, Blender and Cheetah3D on the Mac where you only options if you didn't have several thousand dollars to spend.  Then you have to contend with the annoyances of getting your asset from the application and in to Unity, not always a seamless process.  Therefore, a low cost/no cost editor that works within Unity is certainly welcome.  And today, we get two of them!


GameDraw


The first is GameDraw, which is available in Unity or as a stand alone application on Mac, Windows, Linux and iPad.  It currently has a 45$ price-tag, which is about 1% of the cost of 3D Studio Max if you want to put that in perspective.

GameDraw features include:

Polygonal Modeling, Sculpting, Generation and Optimization Tools
UV Editor
City Generator
Runtime API
Character Customizer
Mesh Editing ( Vertex, Edge, Triangle, Element)
Mesh manipulation functions (Extrude, Weld, Subdivide, Delete, Smooth,…etc)
Assigning new Materials
Mesh Optimization
UV editing
Primitives (25 basic model)
Sculpting
Boolean operations
Node based mesh generation
2D tools (Geometry painting, 2D to 3D image tracing)
Character customizer
City Generator
Warehouse “hundreds of free assets”




 

Shade for Unity

Shade is the other contender entering the ring.  This is a bit odd for me, as I have been a hobbyist in the 3D industry since the early DOS days when I purchased 3D Studio ( note, no MAX ) 4.  I spent my childhood dreaming of owning an SGI Indy with PowerAnimator.  I have followed the industry forever, used just about every 3D application out there, from the big guys like Max and Maya to the fringe like Nichimen nWorlds and Houdini.  In all of that timeNewImage however, I don't think I have ever even heard of Shade, which amazingly has been around since 1986 and is currently at version 12!  

I downloaded the 30 day trial  and I am rather impressed with this package, which I will be looking in to in a bit more depth later.  I noticed along the way, while search for help on how to do certain tasks in Shade, nobody else has heard of it either!  There just isn't a ton of information out there.  How the heck can a package get to version 12 and nobodies heard of it?  Easily… it's big in Japan.  Ah.

So then, why the hell am I babbling on about Shade?  Well, this announcement recently crossed my desk:

Publisher Mirye Software and developer E Frontier announce the free 3D game content development system for indie developers and professionals will soon be available for developers on Mac OS X.

Shade 3D for Unity is based on the professional 3D modeling, animation and rendering tool set Shade, a product available for over 27 years and used worldwide by illustrators and designers. Shade 3D for Unity enables designers and game developers to build animated project content that integrates with Unity 3D, the game development system for Windows, Mac OS X, iOS, and Android.

Workflow integration makes it is easy to share project assets (Configuration Files) of Unity in Shade 3D for Unity and easily transfer content between them.

Snip…

Shade 3D for Unity includes an advanced tool set for creation of original 3D content:

* Import/Export integration with Unity 3D
* Advanced 3D Modeling Environment
* Polygon Mesh Editor
* UV Editor and Image Management
* Design friendly Bezier Spline Modeler
* Powerful Object Instancing Features
* 3D Object Hierarchy Browser
* Material Setting Features
* Material Parameter with Texture Map Settings
* Animation Setting Feature
* Draft Ray Tracing Renderer

Interesting…

Perhaps most interesting of all is the price tag.  Free.  I like free.

That said, the last free product 3D product I tried out was Daz3D and I am still getting half a dozen spam emails a week from them ( serious Daz, quit it, or make your freaking unsubscribe functionality work! ), so free isn't always free.  Mirye certainly intends to make money somehow, just not sure of exactly how as of yet.  My guess is they are following Daz's model of selling content, or perhaps it's an attempt to upwell you to Shade Professional.

Shade for Unity isn't actually out yet, don't expect it until November.  You can read more details on their site.  They also currently have a utility for using Shade with Unity on the Unity Store called the Shade Unity Loader.  

 

 

Now if you will forgive me, I'm off to play with my new toy.  It's always cool to find another professional caliber 3D application, especially one with a price tag starting at 99$!  I will post a bit more detail on my experiences with Shade 12 trial shortly.

Art, News ,

Month List

Popular Comments

Unity Release Patch 5.4.2p4
Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon


9. November 2016

 

Unity have just released another patch, this one 5.4.2p4.  This patch consists entirely of fixes, listed below.

Fixes
  • (845815) - Animation: Fixed an issue where Legacy animations could not be previewed.
  • (830110) - Asset Pipeline: Fixed a regression where AssetDatabase.SaveAssets won't save changes made to a prefab inside OnPostprocessAllAssets.
  • (none) - Audio: Fixed a panning issue with spatialized sounds.
  • (829898) - Build player: Reverted the change, which saved relative paths for build target but introduced issues for targets that needed to browse for folders instead of files (webGL, etc).
  • (824011) - Editor: Fixed a crash in RectTransform because it would send messages on the loading thread.
  • (none) - Graphics: Fixes a memory leak when using the GI visualizers in the scene view.
  • (832368) - IOS: Fixed an input reset in editor when iOS device without Unity Remote is selected
  • (834172) - IOS: Fixed issues with iOS Input.touchPressureSupported incorrectly reporting false.
  • (839037) - iOS: Build and Run now doesn't clean Xcode project for Append builds.
  • (836165) - Mac Editor: Fixed a crash when using Build and Run for iOS projects.
  • (843181) - Mac Editor: Fixed editor hanging if app was already running in Xcode 7.x when using Build and Run.
  • (819998) - OpenVR: Fixed a crash in certain conditions when checking if device is available.
  • (818159) - OpenVR: VRDevice.isPresent now works correctly when HMD is occluded from base stations.
  • (819092) - Shadows/Lights: Fix for dark lightmap when changing sun shadow strenght in mixed mode.
  • (829379) - VR: Fixed a crash when switching between VR mode and non-VR mode with image effects applied.
  • (817835) - VR: Fixed VRSettings.renderViewportScale when single-pass stereo rendering is enabled.
  • (821570) - Windows Store: Fixed a crash in multi scene system caused by internal managers being garbage collected.

The patch can be downloaded here.

GameDev News

blog comments powered by Disqus

Month List

Popular Comments