Editorial - August 2008

Issue 67 cover

Back in the mid-nineties, I was outraged to hear that in future I would need to buy additional hardware to power my games. To me it felt like corporate blackmail, tying software to hardware to allow 3D games to run smoothly. Admittedly my knowledge of the computations behind 3D rendering was limited (until my first 20 second Truespace 1.0 animation shortly afterwards, which took a whole weekend to render).

Recently, the tables have not just turned; they have flipped aggressively around as video cards have started to replace key processes in many areas. NVIDIA recently ran a competition to write an MP3 encoder, running under CUDA on the graphics card. This is one example of harnessing the power of your graphics card when it isn't dedicated to throwing vehicles around a track, or managing serial explosions in the latest blockbuster game.

Music encoding is only scratching the surface. My subscription to Computer Weekly - a business computing magazine - also featured CUDA this month. They talk of supercomputers (in the true sense of the word) in the home, crunching numbers on graphics card processors. The University of Antwerp has built a dedicated supercomputer, incorporating just four 9800 GX2 graphics cards, which is outperforming 300 CPU cores tasked with the same calculations. You can reach the online version of this article which makes for incredible reading.

Having put the investment in 3D cards into perspective, let's return to this month's newsletter. As well as reminding you of the NVIDIA competition in which you can win the latest in supercomputer-capable hardware, we have news on the release of Lee Bamber's treasure trove of code snippets, updates to The Game Creator Store, Stereoscopic games and much more besides.

Until next time,

Steve Vink, TGC Newsletter Editor


(1) Convention '08 (2) DarkBASIC (3) FPSC News (4) Competition (5) Leadwerks (6) New Mods (7) Videos (8) DBP Tutorial (9) Lee's Tip of the Month (10) PlayBasic (11) From the Forums (12) Winner (13) Front Cover (14) Outro

The TGC Official Convention 2008

The Game Creators Convention 2008, Hinsley Hall, Leeds 

What will be happening at the convention?

This is the one question that everyone asks. I asked Hussein Duvigneau (El Goorf) to summarise the event, as the voice of someone who participated last year:

"The meeting was invaluable for me personally. I gained insight behind the scenes of DarkBASIC and the GDK which directly helped my team's project. It's a breeding ground for solutions and new ideas between coding novices, veterans and the people behind TGC alike, but most importantly, it's an opportunity to put faces to avatars."
Once again, this is your chance to meet the people behind the products and get a unique insight into the future of the company. The successes of last year will be built upon, as well as tailoring the weekend to the suggestions and feedback received.

The two options remain the same. You can take advantage of bed, breakfast, lunch, evening meal, tea/coffee and the convention as a package, with only your transportation to organise. You can also attend as a day delegate, which includes lunch, and morning/afternoon tea and coffee.

Convention Day Rate - £32.00 per day (£64.00)

Convention Attendance
Tea/Coffee/Biscuits throughout the day
2-course Buffet Lunch

Full Weekend Rate - £180

Convention Attendance
Tea/Coffee/Biscuits throughout the day
2-course Buffet Lunch
Accommodation (Friday/Saturday evenings).
3-course, self-service Evening Meal (Friday/Saturday)
Breakfast (Saturday/Sunday Morning)

Most of the accommodation is en-suite, but it is advisable to book early to guarantee your room. Other parties will also be using the facilities and booking rooms.

You can download the booking form here, and return it with a small deposit to reserve your place. We are very excited about this event, and hope that you will take advantage of this unique opportunity. Find more details and join in the discussions on the forums.

Lee Bamber's Code Snippets

DarkBASIC Professional

This month The Game Creators release Lee Bamber's treasure trove of DarkBASIC techniques, and darkFOLIAGE is given it's first public review. Don't forget to look out for the current DarkBASIC Professional tutorial later in the newsletter, continuing to build up the Kung-Fu Platformer game.

Dark Source - Code Snippets for DarkBASIC Professional 

Simple Shiny ObjectsLee Bamber has compiled his codebase of tricks, tips and experiments, and put them all into DarkSOURCE available to buy now for $9.99. In it, you will find almost 200 mini projects, covering everything from lighting effects to ultra-realistic cloudy skies and advanced shader usage. Many of these snippets were produced as proof-of-concept demonstrations of techniques for FPS Creator and other applications created over the years. What you get when you purchase DarkSOURCE is effectively the innermost workings of The Game Creators' lead developer, and creator of DarkBASIC Professional.

