![]() |
||||||||||||||||||||||||||||||||||
|
Make your own 3D game in Lite-C
Greetings Gaming World,
I am back from the murky depths of exam revision to tell you a thing or two about making games in 3D. I hate to break it to you, but there are ways to make your projects without using RPG Maker and I intend to show you how through the medium of a keep-it-simple- Do not fear lazy GW'er! - You're in safe hands! It'll be worth your while I tell you. By the end of this first installment you'll be able to find your metaphorical game-making backside without the use GPS! I intend to spoon feed you knowledge. ![]() Preamble Jokes aside: my purpose here is to make the creation of 3D games more accessible to people who would never dream that it is so easily within their reach. With 30 minutes of your time I am confident I can convince you that with a little work you can go on to make something really impressive in the long term. It's all to worrying when you see people wasting hours of their time trying to stretch RPG Maker 2003 that little bit further when those hours could be spent more productively - coding from scratch, without restriction. Learning Outcomes This is what you will learn in this initial tutorial:
Without further ado, let us begin part one. Part 1 - Setup! Required Downloads Download and Install, Lite-C Script Editor (SED) and Model Editor (MED). These are the two key tools that you will be using for the duration of this tutorial. There are other optional programs you can download which will make screenshots used in the tutorial easier to understand but you don't need to worry about that too much if you're confident you know your way around image manipulation.
It seems rather obvious to say this but you need a DirectX 9 enabled PC. This tutorial was written on a Celeron laptop with built-in Intel graphics so if your PC isn't made of papier mache you should get on with this just fine. It it is a dust-stained relic from the 1990s it will not. Now time to make something to play with. Part 2 - My First Program (In Lite-C) Covering, how to create and run a new script with use of strings. 1. First things first, fire up SED. Tip: You'll find that under Start > Programs > Lite-C > SED Script Editor 2. Check out the symbols along the bar at the top. If you've ever used a script editor before then you should feel right at home. If not, don't worry I'll guide you through it. ![]()
*Comment use: Code:
3. When the program started up you should have been welcomed by an empty script. If not go File > New or press CTRL-N. Save the empty script as test.c in a new empty folder of your choosing. It is good practice to create an empty folder for new projects as all the scripts, models and assocatiated files you use are all stored in the same directory as your script unless you set up paths (I will explain how to do this later, don't worry about that for now). It is also a good idea to save an empty script before you start working with it as the editor recognises the .c extension and highlights your syntax (code words) accordingly. Syntax highlighting is a great indication of whether you are doing something right or wrong. 4. Add the following lines of code: Code:
Change the string name to your own and hit the black play button and hopefully your script will compile and run. If not it will halt and give you an error. If it does you can't copy and paste and you should probably throw yourself off a bridge now. Let's modify the program so that we've got some 3D content. Part 3 - My First Level Covering loading a terrain as a level and simple camera movement. Firstly, download this file terrain.rar (621kB), extract the archive to your project directory.Tip: Terrains and models are stored in .hmp and .mdl format, respectively. If you want, double click on terrain.hmp (The file you just downloaded) and it will load up with MED Model Editor. In the 3D viewport you can hold the right-mouse button to zoom in and out and hold the left mouse button to pan around. The use of MED to make your own terrain will be covered in the next tutorial. This next block of information is important and fundamental to your scripts in Lite-C so pay attention. During runtime the program executes a funtion called main. As implied by the name, this is the main function and is executed first, after your includes and variable declarations etc. The main function is traditionally divided into two sections: What is a function? A function is a block of code containing instructions that is called e.g. summoned by the program. For example: Code:
Above is a function that calls functions from within itself. Notice that a boolean (true or false) parameter has been included in brackets for the function definition. If it's true then the function add_milk_to_cup is called. Notice the use of curly brackets and semilcolons. This punctuation is essential and must be placed correctly for the code to compile.
In code this is structured as follows: Code:
Main normally goes at the bottom of the program below everything else. Now to test this theory in a program of your own. Create a new script in the same directory as before (making sure terrain.hmp is present) and paste in the following code: Code:
Run it by pressing the black play button and observe the results. The engine has loaded the level and the string in the top-left is a number counting the number of frames that have passed. Checking the code you will see the method for incrementing a variable in a loop and the way you can convert a variable to a string for display on the screen. Let's liven things up a little, add the following to your while loop in main: Code:
Re-run the program and you should find that the camera rotates about it's Z-axis. You can even go one further. Delete the line you just added and replace it with: Code:
Now try your direction keys whilst running the script. Neat? You are altering the pan and tilt of the camera with your key strokes. Notice the inclusion of time_step. This makes sure that the camera pans at the same speed on all machines. If you did not include a time_step then the camera would pan at the same speed as the frame rate that varies between systems due to hardware differences. ![]() Your 3D environment. Next Time... This is the first tutorial I have ever written, so depending on the response I get I may revise this initial installment and continue it or I may just recede back into the depths of Game and Demo and bitch about RPG Maker overuse. If you have any questions at all, drop me a PM and I can help you out. Your enquiries will also help me make it clearer for others. Next time I shall cover the addition of entities, terrain generation, basic use of the physics engine and environment features (i.e. the sky). Homework If you want to get ahead of the game, look into terrain generation using terrain texture generator (Fantastic free tool). Here are some hints to get you started:
Thanks for reading, see you next week. -Ed Posted on April 9, 2008
|
![]() |
|||||||||||||||||||||||||||||||||
![]() |
||
About This BlogYes, we are still very much alive! This blog is a placeholder Gaming World's upcoming main site, GW6. The release date is still unknown even to us and this site is designed to introduce and keep you updated on what's happening in our community while the main site is being worked on. Enjoy your stay at GW and register on the forums if you haven't done so already! |
![]() |
|
![]() |
||
![]() |
||
![]() |
||
![]() |
||











