Login | Join  
Shep's avatar
Shep

Shoot’n: A Creator’s Guide

January 28, 2008

There I was, sitting in a deck chair enjoying the sights, the serenity and a slab of Carlton's finest blonde with my mates, watching the world go by as water from Tidal River soaked through the bottom of my chair. It may have been the beer serenity that led me to think that I could pull off an on rail shooter in VastPark with lots of guns, death and destruction. Although I was enjoying my week off camping at Wilson's Promontory evidently I was looking forward to going back to work.

Layout:
When I got back to work the following week I set out to make this idea a reality. I began by laying down a grass plane, which was temporary, until I had placed objects in the scene to build a terrain map around. I chose objects from our item library that were all created in the same style. The last step of laying out the scene was to choose the skybox.

After placing out all the objects the scene looked like this.

Gameplay:
I now had a scene to work with but without any interactivity, this park was like owning a Ferrari without an engine. The first thing I had to decide was how the gameplay was going to work. Most shooters, like this, flow through a level s in small stages. With this in mind I went around the scene choosing areas that would become a stage to shoot stuff at. I then had to figure out how to script it.

One of the cool new things that can be done with the introduction of IMML is to have a timeline. A timeline allows you choose when to execute a script or property event. A property event is when an object is set to modify at a certain time, i.e. in 30 seconds change colour.

The code looks like this.

<Timeline Name="player_pos" AutoStart="True" AutoTween="True" Speed="1">
<ExecuteEvent Element="stage1" Time="00:00:05"/>
</Timeline>


First you have to give the timeline a name, choose if you want it to automatically start at runtime, then set its tweening and specify how fast you want the timeline to run.
To execute a script you have to give the script name as the element and set what time you want it to start in hh:mm:ss

With the help of the timeline I was able to set up several scripts with keyframe controllers that would take me to each stage.
They look like this.

function main(obj, args)
--set a stage variable to count the hits for this stage
scene:set('stageOneHits', 0)

--store the current stage variable to help with score logic later
scene:set('currentStage', 1)

kfc =
keyframecontroller()

kfc:addtranslationkeyframe(
2000, vector3(2.398486,3.554865,39.14548))
kfc:addrotationkeyframe(
2000, vector3(0.06358808,1.623098,0))

kfc.entity = scene.usercamera
kfc.absolutekeyframes =
true
kfc.enabled =
true
kfc:Play()

end

Note: The two variables at the top of the script are there to help with setting the players score.

I now had the camera how I wanted but needed something to blast rounds into, so I chose a target from the library and placed at stages. I made scripts with keyframe controllers to make the targets move up and down and then spaced out their distance and timing to give a random effect.

The last essential item was a scoring system, so I created a script that when a target is hit it stops moving and adds 1 point to the score.

The script looked like this…
function main(obj, args)
obj:get('kfc').enabled = false
currentStage = scene:get('currentStage')
hits = 0

if(currentStage == 1) then
hits = scene:get('stageOneHits')
elseif(currentStage == 2) then
hits = scene:get('stageTwoHits')
elseif(currentStage == 3) then
hits = scene:get('stageThreeHits')
elseif(currentStage == 4) then
hits = scene:get('stageFourHits')
end

score = scene:get('score')

if(score == 0) then
score = 1
else
score = score + 1
end

hits = hits + 1
scene:set('stageOneHits', hits)
scene:set('stageTwoHits', hits)
scene:set('stageThreeHits', hits)
scene:set('stageFourHits', hits)

scene:set('score', score)

--update the UI
t = scene:get('scoretext')
t.value = "Score: "..score

end

Note: The script is referencing the two variables set earlier in the stage script.

Finally I replaced the temporary grass plane with a terrain that I made with L3DT terrain generator, free to download at http://www.bundysoft.com/L3DT/

The game is now a basic mini-game demo. Entertaining for simple folk like me, but loads of room for improvement. I'm hoping this will become an evolving project we will add new features to as we go. All the source is available to help you get further with your own versions and ideas. My wish list is a better scoring system, better text feedback including rules and the aim, and multiuser support for competitive blasting...
What I would really like in there are zombies that you can blast limbs off, but that could be a while off, sigh.

Be sure to keep an eye out for updates and if you have any questions or suggestions feel free to give us a shout.

Oh and you can get a copy of the park here.




Comments

#1. Posted by craigomatic on April 18, 2008

Nice one, nothing like a few bevvies for inspiration wink

Name:

Email:

URL:

Comments:

Remember my personal information

Notify me of follow-up comments?

Enter this word:


Here:


Copyright © 2008 VastPark