The image opposite is taken from one of the code snippets. Do not be fooled, there are no shaders involved in this illustration. The statue is a great example of a strategic combination of the right lighting, smoothing and specular object properties. You will learn by example how to do this and much more besides. All of the code snippets are fully searchable through the browser interface.


DarkSOURCE Example - Cloudy Skies

Code Snippet BrowserOne of the simplest yet most effective demonstrations is the cloudy skies snippet. Looking through the code, you will learn how to create a single plain with multiple textures, and transform it into a dark, thundery sky that would be befitting of a horror movie. You can download this example as a taster of the many great techniques to be found in DarkSOURCE.

Cloudy Skies DemoDownload the Cloudy Skies snippet.


Purchase DarkSOURCEDarkSOURCE is available to purchase now, priced $9.99 USD (€6.99 EUR, £5.99 GBP). On the product page, you will also find the full list of snippets in the pack.

DarkFOLIAGE Sneak Peek

foliage made easier in DarkBASIC ProfessionalThanks to the likes of TreeMagik and PlantLife you have had the power to create the organics of your game world for several years now, but taking those assets and making a lush forest scene can be difficult, especially if you are still learning to code. This new project aims to make the generation of forests and widespread vegetation possible. Our early prototypes are encouraging, and we will reveal more of the project as we go.

The 3D Gamemaker for Vista

A new update has been released in the support area of The 3D Gamemaker website which enables basic support for Windows Vista. Although the software was not designed for Vista, by following the steps described in the update you will be able to make, save and play 3D games, including 3D Game Maker Vista Updatestandalone games! Providing you are running in Administrator mode and have applied the update, you are ready to go. For more information, visit //www.thegamecreators.com/?m=view_product&id=2126

New Game Creator Store Features and Content

FPS Creator News

 The Game Creator Store goes from Strength to Strength

Download music from The Game Creator StoreNew content is uploaded daily to The Game Creator Store, and now has new features with the addition of a filtering option, allowing you to screen out certain types of media to focus on exactly what you want. If all you are interested in is game music, the filter option will only list music items for you to preview. If all you want to see are 3D models, all other types are hidden when you search.

Over 1,300 assets are already listed in the store and growing fast, with over 40 publishers generating content and new artists signing up all the time. The store is easy to use, safe and secure. The Game Creator Store also contains a great selection of free media to get you started - just sign up to access it immediately!.

Also watch out for the imminent release of the standalone Game Creator Store, feeding assets into your Dark Basic Professional and DarkGDK projects as easily as browsing objects and clicking download. Welcome to the world of instant game assets!

Corporate Bodies

Corporate Bodies, written in FPS CreatorThis soon-to-be released game, set in a very dark and suspense-filled world, looks promising. Many games suffer from being too dark and lacking detail, but the team have used this to their advantage, with some innovative use of lighting to set the mood.

The release by JimJams Games will feature 14 levels, combining a 40/60 mix of puzzles and shoot 'em up with an emphasis on the players ability to interact with their environment. There are a number of original media pieces as well as a full musical and audio score. In addition, the game designers have enlisted the voice talents of two professional actors to help bring the story to life.

The forum has been used as a development and feedback tool, with the community once again helping to polish the final product. As a result, the game now has more intuitive help through the radio and replay system, and the progression through the use of keycards is improved.

Due to the size of the full game it will only be available on DVD, and is expected to be released in mid-August.

NVIDIA Physx Demo Competition

NVIDIA PhysX Competition - Update

The first deadline has passed and the entries are in, evaluation and review now begins by our panel of judges to provide feedback on each feature demo beta. The best two betas will win their authors the extremely fast e-GeForce 9800 GTX graphics card, accelerating their development for the final deadlines at the end of August. We have also received the prizes from NVIDIA, so the moment the winners are announced we can ship them out immediately.

You only have 30 days left to submit your entries for the final deadlines so if you want to be the proud owner of a GeForce GTX 260 or Asus Striker motherboard get cracking and show us how creative you can be with physics. We are looking for clever ideas, cool visuals and great GPU scaling through the use of cloth, soft bodies and fluids in your simulations. Expect the rigid body category to be a tough fight too!

