• Register
Post tutorial Report RSS Hello Wave

Wave Engine® is the ultimate solution for cross-platform game development in C#. It provides all tools needed to create 3D or 2D games in very different hardware platforms: by unifying access to device sensors and capabilities, integrating 2D & 3D physic engine, integrates with Visual Studio, and it is designed as a fluent API.

Posted by on - Basic Client Side Coding

Wave Engine® is the ultimate solution for cross-platform game development in C#. It provides all tools needed to create 3D or 2D games in very different hardware platforms:

  • by unifying access to device sensors and capabilities,
  • integrating 2D & 3D physic engine,
  • integrates with Visual Studio,
  • and it is designed as a fluent API.

With these key points in mind, you can use all the skills you already have in C# to create fabulous games for:

  • Android®
  • iOS®
  • OUYA
  • Windows Phone
  • Windows 8
  • Windows 7
  • MacOS
  • Linux (Comming soon)

Wave Engine® Foundations
There are three very basic concepts to understand how we can create games with Wave Engine®. They are very simple and we need to explain them just to unify the language we are going to use while we develop with Wave Engine:

  • Scene: represents the world where we are going work and provides mechanisms to interact with it, like adding elements or behaviors, it let us manage the game lifecycle in a very simple way.
  • Component: represents the very simple element we can create in our world.
  • Entity: represents a Components collection created dynamically to let us create more complex element that live in our world.

A well analogy of this three basic concepts could be that a Scene represents a planet, for example the Earth planet, the Components are the very first cells that appear millions years ago, and an Entity could be from the first unicellular organism appeared till a human being.

Hello, Wave Now we know the basic concepts about Wave Engine® we can start by creating our first project with Visual Studio 2012. Go to "File/New Project..." and select the WaveEngine node under Installed/Templates/Visual C# node:

Set project name as "HelloWave", and click OK button.

Visual Studio® will create a solution with two projects: "HelloWave" and "HelloWaveProject"

HelloWave contains the game entry point of our game and acts as a launcher for it.
HelloWaveProject contains all classes, Scenes, Components and Entities that make our game lives.

The code
We are going to write the code needed for our first game with Wave Engine®.

Go to MyScene.cs, it only contains CreateScene method, and we are going to add the code needed to have a spinning cube. First we need to add this usings:

using WaveEngine.Common.Math;
using WaveEngine.Components.Graphics3D;
using WaveEngine.Materials;
using WaveEngine.Components.Cameras;
using WaveEngine.Framework.Graphics;

Now you can replace CreateScene method with this one:

        protected override void CreateScene()
        {
            var camera = new FreeCamera("Main", new Vector3(0, 2, 4), Vector3.Zero)
            {
                BackgroundColor = Color.White
            };
            EntityManager.Add(camera);

            Entity cube = new Entity()
                .AddComponent(new Transform3D())
                .AddComponent(Model.CreateCube())
                .AddComponent(new Spinner() { AxisTotalIncreases = Vector3.One / 2 })
                .AddComponent(new MaterialsMap(new BasicMaterial("Content/crate.wpk")))
                .AddComponent(new ModelRenderer());

            EntityManager.Add(cube);
        }

Creates a camera called "Free Camera" with the position in the 3D axes : (2.5,2.5,2.5), and it is looking at the world origin (0,0,0)

After camera creation, it is created an Entity that will represent a cube in our world. Remember that Wave Engine® it is designed as a fluent API so the creation of our cube will consist by:

  • Initialize the Entity
  • Add the model
  • Add the texture with a MaterialMap
  • Add a Transform3D component
  • Add a ModelRenderer
  • Add a spin behavior with Spinner component

So the code is:

var cube = new Entity("Cube")
      .AddComponent(Model.CreateCube())
      .AddComponent(new MaterialsMap( new BasicMaterial("Content/crate.wpk") ))
      .AddComponent(new Transform3D())
      .AddComponent(new ModelRenderer())
      .AddComponent(new Spinner() { AxisTotalIncreases = Vector3.One / 2 });

Finally we have to add the camera and the cube to the scene EntityManager object:

EntityManager.Add(camera);
EntityManager.Add(cube);

Now, if you build and run we will get our first Wave Engine® game in action:

GameInAction

You can get the full code here

Post comment Comments
kowd
kowd - - 1 comments

The link to the .zip file is dead, the crate.wpk file can be found here though:

Github.com

Reply Good karma Bad karma+2 votes
Guest
Guest - - 688,627 comments

The zip file is donw for this tutorial.

Reply Good karma Bad karma+2 votes
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: