Wednesday, December 26, 2007

Creating a new World

Here's what you have to do in order to create a new world. Let's assume your application name is Checkers.

Project Setup
  1. Create a library project called Checkers
  2. Set the output path to \Built Worlds\Demo Worlds\Checkers\
  3. Add a file called Checkers.v3d to the project and set it to copy to the output folder in the solution so that it can be shown in the world launcher. Note: v3d file name should match the name of the folder it is in
  4. Add references to Visual3D.Engine, Visual3D.Framework, Visual3D.ReferenceApplication and Microsoft.Xna.Framework
Config and Startup
  1. Set the name for your project in and nodes
  2. Set the paths to your content in the section, duplicate them in
  3. Create the world class and inherit it from Visual3D.Scenes.WorldApplication
  4. Specify the fully qualified world application class name in (e.g. Checkers.App)
  5. Create the Main Menu scene class and inherit it from Visual3D.Scene
  6. Specify the fully qualified class name in and in section
  7. Init and register the controls in App.OnInitialized method. Be sure to call base.OnInitalized()

Main Menu

  1. Add class MainMenu, inherit it from Visual3D.UI.Form
  2. Register MainMenu in App.OnInitialized using GuiSheets.RegisterGuiTypes
  3. Add menu creation code (see Tech Demos example)
  4. Create CheckersMainMenu class and add form code (see Tech Demos example)
  5. Register the scene in App.OnInitalized using this.Scenes.Add method
  6. As we dont have anything in background for the main menu, create CheckersMainMenuRegion and inherit it from RootSceneNode
  7. Specify the region in CheckersMainMenu using SetSceneSegment method

Main Gameplay Scene

  1. Add class GameplayScene that inherits from Visual3D.Scene. Register the scene in App.OnInitalized
  2. Add class GameplaySceneRegion that inherits from Visual3D.SceneObjects.RootSceneNode
  3. Perform other steps as you did for the Main Menu.


Now you can move on.

Wednesday, December 19, 2007

Introduction to the Reference Application Framework

The Reference Application Framework (RefApp or simply framework) is built upon a few assumptions:

1. There should be a clear separation between visualization logic, AI/game logic and physics simulations.
2. RefApp should be unit testing friendly
3. Most of the general use-cases should be covered
4. Source code availability

Now let's elaborate a bit on these.

Separation of Concerns

A lot of useful information has already been written on the subject. Here's what applies to game development.

Generally, mixing 3D/AI/physics code is considered bad practice. Refactoring purists call this "code that smells". One should not have visual objects that serve as 3D models, game logic entities, physics bodies in real applications (note that it is fine for demos). The framework addresses this need by introducing several base classes for different aspects of the game:
Actor (called ActorNew for now, because it conflicts with Visual3D.Actor class) and Avatar.

Actor is a base class for game logic entities (called actors). Actors are used for describing the gameplay rules and relationships, and are driven by the AI simulations.

Every actor that has to be visualized has a corresponding
Avatar. Avatar is actor's visual representation in the 3D world.

Unit Testing
Unit testing is a procedure used to validate that individual units of source code are working properly. A unit is the smallest testable part of an application. In procedural programming a unit may be an individual program, function, procedure, etc., while in object-oriented programming, the smallest unit is a method; which may belong to a base/super class, abstract class or derived/child class. (http://en.wikipedia.org/wiki/Unit_Testing).
In RefApp context unit testing means that it is possible to validate gameplay logic using unit tests. Unit tests do not need a visual representation to be available, and it is facilitated by decoupling Actors from Avatars.

Use Case Coverage

The RefApp Framework is being worked on with general use cases in mind. Currently they include:
  1. Creation of a new World Application, Initialization, World Settings
  2. Main Menu setup, Scene initialization, basic Gui
  3. Configuring a terrain-based scene, terrain settings, splatting and layout
  4. Creating your Actors and Avatars, setting up your Game and Physics simulation, setting up Animations
  5. Dragging and dropping your avatars, controlling player avatar with keyboard and mouse, key mapping schemes
  6. General AI and pathfinding
The more use cases the framework covers, the more information will be made available for you via our blog.

Source Code Availability

We at Realmware understand the need for you to be able to quickly start working on your games and applications, thus we decided to make the RefApp code completely free. It will be made available either as part of the distribution package, or as a standalone download.

Okay Here Goes

Hello everybody,

Let me introduce myself. My name is Sergey. I had worked as a programmer, manager, pre-sales consultant, and analyst in a number of companies before I joined Realmware's management team. As the rest of the Visual3D.NET team I wear many hats, and one of them is development. This is what I am going to write about in this blog.

As part of our initiative to make Visual3D.NET more usable for you, several weeks ago I started the implementation of a reference application framework that may serve as the basis for your games and serious visualization applications. The framework is about actors, physics, AI and other related stuff.

I am going to teach you how to programmatically create a new world application, how to setup initial lighting and scene layout, how to create actors and avatars, how to setup basic physics stuff, and much more. We have been doing a good job of working on the RefApp framework and I hope you'll enjoy it, too.

Yours,
Sergey Lobko-Lobanovsky aka "arilou"