Lee Bamber is looking after the prizes and doesn't want to part with them, so show him you want the hardware more and create something amazing. Good luck and have fun!

9800 GX2Prizes have been provided by ASUS and EVGA

Submissions can be from individuals or teams, see rules for full details.

NVIDIA's PhysX engine has been adapted to leverage the complete capabilities of the GeForce family, and Dark Physics has been updated to take full advantage of this.

The Competition Categories

Category A: PhysX feature demos

Within this there are five different sub-categories to choose from. You can send entries for any of these categories and there are no limits on how many you choose to enter.

NVIDIA PhysX - FluidsFluids

PhysX using a technology called SPH - Smooth Particle Hydrodynamics. This is a long name which means simply mind blowing fluid effects. This demo should feature fluid simulation in a creative and visually stunning scenario.

The most interesting display of PhysX fluids will win one of the latest NVIDIA Graphics cards.

NVIDIA PhysX - ClothCloth

The cloth features in PhysX are very extensive. Cloth is very versatile, from capes or window drapes to deformable metal effects. Use your grey matter and come up with a smart way to show what you can do with cloth.

The cloth demo that impresses the judges most will win one of the latest NVIDIA Graphics cards.

NVIDIA PhysX - Rigid BodiesRigid Bodies and Force Fields

Rigid bodies are used extensively in games these days. PhysX Force fields allows the creation of dynamic 3D forces , like wind or magnetic attraction. This Demo should leverage both technologies in a creative way.

The Rigid Bodies / Force Fields winning entry will receive one of the latest NVIDIA Graphics cards.

NVIDIA PhysX - Soft BodiesSoft Bodies

This new technique is so fresh it hasn't been used in mainstream games - so here's a chance to do some seriously lead edge stuff, just use your imagination. Perhaps a slow puncture on a truck or jelly building blocks, show us what you can do

Top of the class in this category will earn the winner one of the latest NVIDIA Graphics cards.

The images alongside the categories are taken from the current demos, and represent the minimum standard for entry - we are sure talented users from our community can blow these away and show us some awesome physics fun!

We have supplied you with the DBPro source code to these demos. You can adapt the source code to make more compelling versions or just use it to learn how the commands work.

NVIDIA PhysX - Uber DemoCategory B: Uber Demo

These demos should "knock our socks off". They should use all core PhysX features (fluids, force fields, soft & rigid bodies ).

This category spans two phases, the first of which will determine who gets the chance to go through and win the main prizes for this competition.

The winning Uber Demos will walk away with the latest NVIDIA hardware, including motherboards and graphics cards.

How To Enter

Competition detailsTo get the full details of the competition, including the rules, how to enter and how to submit your creations, go to the competition pages on The Game Creators website. There you will find everything you need to know, including the full details of the prizes on offer.

Good luck, and we look forward to seeing your entries soon!


NVIDIA, NVIDIA logo, NVIDIA PhysX and NVIDIA PhysX logo are trademarks or registered trademarks of NVIDIA Corporation.
All other trademarks or registered trademarks are the property of their respective owners.

DarkBASIC Professional + Dark Physics Trial

DBP + DP DownloadDon't forget that accompanying the competition, we have trial versions of both DarkBASIC Professional and Dark Physics. Download them now, even if you don't plan to enter, it's a great opportunity to experiment with the products.

Competition Entry Screenshots

Here are some screenshots from existing entries, for anyone looking for inspiration. There are many more threads with progress reports and screenshots, these are merely representative of the hard work being carried out right now.

BiggAdd PhysX Competition Entry 2008   Earl Walker PhysX Competition Entry 2008

HackInc 2000's PhysX Competition Entry 2008   Hoozer's PhysX 2008 Competition Entry

Leadwerks Engine

Leadwerks Engine

Leadwerks Engine 2.1 Beta

The next release of the engine is now in beta-testing phase, and will shortly be available. You can look forward to the following new features:

Leadwerks Engine - an Insight

Josh Klint, Leadwerks Engine developer, made a recent appearance on the 3D-Test website, giving an interview discussing the technology behind the product. Josh reveals some of the inspirations that have led to the product design, how some of the seemingly impossible technical hurdles have been overcome, and where the future lies, both of Leadwerks and the industry as a whole.

