INTRODUCTION:

The 3DGS A7 engine is very nice. The Templates are a great way to start game programming.

Lite-C is has allot of power. The official tutorials are excellent. AUM is a must read.

First: You are probably smarter than me. Second: You are probably a better programmer, or soon will be.

My only advantage, if any, is that I started to play with Lite-C earlier.

It wasn’t entirely obvious to me how to make the transition from the templates to Lite-C without templates.

This is an example of how to do it. Five stages of development are captured for your examination.

The first stage has the important stuff. Maybe the other stages have something interesting too.

This was made using Windows XP and Windows 7, the A7 and A8 engine, WED, SED and Lite-C.

INSTALLATION:

The game here is “bare bones” to keep the file size small and make it easy to read in SED.

The best thing to do is:

Unzip the files and use the following directory and path:

LAUNCHING:

Using WED, open jim1 and load “jim1.wmp”.

From here you can examine scripts and resources or run “jim1.wmp”.

You may have to rebuild the levels before they will run for you. But I hope not. You may

Need to point the texture manager to the 3DGS standard.wad to get the grass1 texture

I used, but again, I hope not.

CONTENTS:

jim1

Does not rely on the game templates. Does use the 3DGS engine.

Puts a player in a room with a light.

Player can do some basic movement. Use arrow keys, insert/delete keys for up and down.

jim2

Builds on Jim1.c

Add some apparent gravity

Add an animal entity with basic movement.

Use wsad keys, q and e keys to turn, z and e keys for up and down.

jim3

Builds on Jim2.c

Add bones animation and speech to animal

Use t key for talk

jim4

Builds on Jim3.c

Add player health. Player can die.

Add aggressive animal action

jim5

Builds on Jim4.c

Add change to another level

DISCUSSION:

All the important stuff is in “jim1.c” and “resources.h” which can be viewed with SED.

This is basic starter code for you to examine.

Examining jim1 through jim5 in SED is the tutorial feature of this example. Below are some remarks

to help get things started.

“jim1.c”:

//Use the Conitec 3DGS Engine

#include <acknex.h> // include these predefined, needed files in our project

#include <default.c>

These lines let us use the 3DGS engine so we don’t have to do all the DirectX stuff ourselves.

If we wrote our own wrapper for DirectX and our own game engine, it would be hard to do

better than 3DGS.

//Use copies of Conitec Resources in the special work folders

#include "my_templates\includes\resources.h" //modified paths to my special copies of resources

The rest of jim1.c is standard stuff, so lets look at “resources.h”

“resources.h”

If you want to have your own sprites and models etc. this is a method that works.

It is the “resourses.h” file that holds the paths to our sprites, models, textures etc.

We “include” it in our main script jim1.c.

//---------------------------------------------------------

// Paths to development resources. Mostly copies of Conitec, and AUM stuff

// Can play with copies and preserve originals

#define PRAGMA_PATH "my_templates\code";

#define PRAGMA_PATH "my_templates\images";

#define PRAGMA_PATH "my_templates\includes";

#define PRAGMA_PATH "my_templates\models";

#define PRAGMA_PATH "my_templates\sounds";

#define PRAGMA_PATH "my_templates\textures";

#define PRAGMA_PATH "my_templates\wads"; // use a copy of 3DGS standard.wad textures

So here are resources in a file like C:\Conitec Work\jim1\my_template\…,

far away from the Conitec resources where 3DGS is installed on the computer.

I used copies of 3DGS resources and didn’t really add that much original work.

But some original work was added to prove this method works.

MORE DISCUSSION:

You may be used to using the templates to control movement of the players and to add a camera.

But here is an example using only Lite-C and not a template. The game needs a player, so let’s start

by making an action assigned to the player.

# “PlayerStuff.c”

Here is an action with the name “player_me()”, which seemed easy to remember.

Action “player_me()” calls a function “move_player()” which seemed like a good name.

The function “move_player()” has to be defined before it can be called by the action “player_me()”.

Of course all that is explained in the 3DGS Lite-C tutorial.

Attach a camera:

One method to attach a camera is to create a Lite-C function and call it from the player action.

In this example, the player action calls function “set_camera_fps()”.

To keep things modular, player stuff will be in “PlayerStuff.c” and camera stuff will be put in “CameraStuff.c”.

The function “set_camera_fps()” although called from the player stuff, is defined in the camera stuff.

Following the rules of Lite-C we need to define the camera stuff before the player stuff can call it.

So in the main program “jim1.c” we include “CameraStuff.c” before including “PlayerStuff.c”.

In the player action, is it better to call a funtion to move the player first or to set / update the camera?

In jim1 through jim4 the “set_camer_fps()” function is called before the “move_player()” function.

In jim5 the functions are swapped and “move_player()” is called first. Both methods seem to work.

# “CameraStuff.c”

YET MORE DISCUSSION:

Other Lite-C script files listed under “resources” in SED that may be of interest are:

# “AminalStuff.c”

The friendly animal and its animations start in jim2. The aggressive animal and its

limited AI start in jim4.

# “OddStuff.c”

Contains the portals and level change. It is in jim5.

# Other files

Files “litec.h”, “compat.h”, “atypes.h”, “afuncs.h”, “avars.h”, loaded with

these lines in “jim1.c”:

#include <acknex.h>

#include <default.c>

Actually “default.c” includes “acknex.h” which then includes the other files.

They contain definitions for the engine and are a great reference like the 3DGS manual.

AFTER-THOUGHTS:

The templates offer a nice way to add extra control. That is by editing a text file or xml file.

But that is beyond me and beyond the scope of this example.

The friendly animal and the fearsome beast are the same of course. You may wish to load it in

MED to see that you can make your own animations to be whatever you want, like “talk” for example.

It is easy to add aggressive animals to the game, but more than one friendly animal starts to cause problems.

To get more friendly animals in a game it is necessary to code more “actions” each one using different keys

on the keyboard. The minimal AI of the aggressive animal action eliminates that hassle. Aggressive animals

can do their own thing, and their actions are not bound to limited resources like keys on a keyboard.

The portal used in jim5 is a prefab resource added from the 3D Gamestudio resources directly. All the

examples used grass1 from the standard.wad that comes with 3DGS.

There can be many ways to trigger a change of levels in a game. The method used here seemed OK for now.