Internet Store and Ecommerce Solution Provider - Free Web Site - Free Web Space and Site Hosting - Web Hosting - High Speed Internet
Search the Web

SKM Software 3DRad Development



Back to Home
Welcome to our fun world

3DRad Development

Written by: Steve Miles
3D Developing Tool: 3D Rad Lite. Modelling Programme: OpenFX.



Update - 20 May 2003

Creating a rotating Globe that explodes when shot.

Outline

Recently, I gave myself a challenge - to create a new 3D game. This later developed into two separate ideas. But that's another story.

The main idea was to create a Space Ship game which, included Planets. What follows here, is a simple tutorial which, enables the creation of a working demo, based on a rotating Globe that explodes into a pile of rotating rubble when shot. Once the principle is understood, it is easy to adapt it to all sorts of uses.

Organisation

When creating new objects, I always create a new folder in the 3D Rad folder, to store all the textures, models, etc. At least, that way, I know where everything is.

Textures

I used some great Planet textures that I got from The 3d Studio. One important thing to remember, is that 3D Rad likes it's textures to be square. In this case the Planet textures are rectangle. It was simply a case of using a paint programme, such as Paint Shop Pro, to resize the images. I used 256 x 256 pixels. Also, remember to save the resized images as bit maps, BMP format. 3D Rad doesn't use jpeg.

Model Making

Although, the textures from The 3d Studio came with a 3D model, I decided to create my own, low polly Globe instead. My final programme will have a lot of Globe's, so I wanted to keep the polly's down. I used the 'Build' command in OpenFX and create a low polly lattice sphere.

To digress for a moment. The models which come with 3D Rad have reversed faces. When saving your model, you could, reverse the faces so that the model matches the default Rad models. I personally prefer them normal. At this point it may not seem important. But when you come to creating the 3D visual, things can become confusing if you can't remember which way round your models faces are. It's also important to check that all the faces are orientated the same way.

I then exported the model as a 3DS model. Remembering to save it with the textures in my new folder, within the 3D Rad folder.

For the rubble model, I just created some irregular shapes and grouped them together. This was again, saved with the textures in my new folder.

To use the 3ds models in 3D Rad they must be turned into V3D files, using the 3D Model utility in 3D Rad. See 3D Visuals

Using 3D Rad

My Planet programme is being built using the Lite version, so I will explain creating the project for this version. It also means, you could download the trial version and try out this tutorial for yourself. 3D Rad Net is the top version and uses a different interface.

If you are new to 3D Rad, I recommend that you work your way through the Rad tutorial before trying this tutorial. It presumes you understand, reasonably well, how 3D Rad works. The important thing to remember is; 3D Rad uses elements which, can be called to carry out different functions.

The rotating Globe comprises of 4 main elements.

Element - Rotating Globe.
; Calls element#1 on death.
; Calls element#2 after element#1 on death.
; Calls element#3 if being shot.

element#1 - Fire and Explosion.
element#2 - Rotating Rubble.
element#3 - Warning Sign.



Step 1 - Loading the Elements / Resources

Open 3D Rad and select the 'default project'.
Delete the 'Default 3D Visual'.
Load the 'Player Controlled Helicopter' resource. This will be the Globe.
At this point you should change the Helicopter model for your own. See 3D Visuals

In the Virtual Editor position the Model in virtual space. Make sure the model is high in the air, well above the default ground level.
Rename the 'Player Controlled Helicopter' resource - 'Globe' - and rename 'Helicopter (Expl. Fire)' - 'Globe (Expl. Fire)'.

Clone the 'Globe' and move it below the 'Globe (Expl. Fire)'. Rename it 'Globe Rubble'. This element is turned on, by default, you should turn it off by toggling the red button to grey.

Load the 'Oscillating Sprite' resource and make sure it is below the 'Globe Rubble'. Rename it to 'Globe Title'. You will need to create your own spirit using a paint programme, such as Paint Shop Pro. Don't forget to change the Aspect to your spirit.

Load the 'Player Controlled Helicopter' resource. Again, you should change the model for one of your own. Alternatively, you could use one of the default Space Ship models, which come with 3D Rad. See 3D Visuals

Load the 'Laser Weapon' resource. In the Virtual Editor position the Laser at the front of the Space Ship.

Load 'Single View' resource.

Load the 'Observer' resource and place it above the 'Single View' resource in the listing.
In the Virtual Editor position the 'Single View' and 'Observer' behind and slightly above your Space Ship.

Finally, load the 'Exit on any key press' resource.


Your 3D Rad screen should look something like the list above. Notice the elements that are turned off (indicated by the red button turned to grey). See Virtual Editor about the 'Camera' element.

Step 2 - Changing the Brains

Rather than get you to alter the existing brains and possibly end up with some strange results, I have decided to included the brains for most the various elements, with the exception of the Helicopter brain. Make sure you take a good look at them, to see how they work. Each one is heavily documented, to help explain what's going on. The changes to the brains, for instance the 'Space Ship Brain', are small. Other brains are unique.

Open the 'Globe' brain and delete the brain - insert the 'Rotating Globe Brain'. See Here

Open the 'Globe Rubble' brain and delete the brain - insert the 'Globe Rubble Brain'. See Here

Open 'Globe Title' brain and delete the brain - insert the 'Globe Title Brain'. See Here

Open the 'Player Controlled Helicopter' brain and amend the brain by changing the code. See Here