Leadwerks InterviewRead the interview on the 3D-Test website


Leadwerks editor - click for larger imageLeadwerks editor - click for larger imageLeadwerks editor - click for larger image
Click on the images for larger previews of the editor

Sandbox - Video Presentation

This next video is a great introduction to the sandbox real-time editor, and shows some of the built-in lighting and physics capabilities of Leadwerks Engine

Leadwerks Engine in Action

Leadwerks Engine BlocksPaul Frischknecht (MasterXilo) has used the humble building block to test the abilities of Leadwerks Engine. His development pipeline starts with Anim8or to create the block model, the scene has been built with BlockCAD, and finally it has been elegantly obliterated in Leadwerks Engine. This is a remake of Paul's DarkLEGO block importer.

This image is taken from the TGC Gallery. The Video Gallery in this newsletter features the blocks in action.

Welcome to our two new Moderators

As the FPS Creator forums grow, so does the need to increase what has affectionately come to be known as The Mod Squad. We asked the community to nominate the members they thought would prove to be most successful in this role, and the huge response is appreciated. As a result, two new moderators have been appointed, although this may expand to include more in the next couple of months; there are a number of suitable candidates aside from the ones selected this time around. Please welcome NickyDude and Thraxas to their new roles. Be confident in the fact that the community and current moderators have agreed on the attributes they feel will make them ideal for the job.

TrueSpace 7.6 - Free modelling for the Masses

TrueSpace 7,6Caligari have released TrueSpace 7.6 - and it's free! This excellent modelling tool - which has stood the test of time - is now available for all in this radical move by the developers. While you are downloading, don't forget to grab the video tutorials at the same time to get you started. For those with existing modelling skills, and those with the determination to gain new skills, there are no longer any barriers to contributing to The Game Creator Store. We also expect to see plenty of unique features in upcoming game releases too!

TrueSpace 7.6The Caligari website and full details can be found here.

Video Gallery

TGC Video Gallery

ATI HD RADEON 2900 XTFPSC X10 Video Card Winner

Back in issue 60, Rick laid out a challenge to show the FPSC X10 development pipeline, in a time-lapse YouTube video. Corin Brown and Sam Hensel took up the challenge, and are now the proud owners of an ATI HD Radeon 2900 XT card. Here is their winning video.

Leadwerks Engine and BlockCAD

This is the video from the earlier article, showcasing up to 4 million polygons in a cool demo of physics in action.


NVIDIA PhysX Competition 2008

Here are a couple of videos from the ongoing competition. These are not picked for any reason other than their author's willingness to share their progress. You'll find many more WIP videos on YouTube and in the competition forum board.

Kendor's Fluid Demo

Dark Coder's WIP

DarkBASIC Professional Tutorial - Building a Platform Game Part V

DarkBASIC Platform game tutorial 

by Andrew Vanbeck

Download Tutorial Project

A Change of Perspective

The Kung-Fu platformer tutorial returns this month after a short break, and certainly makes up for its absence in terms of progress. We're covering a lot of ground this time; effects, atmosphere, lanterns, and some more tweaks to the editor.

The major change however is the perspective of the game itself. Up until now the camera has used the default 3D perspective, now it's field of view (FOV) has been changed to give a much more 2D look to things. This is a change I felt would help stylize the visuals but also make for much faster and easier media creation. By changing the FOV it's possible to remove the 3D perspective completely, meaning a cube will appear as a perfect square when rendering, Z-depth is now only a factor in layering the visuals.

To achieve this the FOV needs to be set to around 360.2 - this varies very slightly depending on the screen resolution. The rendering range on the camera also needs to be exagerated to bring the display into view, for example the camera Z distance is now -36000. The camera is positioned at -36000 on the Z axis and the range is set between 30,000 and 50,000. Setting the camera rendering range like this will hopefully avoid any Z fighting issues, when 2 polygons try to render on the same depth they can cause visual defects. The initial setup code now looks like this:

global cam_fov#=360.201

