• Register

Wave Engine was born on February 21, 2013 with the exciting mission of developing an engine to help the mobile game developers’ community.

Post tutorial Report RSS Load Model

Once you’ll follow step-by-step the following sections, you’ll have a Wave Engine game which consists on a 3D scenario with a dinosaur, where you can navigate through a free camera. You’ll also learn a basic use of Wave Editor, in order to export assets for your own games.

Posted by on - Basic Client Side Coding

Ready, steady...
- Currently 3D models can to be in Direct X file format (.x), OBJ, 3DS, DAE (collada) and FBX. Free exporters exist for most of the 3D modelling software: 3D Studio, Blender, etc.

- The entire models and textures set is provided by us. You can download it here.

- You should have a basic knowledge of C# programming language. You can find a lot of documentation about C# on the Internet.
Once you'll follow step-by-step the following sections, you'll have a Wave Engine game which consists on a 3D scenario with a dinosaur, where you can navigate through a free camera. You'll also learn a basic use of Wave Editor, in order to export assets for your own games.

Creating a new game project
Launch Visual Studio and open File > New > Project... dialog.

Within Visual C# > Wave Engine, select WaveEngine Game Project, fill the name in and click OK. With the source code as is, if you hit F5 (Run) you should see a window with a cornflower blue background. Everything is OK.

Exporting the models and textures
Although the models needed for this tutorial are all of them provided (you can download them on Ready, Steady... section), for instance the dinosaur has been exported using Blender and the built-in plug-in for Direct X format.

Within the assets download you'll find the following hierarchy:

  • Models
    • fern.X, a bunch of brushes
    • floor.X, the floor it-self with some stones
    • velociraptor.X, the dinosaur
  • Textures
    • FernTexture.png, a brush which's used along fern.X
    • floorNight.png, a sprite sheet with precalculated illumination through the floor and stones
    • VelociraptorTexture3.png, a sprite sheet for the dinosaur model

Now we have all the assets, the next step is to export them to a .wpk (Wave Package) format that Wave Engine handles. Go on and open Resources.weproj (double click to this item inside Visual Studio on Windows or open it from file explorer with the Assets Exporter Tool), located at the root of the WaveEngine Game Project you have just created.

It should look something like that:

Them, drag and drop all the models and textures to the Wave Exporter window.

The final would be to simply export all those assets but, in this case, we still need to make a small change.

Due to the way all our models were exported, it's needed to tell Wave Editor to swap winding order in the export process. We could continue without doing that -you can try it- but you'll notice all the models have the normals turned inside out, producing visual glitches. To avoid that, just select every .X asset and, on the right panel, enable SwapWindingOrder property:

Make click on Project > Export All -save the project if prompted. You'll find all those assets exported to .wpk on Export\Default path within your Resources folder.

Time to code
Within Wave Engine the game logic is hosted on the other project, the 2nd one. The template creates by-default a MyScene.cs, which is where we'll "consume" our assets. All the source code will live inside CreateScene().

We will start by adding the camera. In this case, we will use a free camera, which by-default contains logic to support input for moving it (depending on the device the input goes from keyboard to taps, etc.):

csharp code:
FreeCamera mainCamera = new FreeCamera("MainCamera", new Vector3(0, 50, 80), Vector3.Zero);


The next step is to add entities for each 3D model. All of them share the same structure: an entity which differs one from the other on the model (3D mesh) and the material (textures/sprite sheets):

csharp code:
Entity velociraptor = new Entity("Velociraptor")
      .AddComponent(new Transform3D())
      .AddComponent(new BoxCollider())
      .AddComponent(new Model("Content/Models/velociraptor.wpk"))
      .AddComponent(new MaterialsMap(new BasicMaterial("Content/Textures/VelociraptorTexture3.wpk") { ReferenceAlpha = 0.5f }))
      .AddComponent(new ModelRenderer());

Entity floor = new Entity("Floor")
      .AddComponent(new Transform3D())
      .AddComponent(new BoxCollider())
      .AddComponent(new Model("Content/Models/floor.wpk"))
      .AddComponent(new MaterialsMap(new BasicMaterial("Content/Textures/floorNight.wpk")))
      .AddComponent(new ModelRenderer());

Entity fern = new Entity("Fern")
      .AddComponent(new Transform3D() { Position = new Vector3(0, -8, 0) })
      .AddComponent(new BoxCollider())
      .AddComponent(new Model("Content/Models/fern.wpk"))
      .AddComponent(new MaterialsMap(new BasicMaterial("Content/Textures/FernTexture.wpk") { ReferenceAlpha = 0.5f } ))
      .AddComponent(new ModelRenderer());

Done! If you build and run the solution you will have the whole scene rendered:

Depending on the device you can interact with it in multiple ways. In this particular case, a Windows app, you can press W, A, S, D keys to move the camera along the scene.
Full source code
You can download the entire solution here.


This comment is currently awaiting admin approval, join now to view.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Follow Report Profile
Send Message
Release date
Engine watch
Related Engines
Wave Engine
Wave Engine Proprietary
Related Groups
Wave Corporation
Wave Corporation Developer