• Microsoft UK Faculty Connection

    Using Unity3d and Azure Cloud

    • 0 Comments

    One my colleagues Dave Douglas has been some work in educating game developers on the power of having a cloud backend to their games

    Dave has made some great  quick-start tutorial is for Unity3D game developers who would like to get a cloud backend that runs across multiple platforms (including the Unity Editor for quick testing).

    One of the big advantages for game devs using Unity3D is that it supports so many platforms additionally Unity have a great set of resources for windows Developers including amazing FREE tools like Visual Studio tools for Unity and some amazing offers and resources

    image

    It’s fair to say more people own more than one device that connects to the internet and a lot of them can run apps and games.

    The number of connected devices more than number of people.

    While the platforms and ecosystems may differ as a gamer I would like to play the same game across any device (and on any platform) and expect things to sync. Azure Mobile Services is a ‘Backend as a Service’ which supports multi-platform app development. In Unity the BitRave plugin for Azure Mobile Services is designed to just work on any platform that Unity supports.

    Dave Douglas @deadlyfingers one of my colleagues in Microsoft UK has done the following walkthroughs of how to get started.

    Watch getting started with Unity BitRave Azure plugin running on iOS and Android

    Watch getting started with Unity Prime 31 Azure Plugin running on Windows 8 and Windows Phone

    You can Also read his blog with the complete walkthrough documented at

    http://www.deadlyfingers.net/azure/unity3d-and-cloud-backend-using-azure-mobile-services-and-prime31-plugin/

    http://www.deadlyfingers.net/azure/unity3d-game-dev-with-azure-mobile-services-using-bitrave-plugin/

    There are more training resources for game developers at Microsoft Virtual Academy http://www.microsoftvirtualacademy.com/training-topics/game-development

  • Microsoft UK Faculty Connection

    Windows Games Ambassador & student Tim Stoddard nominated for a TIGA Games Industry Award

    • 0 Comments

    Guest blog by Tim Stoddard, Staffordshire University @Gamepopper

    Standing out above the crowd

    My discovery into games development came from an opportunity at A-Levels to make a project on anything, so I decided to make a game using GameMaker 8. I decided to pursue making computer games in University, when I transferred from Computer Science to Computer Games Programming. After making a few games for the Windows Store, I decided I wanted to make one fairly large indie game, and being a student is the best time to do it.

    So for the duration of a year, I was working on a game part time, during my degree and placement, and mostly on my own.

    So what is the Game?

    The game was Secret of Escape, a top-down stealth action game developed in Construct2. The game has since been released on Desura, Itch.io and IndieGameStand, as well as being shown at several game events such as Launch Conference, Norwich Games Expo, Insomnia52 and London Gaming & Anime Con. But out of all the moments I’ve had from making a game, the one that surprised me the most was Secret of Escape being nominated for the TIGA Games Industry Award for Best Student Game.

    clip_image002

    I submitted my game to the awards because I figured it might be a good chance, and the process of entering was straightforward. All you needed to do was enter your details, choose which category you wanted to submitted to, and upload both a copy of your game and a video and give a reason why you should win the award. Then in mid-October I got an email which showed my game as shortlisted for Best Student Game, needless to say I was excited.

    What is your advice?

    If there is any word of advice I would give here, it would be this. If you are ever nominated for an award, go to the award ceremony. Not only is it a moment to be proud of an achievement in your career, and is common courtesy to accept an award in person if you win, but an awards ceremony is a big opportunity to network and speak to professionals from all parts of the industry.

    clip_image006clip_image004

    I had the opportunity of speaking with people from indie developers such as Futurlab (Velocity 2X), Evil Twin Artworks (Victory At Sea), Sumo Digital, all the way up to large studios such as Rebellion (Sniper Elite III) and Bullfrog Productions (Fable Anniversary). Not to mention people who work in Recruitment (Aardvark Swift and Amiqus), Accounting, and Quality Assurance.

    clip_image008clip_image010

    Of course there was the ceremony, with the nominees of each award being displayed on large monitors, some with footage of the games being shown. I got to see my game being shown during the Best Student Game, and cheer at excitement for seeing it there. I also cheered when Staffordshire University was shown during the Best Education Initiative award. I was also sitting with the developers at Bullfrog, so I gave my support for them too.

    Sadly I didn’t win, but being nominated and going to the award ceremony is definitely one of the highlights as a game developer. Hopefully one day I’ll return and take a trophy home with me, so I guess it’s time to start working now..

    Tim excellent stuff and great to see you making the right steps!

    So if your a student and interested in standing out above the crowd go and build a game for the players and not for yourself!!

    Enter the www.Imaginecup.com gaming competition or individual competition like http://gradsingames.com/competitions/search-for-a-star/ and http://gradsingames.com/competitions/sumo-digital-rising-star/

  • Microsoft UK Faculty Connection

    Building a Azure Backend for an Android App

    • 0 Comments

     

    One of the great things about Windows Azure is its platform agnostic

    image

    So if your building games for Android check out the following videos by Dave Douglas http://www.deadlyfingers.net/ a fellow Microsoft Technical Evangelist on building a Azure backend to your game.

    Part 1

    Create android app with cloud backend (Part 1: Azure Mobile Service)

    http://youtu.be/EV6DPafCntA

    Part 2

    Create android app with cloud backend (Part 2: Table Permissions and OAuth)

    http://youtu.be/ige5xpDsJuk

    Part 3

    Create android app with cloud backend (Part 3: Push Notifications)

    http://youtu.be/Zx78vrELgXk

    If your interested in trying out Azure apply online at www.azure.com or register for our special game dev offer http://aka.ms/gamedevoffer

  • Microsoft UK Faculty Connection

    Are you a Mac user who wants to use Visual Studio and build .Net applications

    • 0 Comments

    Well the answer is yes you can!

    At the Connect() developer event in New York City.  We announced a number of new capabilities coming with the Visual Studio 2015 and .NET 5 releases and some exciting news regarding .NET Open Source and Visual Studio Community editions.  You can watch the event on-demand here.

    But here is a quick summary

    Open Sourcing the .NET Core Runtime and Libraries

    Open sourcing the .NET Core Runtime.  This will include everything needed to execute .NET code – including the CLR, Just-In-Time Compiler (JIT), Garbage Collector (GC), and core .NET base class libraries. We are releasing the source under the MIT open source license and are also issuing an explicit patent promise to clarify users patent rights to .NET.  This is published on the public GitHub https://github.com/dotnet/corefx

    The source release includes many of the newer core .NET framework libraries (ImmutableCollections, SIMD, XML and MetadataReader).  These libraries are fully open, and are ready to accept contributions.  Over the next several weeks and months we will continue to transfer source (including the Core CLR which is not there right now but in the process of being moved) into the repository and likewise make it open for contributions.

    What does this open sourcing mean?

    The open source announcement, simply means that developers will have a fully supported, fully open source, fully cross platform .NET stack for creating server and cloud applications – including everything from the C#/VB compilers, to the CLR runtime, to the core .NET base class libraries, to the higher-level .NET Web, Data and API frameworks. 

    Announcing .NET Core Framework on Linux and OSX

    Last month at a Cloud Event held in San Francisco, Satya Nadella, Microsoft CEO – showed a slide like this one where he talked about how Microsoft loves Linux:

    image

    We’ve worked hard with Azure to make it a first-class cloud platform for Linux based applications, and shared how more than 20% of all VMs running on Azure are Linux based.  In fact, we now have a number different Linux distributions officially supported for use on Azure – with full integration within our management portal and command-line extensibility.

    Which now include Ubuntu, CoreOs, Centos, Suse, Oracle Linux and Puppet Labs

     

    Bringing Core .NET to Linux and OS X

    In addition to making the .NET server stack open-source, we are also going to release an official distribution of the .NET Core for Linux, as well as an official distribution of .NET Core for the Mac operation system as well.

    This will enable you to build .NET server and cloud applications and run them on both Windows Server and Linux.  It is going to enable every developer – regardless of what operating system they use to develop or target – to use .NET. And to do so on a fully open source runtime.

    We will be working closely with the Mono community as we complete our Linux port.  The Mono community have done a great job advancing .NET and Linux over the last decade.  Releasing the .NET Core source under an open source license is going to enable us to collaborate together much more closely going forward. 

    Visual Studio Community Edition

    A new free edition of Visual Studio -  Visual Studio Community 2013 edition is a full-featured IDE.  It supports multiple project types in one solution file in a single IDE, and has all of the productivity features and IDE extensibility capabilities (meaning you can use Xamarin, ReSharper, VsVim, and any other VSIX extension) that developers love in Visual Studio.

    It is now available completely free for:

    • Any individual developer working on a commercial or non-commercial project
    • Any developer contributing to an open source project
    • Anyone in an academic research or course setting (e.g. students, teachers, classroom, online course)
    • Any non-enterprise organization with 5 or fewer developers working on a commercial/non-commercial project together

    There is no program you need to join to use it – simply visit www.visualstudio.com, click the download button. 

    Visual Studio Community Edition Virtual Machine

    It is going to enable even more developers to take advantage of Visual Studio and build even better applications.  We are looking forward to seeing what you build with it. Additionally if your a Mac User you can now spin up a virtual machine running community connect as part of an Azure.

    The Visual Studio Community 2013 image enables you to unleash the full power of Visual Studio to develop cross-platform solutions. Create apps in one unified IDE, and incorporate new languages, features, and development tools into them with Visual Studio Extensions (available in the Visual Studio Gallery).

    Pricing Information

    Pricing varies based on the subscription you select to provision your virtual machine see http://azure.microsoft.com/en-us/pricing/calculator/?scenario=virtual-machines but as an example you could spin up a D3 Series Windows Virtual Machine with 4 Cores and 14GB Ram with a 250GB SSD drive for 1.42 Euro per hour and simply only pay per the hour by turning the machine off when not required.

    Summary

    It has never been a better time to be a software developer. 

    With the provision of FREE Software and Visual Studio Community edition it will now enable organizations to succeed in today’s digital environment.

    Using the cloud, every software developer on the planet can now create and build solutions that can reach millions of users, with no upfront costs, powered by a cloud infrastructure that delivers completely global reach.  The impact an individual developer can now have has never been greater than it is today.

    .NET open source, cross platform, and Visual Studio Community edition announcements will enable the development technology we build to be leveraged by an even wider range of developers and across all mobile platforms

    Developers can now use the breadth Microsoft’s tools and services for free with Visual Studio Community 2013 tools for developing applications from mobile and desktop to web and cloud, Azure Free Trial providing hosting for 10 websites + 10 mobile services, and Visual Studio Online offering developer services free for up to 5 users.  You can get started with all three offers today.

    The Event and official announcements

    You can watch the online presentations here.  Also read Soma’s blog post for a summary of some of the new VS 2015 and .NET 5 capabilities

  • Microsoft UK Faculty Connection

    Internet Explorer and Xbox Controller support for games

    • 0 Comments

     

    image 

    xbox-controller

    Internet Explorer Developer Channel went experimental implementation of W3C Gamepad API and you can use your controller to create games on HTML / JavaScript as for Web applications and for Windows 8:

    <!DOCTYPE html>
    <html>
    <head>
    <title>Gamepad API Sample</title>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <script> function gameLoop() { var gamepads = navigator.getGamepads(); for (var playerIndex = 0;
    playerIndex < gamepads.length; playerIndex++) { var gamepad = gamepads[playerIndex];
    if (gamepad) { if (gamepad.buttons[6].pressed || gamepad.buttons[7].pressed)
    {
    // A trigger is pressed, fire weapon. fireWeapon(playerIndex);
    }

    } 
    } window.requestAnimationFrame(gameLoop); 
    } 
    gameLoop(); 

    </script>
    </head>
    <body>


    If you want to implement gamepad support in the game to HTML5 for Windows 8 now, not waiting for the release of the next version of Internet Explorer, you can use the wrapper over XInput for Javasctipt.

    Resources

    Windows 8 XInput and JavaScript controller sketch sample

    https://code.msdn.microsoft.com/windowsapps/XInput-and-JavaScript-c72fe535

    Building games with controller support?

    Love to hear from you..

  • Microsoft UK Faculty Connection

    Building game with Xbox Controller Support

    • 0 Comments

    xbox-controller

    Xbox One Wireless Controller can work with your PC if you download one of the following driver packages:

    Note To use your Xbox One controller with your console after using it with a PC, you must re-sync the controller to the console. You can do this by using the wireless sync button or a USB cable. For details, see Connect a wireless Xbox One controller to your console.

    If you want to use an Xbox 360 Controller with your computer, you can use an Xbox 360 Controller for Windows. Or, you can use an Xbox 360 Wireless Controller together with an Xbox 360 Wireless Gaming Receiver for Windows.

    Related Issues

    Connect a wireless Xbox One controller to your console
    How to assign a profile to an Xbox One Wireless Controller


    Getting to Grips with the API 

    The main method of work with a gamepad in Windows is to use the C ++ API XInput . http://msdn.microsoft.com/en-us/library/windows/desktop/ee417001(v=vs.85).aspx  Noteworthy is the absence of initialization functions, you simply query the state of the controller:

       1: XINPUT_STATE state; 
       2:  
       3: DWORD result=XInputGetState(0, &state); 
       4:  
       5:  
       6: if (result == ERROR_SUCCESS) 
       7:  
       8: { 
       9:  
      10:   if (state.Gamepad.wButtons & XINPUT_GAMEPAD_A) 
      11:  
      12:   { 
      13:  
      14:    
      15:  
      16:   } 
      17:  
      18: } 

    XInputGetState function takes as parameters the index controller (they can be connected to more than one) as well as with the state of the structure where the return value of buttons:

     

       1: { 
       2:  
       3:     DWORD                               dwPacketNumber;  
       4:  
       5:     XINPUT_GAMEPAD                      Gamepad; 
       6:  
       7: } XINPUT_STATE, *PXINPUT_STATE; 
       8:  
       9:  
      10: typedef struct _XINPUT_GAMEPAD 
      11:  
      12: { 
      13:  
      14:     WORD                                wButtons;  
      15:  
      16:     BYTE                                bLeftTrigger;  
      17:  
      18:     BYTE                                bRightTrigger; 
      19:  
      20:     SHORT                               sThumbLX; 
      21:  
      22:     SHORT                               sThumbLY; 
      23:  
      24:     SHORT                               sThumbRX; 
      25:  
      26:     SHORT                               sThumbRY; 
      27:  
      28: } XINPUT_GAMEPAD, *PXINPUT_GAMEPAD; 


    Buttons coded bits:

       1: #define XINPUT_GAMEPAD_DPAD_UP          0x0001 
       2: #define XINPUT_GAMEPAD_DPAD_DOWN        0x0002 
       3: #define XINPUT_GAMEPAD_DPAD_LEFT        0x0004 
       4: #define XINPUT_GAMEPAD_DPAD_RIGHT       0x0008 
       5: #define XINPUT_GAMEPAD_START            0x0010 
       6: #define XINPUT_GAMEPAD_BACK             0x0020 
       7: #define XINPUT_GAMEPAD_LEFT_THUMB       0x0040 
       8: #define XINPUT_GAMEPAD_RIGHT_THUMB      0x0080 
       9: #define XINPUT_GAMEPAD_LEFT_SHOULDER    0x0100 
      10: #define XINPUT_GAMEPAD_RIGHT_SHOULDER   0x0200 
      11: #define XINPUT_GAMEPAD_A                0x1000 
      12: #define XINPUT_GAMEPAD_B                0x2000 
      13: #define XINPUT_GAMEPAD_X                0x4000 
      14: #define XINPUT_GAMEPAD_Y                0x8000 

    Slightly more complicated is the values ​​of the hammers and two joysticks.  The values ​​of X, Y, are within SHRT_MIN-SHRT_MAX (-32768 +32767), and for the hammers _UI8_MAX (255).  Usually in games, these values ​​are normalized to -1.0 +1.0.  Also for joystick should consider the so-called dead zone.  Return values ​​axes at the neutral position can vary from zero, and to disregard them use the default values ​​of "dead zones", which should be computed by the following algorithm:
       1: float magnitude = sqrt(state.Gamepad.sThumbRX*state.Gamepad.sThumbRX 
       2:  
       3: + state.Gamepad.sThumbRY*state.Gamepad.sThumbRY); 
       4:  
       5:  
       6: if (magnitude > XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE) 
       7:  
       8: { 
       9:  
      10: } 

    Typical values ​​of these thresholds are as follows:
       1: #define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE  7849 
       2: #define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689 
       3: #define XINPUT_GAMEPAD_TRIGGER_THRESHOLD    30 


    You can look at more detailed examples of work with a gamepad online http://code.msdn.com as well as take advantage of the wrapper which is part of DirectX Toolkit .
     

    XInput game controller sample

    This sample demonstrates the use of the XInput APIs in a C++ app.

    Download C++ (61.0 KB)

    Resources

    http://msdn.microsoft.com/en-us/library/bb648761.aspx XInput Controller Sample

    In addition to the functions directly related to the status polling controller to XInput also includes management features vibrating motor and is connected accessory, such as a voice recorder with a headset or audio to the headset. Support also has a joystick for managed code in the library and XNA Monogame .

    headset

    Get in touch?

    So if your building a game or have built a game for Windows 8 with Controller support please get in touch as I would love to share your experience!

  • Microsoft UK Faculty Connection

    Creating Your First Marmalade Game 20th Nov

    • 0 Comments

    image

    ​If you're looking to build games and want a fun (and free) high-performance, cross-platform development tool, take a good look at Marmalade. Learn to use the Marmalade interface, hear how to develop the basic components and structure of a game, explore scene management, and get the details on Marmalade tools, Marmalade Quick, and Lua.


    In this first of two Jump Start training courses with live Q&A, you're in for a treat and lots of demos as experts Lee Stott and James Mintram walk you through an entire game build, help you create (and avoid) space aliens, and explore game loops, graphics, and collisions. You even look at monetization and learn how to publish your first game. Get ready for some fun and games (literally)!

    Course Outline:

    • Develop Games Using Marmalade for Windows 8 and Windows Phone 8
    • Marmalade Quick and Lua Scripts
    • Essential Concepts for Developing with Marmalade
    • Bring Your Games to the Windows 8 Platform

    Register Now

  • Microsoft UK Faculty Connection

    Marmalade Game Porting Lab Nov 14th Hull

    • 0 Comments


    Remember: there's only one week until Platform Expo in Hull!

    Join members of the Marmalade and Microsoft teams at our upcoming Porting Lab.

    At this free event you'll learn about the Marmalade toolset and how to port your app to the Microsoft platform. With two tracks for beginners and experts, and several rounds of prize draws for successful ports, it's going to be a great way to meet fellow Marmalade developers and learn by doing.

    Find out more about Marmalade & Microsoft Porting Lab

      Native Performance. Any Device.

    www.madewithmarmalade.com

  • Microsoft UK Faculty Connection

    Windows Developer Offer from Marmalade

    • 0 Comments

    Today Marmalade  launched a brand new Developer Offer for Windows Phone Store and Windows Store.


    If you already have a good quality app, then participating in this Developer Offer is simple and rewarding. Using Marmalade to publish your app to Windows Phone Store and/or Windows Store will earn you a Windows Phone device and Windows 8.1 license, a Marmalade Indie license (worth $499) and $100 in PayPal gift vouchers. Simple!

    For more information about the Windows Developer Offer, visit our website.

     

      Native Performance. Any Device.

    www.madewithmarmalade.com

  • Microsoft UK Faculty Connection

    Getting Started building your first game in Lua with Marmalade Quick Part1/2

    • 0 Comments

    Marmalade Quick and Lua are perfect new developers, but for experienced programmers, be prepared to experience a different kind of syntax. For example,

    image 

    If your a C# developer you will be used to loops looking like this (c# example):

       1: for (int i = 0; i < 50; i++)
       2:  
       3: {
       4:  
       5: }
     
    There are no brackets in Lua, and variable types.
     
       1: for i = 1, 50
       2:  
       3: do
       4:  
       5: end

    In Lua everything is one type of variable, but it is how you use it that reflects what exactly it is. For more quick information on Lua, see this great blog by Nick Smith from Marmalade here. Some key things (variables, functions, listeners, etc are all still valid).  Lua does however miss objects, but you can add objects can be added.

    One of the key advantages of Quick and Lua is you can make some really great things with half the code that you would usually write when using other engines. The fact that box2d as well as the other API’s are already packed into the engine make it pretty extendable for more detailed information, check out our documentation.

    Getting Started
    You will need to have Marmalade installed you can get it for FREE  from here.
    Next, I have prepared a few assets for a quick tutorial. these can be downloaded from https://github.com/leestott/MarmaladeQuick

    Knowledge of quick and lua is preferred, but not required. I will try to be as detailed as I can. I suggest you make a start with the 101 of development a Hello World Example you can make a Quick Hello world app in 5 minutes by following the guide here.

    Creating a Game with Marmalade Quick

    Ok, so let’s get building a flappy bird clone!

    clip_image001

    After clicking Marmalade Quick (that big Q in the middle), you will need to hit ‘Create New Project’ on the bottom left.

    clip_image002

    You will then be presented with a screen which allows you to add some details to your project,  Press hit ‘Create Project’!

     

    clip_image003

     

    clip_image004

    Ok so you have created your first Marmalade Quick project is up and ready .

    Using the Hub, you can change your target platform and even edit certain configurations for specific platforms. Let’s deploy it to x86, which uses the Marmalade Simulator on Windows and Mac, and see how it looks in the Platform drop down choose Simulator x86

    clip_image005

    So you should have a black screen.

    This is exactly what we want. The command line is showing the build process as well as a debug message that says ‘This is my app!’, and the simulator is showing nothing. Considering we just created a new project.

    You can close the simulator as we know this working we now need to do a bit of preparation before we can get coding.

    On the bottom left of the Hub, hit the drop down menu under ‘Action’, and press ‘Open Project Directory’.

    clip_image004

    clip_image006

    You will now be in the Project Directory of your application.

    Open the ‘Resources’ folder, and you should be presented with the Lua files and folders.

    We now need to add all our assets to this folder structure. downloaded from https://github.com/leestott/MarmaladeQuick

    So take the of the ‘Assets’ folder  and paste them into the Resources Folders.

    Take the files out of ‘quicklua+’:  and put it into your own ‘quicklua’ folder in your project (overwrite if asked).

    clip_image007

    This is the folder hierarchy which has just been created

    · ‘fonts’ folder - allows you to specify alternative fonts

    · ‘gfx’ folder - where we will keep our graphics (I have provided some for you already)

    · ‘quicklua’ folder - the prebuilt Marmalade Quick APIs that we will be using

    · ‘sfx’ folder - includes some sounds we will use in our game

    · app.icf - modify certain behaviours at runtime

    · class.lua - a prewritten Lua file which allows for object oriented development (see here for more info)

    · common.icf - more configuration settings

    · development.icf - automatically generated settings file

    · game.lua - this is where most of the game code will take place

    · main.lua - the entry point to our application

    · menu.lua - our main menu!

    · object.lua - Allows us to use objects (more on that later...)

    -modebug.lua – Allows us to debug the lua code in ZeroBrane

    What I need you to do first is edit your app.icf file, and add the following:

       1: [S3E] 
       2: MemMgrMaxAllocWarning=0 
       3: DispFixRot=FixedPortrait 
       4:  
       5: [GL] 
       6: VirtualWidth=480 
       7: VirtualHeight=800 
       8:  
       9: [QUICK] 
      10: mainFilename="main.lua" 

    Why edit App.icf?

    What the above code does is  fixing the orientation to portrait. Why? Well, Flappy Bird is primarily a portrait game, so if the user decides to rotate their phone, we don’t want the game rotating with it so we want to lock the orientation to FixedPortrait

    As for our virtual widths and heights, we want our app to run on multiple devices and platforms with all kinds of screen sizes and ratios. Our solution is to build the game at dimensions of 480x800, which means that our game’s display surface will always scale to fit the full device screen with these dimensions in mind. See here for more info.

    Setting ZeroBrane as the Default IDE for .lua files

    Go back to the directory of your application, right click one of your Lua files, hit ‘Properties’, and next to ‘Opens with:’ press change. Then navigate to your Marmalade install folder, and go to:

    "quick\tools\ZeroBraneStudio"

    Open ‘zbstudio.exe. Zero Brane Studio is an IDE for Lua code which we package into the SDK. You only need to do this once.

    And now we can code! First things first, add the following to main.lua:

       1: -- Imports 
       2: dofile("menu.lua") 
       3: --

    image

    You need to set the project directory so we can see just our project select Project\Project Directory\ Set from current file

    image

    Also you need to set Marmalade Quick as the Lua Interpreter

    image

    We will need to to allow debugging of the app and testing of the app within the Marmalade Simulator

    Ok next we need to add the menu into the game this will be the first thing the user sees.

    The ‘--’ are simply comments, and will not be compiled by Marmalade Quick at run time.

    add the following to menu.lua,

       1: -- Creates scene 
       2: menuScene = director:createScene() 
       3:  
       4: -- Create background: 
       5: local background = director:createSprite(director.displayCenterX, director.displayCenterY, "gfx/background.png") 
       6: background.xAnchor = 0.5 
       7: background.yAnchor = 0.5 

    All we are doing here is creating a global variable called MenuScene which holds our menu scene.

    As we have not called local before the variable name, it is automatically global and will be accessible from other parts of the application.

    Next, we make a new local sprite called background. Here, we place it in the middle of the display, and then load the image we want. We also change the x and y anchor of the sprite which affects the coordinates of the node’s anchor point.

    Hit save all within ZeroBrane, and press the run button

    image

    The Simulator will load and display a screen with the background for the main menu.

    Building the menu

    We need a scene changer.

    The scene changer  will allow us to change scenes in our app. Go to your menu.lua and add:

       1: -- Switch to specific scene
       2:  
       3: function switchToScene(scene_name)
       4:  
       5: end

    So what we have done here is create a function called ‘switchToScene’ which takes in one parameter. Specifically, the name of the scene we want to move to. 

    We haven’t put local before ‘function’, so it is automatically global and accessible from other lua files.

       1: -- Switch to specific scene
       2:  
       3: function switchToScene(scene_name)
       4:  
       5:  if (scene_name == "game") then
       6:  
       7:     dofile("game.lua")
       8:  
       9:     director:moveToScene(gameScene)
      10:  
      11:   end
      12:  
      13: end

    In this code we are comparing the parameter passed into the function.

    Specifically, ‘scene_name’. We are saying that if the ‘scene_name’ variable is equal to the string “game”, then we will import our game.lua file, and then move to that scene using the director.

    Adding a Start Button to the menu Screen

       1: local playButton = director:createSprite(director.displayCenterX, director.displayCenterY, "gfx/start.png")
       2:  
       3: playButton.xAnchor = 0.5
       4:  
       5: playButton.yAnchor = 0.5

    Adding a function to call a new game

       1: function newGame(event)
       2:  
       3: if event.phase == "ended" then
       4:  
       5: -- Switch to game scene
       6:  
       7: switchToScene("game")
       8:  
       9: end
      10:  
      11: end

    We call this function when we want a new game using the ‘switchToScene’ function. 

    We are passing the user’s touch into the function, and then checking the state of the touch. In Marmalade Quick, we have 3 states for touch:

    • began - when the user first touches
    • moved - when the user moves their finger
    • ended - when the user takes their finger off the screen

    In this case, we are saying, call the function when the user takes their finger off the button. Don’t forget to pass in “game” as the scene switcher parameter, so the app knows which scene to go to.

    We have our function that will take the user from the menu to the game scene, but it isn’t connected to the ‘start’ sprite yet. Even at this point, it is still a sprite. We now need to use something called an event listener. Add this under your playButton code:

       1: playButton:addEventListener("touch", newGame)

    What this line does is add an event listener to the playButton. This means that it is now waiting for something to happen. When that event does happen, it will react accordingly. In this instance, our event listener is waiting for a ‘touch’, and when the play button is touched, the newGame function will be called.

    Making the Game Scene

    Go to game.lua and add the following:

       1: gameScene = director:createScene()
       2:  
       3: local label = director:createLabel(0, 0, 'Hey - welcome to the game scene.\nCome here often?')

    Again this scene is global like our menu scene.

    We have also created a bit of text using a label and we then display it to the user.

    Adding a Game Title to your menu screen

    Go to menu.lua file code. Make sure it is after the background code so that the text isn’t drawn underneath it.

    The \n after Flappy Bird is an escape character by the way. It allows us to write on different lines). As you can see, we also change the colour of it. As a node, you can do all sorts of things to it. See here:

    But yes, the code:

       1: local gameTitle = director:createLabel(0, director.displayCenterY+(director.displayCenterY/2), 'Flappy Bird\n A New Developer")
       2:  
       3: gameTitle.color = color.blue

    image

    So now we can create a button in your game scene that once pressed, goes back to the menu scene. All you will need to do is pass in the “menu” string to our global scene switcher function in main.lua.

    Ok lets now add some code to game.lua: so delete the text

    local label = director:createLabel(0, 0, 'Hey - welcome to the game scene.\nCome here often?')

    and add the following

       1: local background = director:createSprite(director.displayCenterX, director.displayCenterY, "gfx/background.png")
       2:  
       3: background.xAnchor = 0.5
       4:  
       5: background.yAnchor = 0.5
       6:  
       7: background.rotation = 180
       1: local player = director:createSprite(director.displayCenterX/2,director.displayCenterY + (director.displayCenterY/2), "gfx/player.png")
       2:  
       3: player.xAnchor = 0.5
       4:  
       5: player.yAnchor = 0.5

    What is really great about Quick is that it supports Box2d physics engine. So we can simply add physics to the player and world and we can do this by adding this line of code under our player:

       1: physics:addNode(player, {radius = 21})

    If you press run, your ball should slowly fall off the screen and increase in speed while doing so.

    In Part 2 we will continue with the development of  the game.

    For more details on Marmalade see http://www.madewithmarmalade.com/windows

    Windows Developer Offer

    Just Apply, Port & Publish! Spreading your game to the Windows Store and Windows Phone Store is super-easy with Marmalade and you could bag up to $1000 of incentives.

    To qualify, your game will need to:

    • Have received a 3 star rating or above and/ or your game has at least 5,000 installs (if premium/paid) or 50,000 installs (if free-to-play)

    If your game does not meet the above criteria, it can still qualify. Submit it for evaluation and your entry will be evaluated on the following criteria:

    • Whether your game has innovative content and is clearly differentiated from other games in the same genre
    • Developer track record in shipping quality games on mobile or other platforms
    • Overall quality of the user experience and presentation

    What’s in it for you?

    • $100 PayPal gift voucher
    • A priority review for Windows Phone Store promotion
    • A developer account token for the Windows Phone Store
    • A license to Windows 8.1 Pro (worth up to $200)
    • A Windows Phone device (at Microsoft’s discretion and subject to availability)
    • A Marmalade Indie license (worth $500)

    How to participate

    1. Register or login

    You need to be logged in to sign up for the offer

    2. Sign up for the offer

    Once you have submitted your application, someone from Marmalade will be in touch to let you know if you have been accepted onto the program.

    3. Get tooled up

    Once accepted you’ll receive:

    • a developer account token for the Windows Phone Store
    • a license to Windows 8.1 Pro (worth up to $200)
    • a Windows Phone device (at Microsoft’s discretion and subject to availability)
    • a Marmalade Indie license (worth $500)

    4. Develop and Port

    Develop or port an innovative, functional app using Marmalade.

    • read the porting guides, which cover everything you need to know about configurations, SDKs, general considerations, and first steps
    • complete your Windows Phone app

    5 Publish your app to the Windows Phone Store and Windows Store *

    To publish to the Windows Store or Windows Phone Store you will need a developer account. Email us at windows@marmalademail.com for a developer token code that you can use to create an account free of charge, if you have not already received one.

    *Game must be published between 1st Nov 2014 and 31st March 2015 to qualify.

    6 Reap your reward

    Once you have published your app to Windows Phone Store and Windows Store don’t forget to let us know to receive extra rewards.

    • $100 Paypal gift voucher
    • priority review for Windows Phone Store promotion

    Sign up for the offer

Page 1 of 96 (953 items) 12345»