set display mode 1280,1024,32 : cam_fov#=360.201
`Setup camera
sync on
sync rate 50
autocam off
color backdrop rgb(5,5,15)
set camera range 2000.0,100000.0
set camera fov cam_fov#
set dir ".."
gosub init
gosub prep_media
gosub set_testmap
set directional light 0,0.3,-0.5,0.2
set light range 0,10.0
set ambient light 15
`Set range to game display
set camera range 30000.0,50000.0

The range needs to be set to something that will allow snapshots to be taken of all the level media, then it gets set to the game display range. The lighting has also been dulled down to give more atmosphere and bring up the lighting particle effects, this can be easily controlled by setting the ambient light level.


A lot of old school 2D platform games used an effect called Parallax Scrolling, one good example of this is Shadow of the Beast, which probably sold a million Amiga's based on it's intro screen alone. By layering several images it's possible to give the impression of depth and realism without the need to render in real 3D.

To give the game some atmosphere the outside sections will be very dark; the game involves collecting lanterns, so it makes sense to light them up and set the game at night. Spooky is always a good look, so a parallax fogging effect has been added, comprising of 5 layers of an identical texture which are slowly shifted back and forth to give an eerie effect. These layers also serve as a darkening fade, so a forest of bamboo shoots can have some depth as the shoots get darker into the distance.

2D Platfform game - layers

Using alpha transparent plains gives full control over the texturing, these are laid 15 units apart on the Z axis. A 6th layer is used to give a dirt background when under ground, other textures will most likely be added later for stone dungeon type walls etc.

Even though things are a lot more 2D now, the media is still mostly 3D. There are quite a few effects we can add, like real lights in the lanterns so Bruce and the meshes are lit nicely, these only really work on real 3D objects with normals. Background components can usually be done with straightforward plains, although this does put more burden on art package skills - this is why the visuals have a drop shadow look to them.

The fog layers are updated every loop by calling the function UPDATE_FOG(), this will position each layer on a sine wave offset to give the fog life. By changing the Z axis of the plains it would be possible to fade in and out, perhaps this is something that can be used in an end sequence, fading out to a sunrise for example as the fog clears.

Lanterns and Lights

Bruce's LanternsLast time round, Bruce was collecting boring old jewels, whose only real benefit is that they use less polygons than coins, so they're gone and have been replaced with glowing lanterns which break apart when you hit them. They also have a glow plain attached to them for extra effect, this is achieved through a particle system which will perform a range of nice effects.

The lanterns are animated meshes with a straightforward bone structure which allows them to sway back and forth. When cloning the screen objects, the parent is checked to see if it is looping then it's settings are applied to the new object.

I use CharacterFX a lot for jobs like this, it's very straightforward and has robust DX export features. I highly recommend this for people who need quick results and a sharp learning curve.

As the lanterns are created by the map_getobj() function, a particle is assigned to it which is positioned with the bone in the middle of the lantern. So as it sways back and forth, the light particle moves with it.


The particle system uses a new typed array called PART(), with the following variables:

These hold all the properties of the particle objects, which are alpha transparent plains. There are 128 of them, which should be plenty to get some neat effects on screen. I tend to use alpha transparency rather than ghosting because it can give better control over how things look. One key benefit is that it's easy to use sprite type textures like pieces of lantern without having to enable and disable ghosting. There are 3 main parts to the particle system, the creation functions, the spawn function, and the update function.

Bruce kicking up dustFor example, when Bruce is running, dust particles are kicked up randomly. So the function part_dust() is used to call the particle_spawn() function then any properties that need adjusting for dust are applied. Other particle effects are called as functions and have their own parameters, part_dust() needs a 3D position passed to it where the dust particle will spawn.