Step 3 - Set the Collisions

In this example it is only necessary to set three collisions.

1. Space Ship and Globe.

2. Laser Sparkle and Globe.

3. Space Ship and Rubble.

Remember to give them different codes (colours).


You are almost ready to test the programme. However, there are a few minor adjustments needed before the test. Click on the Space Ship 'Info' button and set controls to Joystick. If you have not got a Joystick connected, then leave it set to keyboard. Turn the 'Camera' element off. If you need to edit the positions of the models, in the virtual editor, you will need to turn it back on.

When all the above is done, you can test the programme.

Move the Space Ship around.

Move towards the Globe and shot it.

The warning sprite should flash on.


If you continue shooting at the Globe, eventually, it should explode in a ball of fire, to be replaced by a field of rotating rubble.

And there you have it.


Back to Step 1

Back to Home



Subsections



3D Visuals

Click the 'Tools' button and then the '3D Model Editor' button to start the editor.

The tutorial, which comes with 3D Rad, explains this in some detail. If you are still lost when it comes to creating 3D Visuals, I recommend you re-read the 3D Rad section on 3D Visuals.

I may add some guidance of my own, here later. But for now, I will leave it up to the 3D Rad help section to guide you.

Back to Model Making

Back to Step 1



Virtual Editor

Left click on the 'Ed' button to enter the editor.

Because this example has no visuals, apart from the globes, etc. You will have to turn the 'Camera' element on when using the Virtual Editor. It's default setting is on. When the programme is running turn the 'Camera' element off. Otherwise you will end up with a double image.

The picture on the right shows the positioning of:

View Camera

Observer Camera

Laser


Back to Step 1



Rotating Globe Brain

; Rotating Globe
; S K Miles May 2003


var begin=0
userInt hit=5
; Number of hits before exploding.
userInt spinspeed=50
; Spinspeed of Globe. Default 50 (slow).
; Slow (low numbers) for large Planets.
; Fast (high numbers) for small Moons.

; Next section only runs on startup.

if begin=0
begin=1
; Assign spin to globe.
spin_x_set(element,0)
spin_y_set(element,spinspeed)
spin_z_set(element,0)
endif

; The following section is executed only if a collision with
; a weapon element (ID=2 and set in the Collision Map), is detected.

if collision(element,2)>0
on(element#3)
; element#3 is a spirt which flashes to warn the Planet is under attack.
hit=hit-1
endif

if hit=<1
; ******
; DEATH
; ******
; Replaces the Planet with the explosion and fire element.

position_copy(element,element#1)
; element#1 is the explosion.
; Enables the explosion with fire element.

on(element#1)
; Disables this character
off(element)
; Replaces the explosion with rubble element.
position_copy(element,element#2)
on(element#2)
endif

; Following code updates element's internal data, to apply spin and velocity.
velocity_update(element)
spin_update(element)
; Friction stops element moving on collision.
friction_xz(element,0)

Back to Step 2



Globe Rubble Brain

; Rotating Rubble
; S K Miles May 2003

; Next section only runs on startup.

var begin=0
if begin=0
begin=1
;Assign spin to globe
spin_x_set(element,0)
spin_y_set(element,50)
spin_z_set(element,0)
endif

;Following code updates element's internal data, to apply spin and velocity
velocity_update(element)
spin_update(element)
;Friction stops element moving on collision
friction_xz(element,0)

Back to Step 2



Globe Title Brain

; Oscillating Globe Title
; S K Miles May 2003

; Set up the variables.

var begin=0
var startx=0
var starty=0
var cout=100
; Cout is display timer
; Increase for longer Title display.

userInt speedx=2000
; Horizontal speed.
userInt speedy=5000
; Vertical speed
userInt amplitudex=100
; Horizontal amplitude (in pixels)
userInt amplitudey=50
; Vertical amplitude (in pixels)

; Next section only runs on startup.

if begin=0
begin=1
startx=position_x(element)
starty=position_y(element)
endif

if cout>1
position_x_set(element,startx+[amplitudex*sin_512(timer(element)*speedx)]/1024)
position_y_set(element,starty+[amplitudey*cos_512(timer(element)*speedy)]/1024)
cout=cout-1
else
off(element)
; Turns Title off.
cout=100
; Resets timer for repeat use.
; Increase for longer Title display.

endif

Back to Step 2



Space Ship Brain

The 'Space Ship Brain' is almost the same as the 'Helicopter Brain'. However, there are some actions which are not required, or actions which could be included or removed - depending on the type of game being created. Below are the alterations, I made, for my particular Space Ship game.

There is no ground, as such, so disable the set ground_level section by adding a semi colon to the start of the line.

if above_ground_level(element)rotation_y_add(element,tempjx)
position_y_add(element,tempjy)
; position_y_set(element,ground_level(element)+hdimy)
endif

Disable the Pitching section, Helicopter pitch forward action, by adding a semi colon to the start of the lines.

; *********
; PITCHING
; *********
; rate=multiply(currentvel,pitchfac)
; rotation_x_set(element,rate)


In the collision section disable the credit_set section by adding a semi colon to the start of the line. Leave it active if you want the ship to loose health on collision.

if oncecoll=0
oncecoll=1
velocity_set(element,0)
; health loosing
; credits_set(element,limit(credits(element)-collblows,0,24576))

endif

Back to Step 2



Top of page


SKM Software (c) 2002 - 2003