function part_dust(x#,y#,z#)
` particle_spawn(x#,y#,z#,xs#,ys#,zs#,size#,life_spd#,fade_mode,texture)

There's a few other effects we can adopt using the same principles, for example when Bruce is running over old wooden platforms, dirt could fall down underneath, or if he runs through puddles there could be splashes with every footfall. I find the effort needed to write a particle system like this is worth it when you can add these neat effects so easily.

The PARTICLE_SPAWN() function is used by all the PART_ functions to cut down on function size. Rather than assigning all the properties for each particle, only the special properties like gravity, rotation or collision need set. In the case of the PART_DUST() function the angle is set randomly and the rotation speed is set to a slow rotation. Fade mode 3 is used which sets the particle to fade out when the update function is called.

Fade Modes:

When a lantern is hit, particles textured with broken up images of the lantern are spawned so it appears as if the lantern is burst open. These bits then fade out as they bounce around on the ground. By setting the .gravity and .col properties of the particle it will react to the level structure.

The particles that are applied to objects are re-used when the parent is no longer visible, so they should automatically be re-used. There are other fake light sources, an old fashioned lamp, and wall mounted torches. The torches also spawn particles of fire that rise up using positive gravity and fade out. To spawn fire, the particle update function checks for the torch light image, and will randomly spawn flames if it matches.

Changes to the editor

Because there is so many new blocks to pick from, a very basic block selection screen has been added. This screen is accessed usign the 'B' key. The blocks are split into groups, like GROUND, DECOR, BACKDROP etc, selecting one of the groups from the left side of the selection screen will bring up all the block icons for that group.

A map screen has also been added to make navigation more fluid, a pixel by pixel preview of the whole map is generated and screens can be selected by clicking on them. Over the next couple of months the game map will take form as more media is added, so this should help with planning it out. Notice that some block groups are listed more than once, this just depends on how the groups are laid out. Usually it should take a census of all the different groups and only list each once, if it becomes a nuisance then that's what will happen.

So those keys again:

The number keys are redundant right now, but next we'll add a hot-key system where the blocks that are most in use at that time can be quickly accessed. These can even be represented by their icons along the bottom of the screen. This will be fairly easy to add, and will speed up editing the screens a great deal.

Next month...

It's time Bruce got some company, to beat up. The first of the adversaries; the ninja, will make an appearance, and I promise the Neapolitan ice cream platforms will be gone.

Lee's Tip of the Month - Adding a New Dimension to Your Games

Lee Bamber Conehead!

Over the years, I have written hundreds of prototypes that range from a tiny program to calculate a small bit of math, to an almost entire level editor and game, just to flesh out an idea. On other occasions, I create small prototypes in DarkBASIC Professional to try out new technology, and increase the support for the cool devices that are out there to play with. One of my more recent series of technology enhancing tweaks has been stereoscopic support.

There has been a recent surge in the sophistication of stereoscopic devices, and one of the coolest pieces of kit to own is a stereoscopic LCD display. Costing a little more than a standard LCD, you plug in your graphics card, wear a pair of lightweight wireless glasses and watch as your images pop out at you.

In true bleeding edge style, TGC have worked to develop support for one such device, namely the IZ3D LCD monitor. A new command has been added to the latest upgrade to DBPro to allow the generation of stereoscopic buffers. In addition, a new flag has been added to set display mode to allow double wide backbuffers to take advantage of multi-monitor functionality.

The stereosopic technique is straight forward. Instead of rendering a single camera to the backbuffer, you render two cameras, one from the perspective of each eye. You render the first camera to the left side of a double wide backbuffer and the second camera to the right side of the double wide backbuffer. The device will then take these two source images and feed them to the user using whatever mechanism is needed to get the left image to the left eye and the right image to the right eye.

The IZ3D technology does this by combining the left and right images together and placing them on the LCD display, together with a polarisation mask which works together with the glasses to reveal the correct image to the correct eye.

Polarised 3D image in DarkBASIC Professional
Polarised 3D image of an FPSC level

An example program has been provided which shows a typical FPS scene with mouselook controls. The example creates a double wide backbuffer with the following lines of code:

 set display mode desktopwidth,desktopheight,desktopdepth,vsync,antialias,multimon
 set camera view 0,0,0,desktopwidth*2,desktopheight

When the variable 'multimon' is set to 1, it instucts the command to create a backbuffer twice the size of the display resolution of the desktop. This example uses a full desktop window rather than full screen mode, and the second command stretches the application window to encompass both the current monitors display and a 'theoretical' monitor to the right of the main display. If you have a multi-monitor system, you will notice the polarisation mask displayed on your second monitor. If you had an IZ3D LCD display, this second display would be used by the polarisation hardware to change the main display to allow the glasses to do their work.

The next set of commands in the example are used to create the cameras that will be used to represent the eyes of the viewer, and feed the render of those cameras into images 1 and 2.

 make camera 1 : set camera to image 1,1,desktopwidth,desktopheight
 make camera 2 : set camera to image 2,2,desktopwidth,desktopheight

Once we have the left camera image and right camera image, we can feed those images into the stereoscopic command as follows:

 set cameras to stereoscopic 1,1,2,3,4

This will combine the two images and generate the polarisation mask that we need to feed into the IZ3D device.

The remaining code before the main loop will create two sprites which we will use to render the final stereoscopic images to the double wide backbuffer, load the 3D scene so we have an environment to move around and create an invisible object we can use to help position the cameras based on the position and orientation of the viewer.

This invisible object is made up of a central sphere and four child spheres. The first two child spheres represent the eye positions of the viewer. The second two child spheres are the locations each eye camera looks towards. With all spheres invisible, we can use their world positions to easily position and point the left/right cameras, rather than rely on complex matrix calculations. The whole object is repositioned when the viewer moves and rotates, so we can use 'limb position' commands to get the latest position of the viewer and the direction the viewer is looking.

Three variables called 'eyeswide#', 'focalpoint#' and 'focaldepth#' adjust the relative positions of these invisible spheres and in turn, control the cameras that are associated with them. By adjusting the cameras, you can control such details as the depth of the stereoscopic scene and whether the scene will sink into the monitor or pop out at you.

Combined with mouselook controls, the above code positions and rotates both cameras and produces the images required for the final render step.

The final rendering process happens in two steps. The first step is to render the latest views from each camera to their assigned images (1 and 2). This is done with the following code:

 sync mask %110 : fastsync

The 'sync mask' command instructs the 'fastsync' rendering command to ignore camera zero, but perform renders on camera one and two (our two eye cameras). Camera zero is going to be used in the second step. It is also worth noting that during the rendering of the eye cameras, the command 'set cameras to stereoscopic' kicks in as soon as the left and right eye images are available. This command triggers the generation of the combined stereoscopic image and the polarisation mask which are stored in images 3 and 4.

In the second step, we will render the final stereoscopic images to the double wide backbuffer. We previously set up two sprites with images 3 and 4 and placed them off screen. Sprites in DBPro act as perfect screen space quads and so are ideal for pasting images directly to the backbuffer. We use the 'paste sprite' command to paste a copy of the prepared 'left' sprite to the left side of the double wide backbuffer and the 'right' sprite to the right side of the double wide backbuffer. With the backbuffer completely filled in, we can then write some debug text for our minimal HUD text. The following code will render the above to the main display:

 sync mask %1 : sync

We use camera zero as our main display camera and not as a 3D camera. We use camera zero to paste images and text to the backbuffer. The final 'sync' command presents the final result to the monitor and the loop returns to the beginning.

Anaglyph Stereo image of an FPS Creator level
Anaglyph stereo image of an FPS Creator level

Using the above technique, you will be able to add stereoscopic support to your creations very easily. That said, there is no substitute for seeing the results for yourself. Being able to peer inside your monitor, or have the nossle of a beefy gun stick out of your LCD is a sight not to miss.

iZ3D monitor for stereoscopic gamingFor more information on the IZ3D LCD monitor, you can visit their home on the web.

If you are lucky enough to own such a monitor, for this example to work you will need to disable the iZ3D drivers as DBP uses native support and their drivers will conflict. Also ensure you do not use clone view, and set your monitor up to extend your desktop to the second internal display (dual view).

MTBS3DYou can also find out more information on the world of stereoscopics at MTBS3D

For those of you who cannot quite afford to buy a new LCD right now, there is also an ANAGLYPH Assistpoint 3D glassesversion of the example that accompanies this article which you can use in combination with a pair of red/cyan glasses, available from Assistpoint

May I be the first to say, welcome to the world of stereoscopics! Also, if you are interested in other prototypes, examples, experiments and pieces of code that I have hammered together over the years TGC have released a new product called DarkSOURCE which attempts to gather all these rogue snippets and collect them together in an easy to use archive of code. Veteran users might remember the DarkARCHIVE collection for Dark Basic Classic which allowed you to cut and paste to your hearts desire, well now you can do the same with this cool Dark Basic Pro resource. Check out the full details elsewhere in the newsletter.

Stereoscopics Project FilesThe files for the projects discussed can be downloaded here.

PlayBasic News

Playbasic News  

by Kevin Picone

Inv Sub BlendingThis month, work has almost entirely been focused on the bringing new graphical effects and optimisations to the PlayBasic engine. What effects you ask? Everything from Anti-Aliasing, and bilinear filtering through new alpha blending ink modes such as Alpha Multiply and Inversed Subtractive. The latter gives some really interesting effects for a relatively small performance cost. Optimisation-wise, I've been systematically ripping the old graphics engine apart and rearranging the components. While I'm only currently about half way through the task, the changes are certainly worth it, the vast majority of the rendering routines seeing speed improvements from as little 1%, up to 30%.

AA LinesYou might have heard the of Anti-Aliasing before and wondered what it is. The term is thrown around a lot today, but effectively it encapsulates techniques that smooth the appearance of computer graphics to the human eye. While there's actually a number of ways of achieving such results, in PlayBasic we're taking a rendering approach. That is, we've started experimenting with adding Anti-Aliased fill routines, starting with traditional Line rendering. Initially, I was sceptical of how useful this would be, but that soon subsided after seeing the generic unoptimized version throw around 8,000 lines at 40fps.

Bilinear Filtering, like Anti-Aliasing, is one those effects usually attributed with hardware rendering and for good reason.  Filtering just helps us improve the visual quality when scaling images. It's actually a way of smoothing out the normally blocky (retro) nature of image scaling. Traditionally, old school image scalars work via straight linear interpolation. So when the image is scaled up by a factor of two for example, all of the pixels in the resulting image would become a tiny block of 2x2 pixels. If the image was scaled up 10 times of it's original size, each pixel would end up a large 10x10 block. At that size it would be exceptionally chunky. Scaling down is even worse, as to reduce the image size by half for example, the scaler simply skips every second pixel, regardless of what they are. While this approach is fast, it's not that pleasant to the eye. So what Bilinear filtering does is 'bleeds' the original pixels into each other, so that when you scale an image up/down the resulting pixels get smoothed into each other.

For all the latest information on the current PlayBasic V1.63 betas. See the announcement thread here.


Heroes Quest - 2008 PlayBASIC game making competition

Heroes Quest Competition

In the mood for a little competition? Want to put some of that $1500 booty in your back pocket? Well, Heroes Quest is still running and you've got until the 1st of October to show your programming skills. Don't miss it out!

Not familiar with the Heroes Quest? - In this years theme, contestants are challenged to design a character-based platformer (in PlayBasic), where players must guide the hero in search of long lost treasures, or rescue the damsel in distress, as always. Designers are free to choose any type of play form representation that they see fit, be it side on, top down, isometric or even 3D if they're up to challenge.

Competition SiteHead over to the competition site to get started.

Over And Out

Until next time, I'm off to continue bashing bits in some other dimension. Other wise known as sitting at my dev pc :)

From the Forums

A few links you may have missed over the past few weeks...

Medialess GUI Collection

Following on the code snippets theme, this collection of functions for DB Classic (V1.2 but should work fine in V1.13) does not use a dll or external media so can be used with all versions of DBC. It includes Message Box, Alert Box, Input Box and Colour Picker functions.

2D Editor Snippet

If you thought editors had to be complex, think again. This snippet, comprising of just 218 lines, shows how much can be achieved by thinking simple. It can also be applied to many different game types, not just the advertised Wolfenstein-style.


This month's Winner

Each month we pluck one lucky subscriber from the newsletter mailing list and award them a free copy of DarkBASIC Professional. The email address of this month's winner is: deadmilkman@??????????gas.??? If this is you then send us an email to claim your prize.

This months front cover

The cover of this months newsletter was painted by Arthur Wang, an industrial design major at R.I.T. He has a yearning to be a sci-fi / fantasy concept artist for a games company when he graduates, but is actively soliciting artwork commissions in the meantime. His styles include sci-fi, fantasy, mecha, manga, pin-up and more. You can see more examples of his work at his web site: http://www.aethercore.com or browse his Deviant Art gallery.


Share your news with over 19,000 active games developers!

If you have something you'd like featured in a future issue then please get in touch and include as much information as possible (including where applicable: screen shots, URLs and zip files).
Issue 68 deadline - August 27th.

When we wake up in the morning, we have two simple choices.
Go back to sleep and dream, or wake up and chase those dreams.