editorial / april 06

Issue 39 cover

Welcome to Issue 39 of our newsletter. There is a lot going on this month and I can assure you, none of it is an April Fool! There is the latest version of Upgrade 6 for DarkBASIC Professional, news about the forthcoming DarkPhysics and DarkAI expansion packs, a stunning new shoot-em-up called Phoenicas, a competition to win over £1000s worth of PC, Play Basic news and plenty more besides!

Unless this is your first issue, you will have probably noticed the newsletter has a new look. This is mostly to cut down on the amount of HTML making up the issue (as the content count is increasing rapidly), and also because the old layout looked terrible in Gmail and Hotmail. The new layout formats much better in webmail clients (which tend to strip out all CSS formatting), but is still a little funky in Hotmail, so if you are reading it from within Hotmail we strongly recommend you view the online version instead - it's SO much nicer! Gmail does a slightly better job, but not much. Of course it looks perfect if your email client renders HTML correctly. But don't forget you can always read the issue online too.

Until next month, keep coding!

contents

(1) DBPro Upgrade 6 RC4 (2) PhysX Preview (3) FPSC Model Pack 2 (4) Dark A.I. Sneak Peak (5) Win a PC Competition (6) Phoenicas (7) PlayBasic News (8) DBPro Mastery (9) From the Forums (10) Scraggle Give-away (11) RPGDTE II (12) Fruit Matrix (13) DBPro Tech Tips (14) DBPro DLL Round-Up (15) The Winner (16) Outro

DarkBASIC Professional Upgrade 6 RC4

To coincide with this issue of the newsletter we have made available Upgrade 6 Release Candidate 4 for DarkBASIC Professional. The entire Upgrade 6 development process has been a community lead one. With your bug reports we have managed to track down and eliminate literally hundreds of bugs and issues, creating what we firmly know is the most stable and rock solid version of DarkBASIC Professional ever.

To participate all you need do is install the latest upgrade (taking care to back-up everything first) and then test as much code with it as possible. If you notice things behaving incorrectly, isolate as much as possible the root of the problem, and then post about it to the Bug Board in our forum, where it will looked at and dealt with.

Download Upgrade 6 Release Candidate 4: DBProUpgrade60-RC4.zip (12.5 MB). Be sure to heed the readme file notices about the version of DirectX required.

AGEIA PhysX comes to DarkBASIC Professional

As we announced in our Product Bulletin a week ago, we are bringing the full AGEIA PhysX engine directly into DarkBASIC Professional via our affordable DarkPhysics system - out this May for less than $60. PhysX is a real-time physics system that can operate in both software and hardware modes. With a PhysX card in your PC the grunt math-work is taken away from your CPU and passed to the PPU. The net result? Less strain on your processor, meaning more utterly insane special effects in your games than ever before! The best part of all is that you don't need a PhysX board to take advantage of this, as it can also work 100% in software mode. Our DarkPhysics extension will of course support both modes, so you can enable 'insane physics' action for PhysX board owners, and standard but still jaw-dropping physics effects for the rest!

Now we appreciate that if you follow our forum, or read the bulletin we sent earlier, that none of this will be of any great news to you. However what we're going to show you now are some screen shots of the DarkPhysics system in action.

PhysX

In the screen shots above you can see three different physics properties in action. Shot 1: On the left we have some 'bouncing objects'. The angled platforms cause the falling balls to rebound accordingly. You can define an objects 'bounce' properties, perhaps giving it the surface effect of rubber (highly bouncey), or solid wood, or metal. Shot 2: Here we are looking at a rigid bodies system in operation. Before the screen shot was taken the wall was fully built, the blocks all stacked quite happily on-top of each other. Then we blasted a few cannon balls through it :) Shot 3: This shot demonstrates the combination of various physics objects to create a piece of machinery. Those tower-like struts are built-up of lots of stacked cube objects. The rotating arm, with the rope-like dangling balls, swooshes around and smackes the blocks off the towers. Naturally, everything responds and reacts the way you'd expect. Not too bad, but now for something even more impressive in the next three screen shots.

PhysX

We've included some high-res versions of these pics, so you can make out what is going on better! Shot 1: On the left you can see the PhysX Cloth system in action. A cloth object (the rug) has been twisted around a column, drapped over a box, attached to a flag-pole and even strung between two beams, where it hangs and swings in the breeze [ view full pic ]. Shot 2: Welcome to Particles, the PhysX way! Here we've set a roaring fire into action. The flame and smoke particles drifting up into the air. Of course, being fully physics driven particles, if you were to now fly an object through them, they would swirl and distort accordingly [ view full pic ]. The final picture, Shot 3: demonstrates Cloth again. But this time we have increased the fragility of the cloth itself, and then let rip at it with a stream of bullets (sphere objects). As you can see, they have actually ripped a hole right through the cloth! Keep blasting for long enough and you can demolish the cloth into tatters [ view full pic ].

So there is just a small taste of what to expect from DarkPhysics for DarkBASIC Professional. We will cover some more physics topics in next months newsletter, which will be very close to the official release date of this extension. If you'd like to watch a video about how the PhysX chip works, and what to expect, then Gamespot.com have a great one: View Gamespot Video.

FPS Creator Model Pack #2

We are pleased to announce the availability of FPS Creator Model Pack #2

FPS Creator Model Pack 2

This pack includes 71 brand new objects for your FPS Creator games. There are new room scenes (with random tiling textures), new doors, ceilings, two new characters including a meat-cleaver wielding zombie! and no less than 55 new items. The items range from animated security cameras to street lights to main frame computers. The pack follows a modern-day theme and all models with animation come fully scripted and ready to run.

Model Pack #2 is on sale now and costs $16.46 - €19.99-/ £11.99

Click here for details including a download that shows all models.

Dark A.I. for DarkBASIC Professional

Dark AI

One of the most requested features for DarkBASIC Professional, along with physics were A.I. (artificial intelligence) commands. Commands that would help with pathfinding, and adding intelligent behaviour into your games, making opponents and allies smarter. To this end we're pleased to give you this sneak preview of the forthcoming Dark A.I. extension. Developed entirely in-house by our latest TGC recruit, Paul Johnson, Dark A.I. will offer developers the following abilities, implemented as native DBPro commands:

Path Finding - Flexible waypoint based path finding system that calculates a set of waypoints around all obstacles added to the AI system. Entities then use an A* algorithm to calculate a path between their position and destination. This means your entities should always use the shortest path between two points, no matter how complex the situation.

Dark AI

Teams - Provides 3 teams (enemy, friendly and neutral teams) to organise entities in the AI world. Neutral entities run away from combat, friendlies attack the player's enemies whilst enemies attack the player and his allies.

Autonomous Control - By default entities will automatically move about the world and react to events (e.g. Sounds) and other entities according to their team and aggressiveness.

Entity General Commands (automatic mode only) - Set the entity aggressiveness and restrictions by using commands such as 'Defend Point' or 'Patrol Path', the entity will then act in accordance with these restrictions.

Manual Control - Entities can optionally be set to manual control which allows the user to program their own responses to AI events.

Entity Specific Commands (manual mode only) - Get entity information with 'Get Current Target' and set the entity destination or look at point directly with 'Set Destination' and 'Look At' or 'Look At Target', the entity will create a path automatically to its destination and inform you when it's ready to fire.

Avoidance - Entities will automatically detect and avoid other entities in its way, you can also use an external physics/collision system to notify the AI system that an entity has collided with something to force it to avoid non-AI, non-static objects.

Zones - Add one or more zones to an entity that will trigger a response when an opposing team member enters it. Entities can be set to ignore people if they leave a zone or chase them until they can no longer see them.

Direct Integration - If using DarkBasic Professional 3D objects you can set the AI system to automatically move and turn your objects for you.

Not Limited To 3D - The internal system is based around a 2D top down view and allows you to create your own 2D avoidance shapes manually, allowing its use in any situation that can be represented with 2D shapes. Entities can also be added without an associated 3D object, with their AI modified position values available through 'Get Entity X' and 'Get Entity Z' to position your own entities.

Debugging Commands - A range of commands are available to display the internal state of the AI system, including displaying all waypoints and their connections, entity paths (calculated to avoid obstacles), obstacle bounds, AI events (e.g. Sounds) and entity view/hearing ranges.

Dark A.I. will be available in the next couple of months.

Win a Beast of a Gaming PC with FPS Creator

PC Zone Competition

NVIDIA in association with The Game Creators and PC ZONE magazine are offering you the chance to win a brand new Dell XPS 600 gaming PC worth over £1000. Two runners-up will also receive an NVIDIA GeForce 7800 graphics card and a copy of FPS Creator.

So what do you have to do in order to see this behemoth ending up on your doorstep? Well, you need to get hold of issue 167 (May 2006) of PC ZONE magazine (UK edition), and turn to page 123 quickly. There you will find the full instructions on entering the competition. Using either the 30-day trial of FPS Creator, or the full version, you must create a single level, which cannot take more than 5 minutes to complete. This level should be sent to PC ZONE (the address is in the magazine) on CD/DVD. Entries will then be judged by an expert panel, and rated on the following criteria: Design, Playability, Use of graphics and sound, and an overall Fun-ness rating.

The closing date is Wednesday May 24th 2006. PC ZONE can be found at all good newsagents, and online at http://www.pczone.co.uk. This competition is only open to residents of the United Kingdom.

Phoenicas - 2D Blasting Mayhem

Phoenicas

"A new wave of attack from outer space is coming ... You are to stand in the gap for all mankind!"

Athens, Greece - March 29, 2006: Mytaras today announces the release of Phoenicas, a new challenging 2d shooter, giving you a fresh taste for action shooters. Now, you are plunged into space war turmoil, where a quick reaction and peace of mind are essentials, which your survival depends on. A special task is entrusted to you: you are to lead a convoy, which consists of 6 spacecrafts including yours. To your horror, your spaceship is the only firing vessel, which can stand in the gap for the rest of five. These five human spacecrafts are easy prey to various monsters, which inhabit the vast expanses of the universe. Your enemies are going to make numerous attempts to kidnap or to destroy you and all of these flying vehicles.

Phoenicas

Smash your enemies and save those, whose life is in your hands! Upgradeable weapons (stream fire, heatseekers, followers, etc.) and powerups are at your service! The score oriented gameplay allows you to apply various techniques to get the highest score: combos, fastkills, selective shooting and accuracy, as well as defending and rescuing humans from the claws of your enemy. A unique feature to be noted is a 2 player mode, where the second player can use mouse to put credits won by the first player into action. Another tidbit for a shooter is an expert control mode. Having this option switched on, a player is able to tilt his/her space interceptor to aim. When in hands of a shooter expert, this option becomes a truly ferocious weapon.

Intense and original tunes, which accompany each level, have been composed to express the choreography of the battle at one or another moment. Superb graphics not only show the whole battle field in details, but also pays great attention to special effects, which only intensify your complete feeling of dynamics and realism. One more merit of Phoenicas is its level system, which in fact is a nintendo-type unlocking system of modes. Easy mode will only get you up to part 2. You will have to face the full onslaught of normal mode to reach part 3 and unlock the ultra mode. This mode is a really tough nut to crack, since it spans over 100 waves of attacks. When the main mode is over, a marathon mode becomes available, which only cycles and gets more sophisticated from one moment to another.

Phoenicas runs under Windows XP and costs $19.95 (USD). A demo of the game, which features a tutorial, is available as a free download at http://www.phoenicas.com. This is a fine example of DarkBASIC Professional coding!

PlayBasic News

Play Basic

PlayBasic is a cutting-edge programming language that allows you to create powerful, fast 2D games and applications that will work on a variety of hardware - from the oldest onboard video cards, to the latest GeForce 7800s. Ideal for creating games for the massive Casual Gaming market due to the small EXE sizes and low hardware requirements. Here is what's new in the PlayBasic world this month.

Patch Version 1.28

This month, work has been divided between the compiler and the dreaded documentation. For the docs we've invested most of our time bringing them up to date. Which at the last build was up to 1060 categorized, searchable pages. We've really tried to document every new command. There are few that are left outstanding, but those are not officially supported yet. Play Basic V1.28 is available on the UnderwareDesign.com forums and should be available on The Game Creators Play Basic site within a few days.

What is in Version 1.28?

This patch incorporates a huge melting pot of new features, bug fixes and of course speed-ups. With V1.28 release builds being the fastest to date. Additions wise, there are too many features to list, but they range from new compiler data type expansions (like pointers & type extensions), ActiveX / .NET dll & Flash support, vastly superior runtime error trapping, vertex rotation & polygon mesh support, more sprite render modes, more MMX optimizations, FX support for Maps and many new miscellaneous commands for you to explore!

Demos from the PlayBasic Forums
The following links are just some of the things that we and users have been developing with PlayBasic recently. So take your time and explore the ever growing world of possibilities that PlayBasic offers.

FX Maps
Graphically, we've been working towards implementing a native 'FX map' format. This format will be for mesh based tile maps. Thus allowing them to be scaled / rotated etc. The 2D Platformer in 3D tech demo in the Forum Links above, uses a rough prototype of this method to test the raw viability - and it works really well, even on older machines! We have a few other additions and flexibilities in this area on the cards. But we'll leave that for another time.

PlayBasic is on sale now for $34.95 from //www.thegamecreators.com

DBPro 'Heads Up' Tutorial by Steve Vink

DBPro Mastery

Can you name one game that doesn't have a HUD? (Heads Up Display) No? I can't either. Even the earliest of games including Pong, Pacman and Space Invaders incorporated a crude display system for presenting scores. PongSo it's safe to assume your players have a right to expect feedback on the gameplay. In this tutorial we will start with the most basic of HUDs and work up to something far more polished. Each one has it's merits and drawbacks, and we will investigate these as we proceed.

Tutorial Framework
Each of the examples will follow the same framework for the HUD. There is a function, InitHud(), to perform any initialisation before the main application starts. In most cases, this will involve loading any images we require, and defining the positions of each component on the screen. There is a second function, UpdateHud(), which is called at runtime to perform any changes required to the output. Every example uses the same 2 functions, albeit to perform different actions.

Text-based HUD
The simplest form of user feedback is to write text to the screen. This can be done with the PRINT command, or the more flexible TEXT command.

TEXT Position_X, Position_Y, MyData$

Before you dismiss this method as being too basic, it has important advantages. The most obvious advantage is that it's quick to implement. One line of code can instantly enlighten the user to the impact of their actions. The scenario under which you might consider this method is during development and debugging. Displaying key values and parameters on-screen empowers you with a very effective tool for quickly finding and resolving problems. Your beta-testers will have no issues with presenting data in this way in order to improve the end product.

Text HUD

Example 1 will demonstrate this method, and also introduce you to our test program. It's a simple sphere rotating and flying through space. Our HUD must provide 5 pieces of key information: the X, Y and Z rotation of the sphere, it's velocity and our framerate. Review, compile and run the program to see our simple HUD in action. As simple as it is, it will reveal some critical flaws that we need to deal with.

Having run this example, what do you think is wrong with the information displayed, aside from the basic format? There are two particular issues that are what I would call "Showstoppers":

Before improving the design of the HUD, these two issues need tackling. The first revolves around the fact that our program data is far more precise than a user is concerned with. Consider the example of a racing game; working in whole units for the speed is quite acceptable, although the program could and should work to several decimal places. In business applications, it is normal to "layer" your development. Layer 1 is the complex and precise data, layer 2 is the process and logic, and layer 3 is the simplified, user-friendly presentation layer. The program and the user are 2 distinct entities and we should bear this in mind when designing.

In this example, integer rounding will be used to tidy up the angle data, and truncation to make the velocity, which is a small value, into a more presentable format. Integer rounding is achieved by simply moving the data into integer variables. Truncation is carried out on string-based data, and reduces the number of characters shown. You can see this change by opening and running example 2.

dispX = OBJECT ANGLE X(cSPHERE)
dispY = OBJECT ANGLE Y(cSPHERE)
dispZ = OBJECT ANGLE Z(cSPHERE)

IF gSphere.vel# > 0
	velocity$ = LEFT$(STR$(gSphere.vel#),4)
ELSE
	velocity$ = LEFT$(STR$(gSphere.vel#),5)
ENDIF

The second issue of the speed of data changing on the screen will work to our advantage. The game HUD is not the primary focus in a game; although it provides an essential service, the user will be concentrating their mental energies on the game action. Updating the HUD every cycle is not essential. We can preserve our frame rate by updating the HUD on a less frequent basis, and as a by-product we resolve the problem of fast-flickering, meaningless HUD data. The text-based HUD is a bad example of this optimisation. Irrespective of the number of updates we make, the TEXT and PRINT commands dictate that we must write the data to the screen every cycle. So before we implement this change, we'll move on to the next type of HUD.

Sprite HUD

Sprite-based HUD
Sprites are ideal for displaying data. They involve a little more work, but they always face the screen and they are self-supporting. Once on the screen, they will happily sit there without any further intervention. Bearing in mind we want to stabilise our previous solution and allow less frequent updates of the data, let's transfer our text to sprites. This is an easy step from one method to the other. These are the steps we must follow:

In code, the solution looks like this:

MyText$ = "DarkBASIC Professional"
CREATE BITMAP 1, TEXT WIDTH(MyText$), TEXT HEIGHT(MyText$)
TEXT 1,1,MyText$$
GET IMAGE 1,1,1,BITMAP WIDTH(1), BITMAP HEIGHT(1),1
DELETE BITMAP 1

Note that we can set the image width and height to exactly match the size of the text. It's also essential to realise that creating a bitmap makes it the current drawing surface, and deleting a bitmap reverts the current bitmap back to the screen. One additional factor to consider is the drawing order. Now we are combining 2D and 3D it is important to specify how we wish to apply them:

DRAW SPRITES LAST

Example 3 shows this method in action. A function has been implemented to convert text to sprites. Visually, nothing seems to have changed. But you will notice that the angle readout is more stable, and looking at the code you'll see that we are only updating the HUD twice a second now, rather than 60 or so times per second. One issue have now introduced may be apparent depending on the specifications of your PC. There may be a noticeable glitch every 500 milliseconds, and this is caused by the slower bitmap-oriented commands we have introduced. We will solve this problem as we move towards are more flexible HUD, but still based on the same sprite commands.

Bitmap Fonts and HUDs
Our plain text is not very "sexy", for want of a better word. Our next method relies upon using one sprite per character, and if we are going to put our efforts into making an image per character, there is only a small amount of extra effort required to introduce bitmap fonts at the same time. You may wonder why we should make this extra effort. The answer is that it allows us to perform all of the intensive operations before our game starts, and frees up valuable time later when we come to display our HUD. We will create all of our images and sprites as part of the program initialisation, and use fast, efficient code later when we need it. So the initialisation consists of:

An extra task has been added - loading static HUD images. Here are aspects of our HUD, such as the labels that identify each value, which never change. To optimise the code, we will load static images of these components and apply them just once during the initialisation. Creating the bitmap font is beyond the remit of this tutorial, so one has been provided with the sample code. When the time comes to display the values, we will apply our character images to sprites. This action will take place just once every 500 milliseconds, and changing the image of a sprite is a very fast procedure. The process of creating bitmaps, applying the texture and getting images has also been removed from this stage so the code is now very streamlined. The runtime process is:

Once again, in code the process is quite straightforward. This snippet applies the characters to 4 sprites:

Value$ = "1234"
FOR n = 0 TO 3
   SPRITE n, Position_X(n), Position_Y(n), ASC(MID$(Value$,n+1))
NEXT n
Bitmap HUD

At first glance the code looks daunting, but I assure you it's not. When the character sprites were loaded, we assigned each character to an image number of the corresponding ASCII value. In ASCII, "A" is represented by the value 65, and so image number 65 is used. "B" is 66, "C" is 67 and so on. To apply the correct images, we simply interrogate each character, and assign the corresponding image.

The result is presented in example 4. The look of the test application has changed significantly, and the processes behind this improvement are actually faster than the more primitive design. HUD design is a vast topic, but this tutorial should stand you in good stead for getting creative and taking your game to the next level. Along the way, you will also benefit from faster debugging techniques using your own development-phase HUD.

Until next time, Happy Coding!

Download the tutorial and all source code

From the TGC Forums

Our forums recently hit the 800,000 post mark - so we are well on our way to 1 million posts by the end of 2006. That is quite an achievement and highligts the diverse range and size of our community. Here is a selection of current hot topics worthy of checking out.

gameDentity

Nothing to do with dentists, this is a 'game profiler'. In laymans terms it means everyone has their own game saves & settings for every game played via the gameDentity system. Even if others don't use gameDentity, your game saves and settings are safe and unique, plus they won't interfere with the games 'default' game saves & settings prior / after using gameDentity.

Dungeon Pack

Frogames have converted their Dungeon Pack (a cartoonish art content pack for video game developers) that was originally created for Torque, and turned it into something useful (for the rest of us). The graphical quality of this pack is amazing, make no mistake about it - this is professional quality work, and for $35 for over 50 different objects, you can't really go wrong.

SuDuko Solver

This is a small selection of code that will solve a suduko grid. Their is no GUI (graphical user interface), the suduko you wish to solve has to be entered into the code. A GUI could be easily made using BLUEGUI though. Sadly this doesn't solve the fact that suduko is extremely boring ;)

Futurama Games

As something of a Futurama fan I couldn't help but notice these two little games slip onto the forum. One sees you piloting the Futurma space ship, the other you take control of Fry in a Mario Bros. style affrair. Simple, crude but amusing fun none-the-less!

Free Beer!

Well.. sort of, EgoAnt has released the source code to two of his games for free. The first is Beer Run, which was actually a TGC competition entry game many years ago. The second is Perimeter Breach. Download for free, check it out.

Base64 encoder / decoder

Ok so this doesn't sound like the most interesting thing ever, but if you have a need to encode (or more likely decode) a base64 file, here are some functions to do it! base64 encoding typically takes place when you attach files to email messages.

Scraggle Give-Aways

Scraggle

TGC Forum vetern Scraggle (aka Craig McFarlane) has, in a fit of utter genorosity, released a whole bunch of free media for you all to use. If you need some funky bitmap fonts for your games, he's released loads of them spread over two packs. Or are you making a shmup? Then why not try out his Nebulae, Stars and Suns, or Planets pack. They are all free of charge and you don't even need to give credit if you don't feel like it. Grab the packs from for the forum links below:

RPGDTE II

RPGDTE

We have featured RPGDTE in the newsletter before, many issues ago, and this is the latest version. Created in DarkBASIC it is a complete 2D RPG building package that allows you to create games in the vein of the early Zelda or FF series, complete with quests, magics, shops and all the staple RPG elements. The author 'IronHoof' has created a special demo game for newsletter readers, see if you can find the hidden DarkBASIC related elements!

"The RPGDTE is a blank engine which runs Ty7 scripts. Plenty of examples and complete help documents are included. The hard part of programming an engine is done for you, all you have to do is write your game. The RPGDTE is a Windows based 2D console style RPG game engine with the look and feel of a console game. Its 16-bit millions of color low res near 1:1 ratio 320X240 pixel gives it the classic console feel and perfect balance. GamePads and Joysticks are supported to make you forget you're using a computer as you play! If you ever feel like you need help seek out the forum or email the author."

Download the exclusive RPGDTE game from http://rpgdte.arconian.com/dtedemo.zip and visit the website: http://rpgdte.arconian.com

Fruit Matrix

Fruit Matrix

Fruit Matrix is a fruit machine simulator. To me, fruit machines have always appeared as something of a black-art. You either get them, or you loose all your money in what seems to be an utterly random fashion. At least with this DarkBASIC Professional created version you don't drain your pockets for real. The 3D aspect is well done, the machine lights up as expected, and it has the usual array of baffling fruit extras and bonuses.

There is a free demo version to try (although it only lets you win so much money). The full game features 4 reels, a Hi-Lo gamble, 4 camera positions, high score tables and is fully 3D. If you enjoy it you can buy the full version online.

Grab the demo and more information from http://www.stinkypig.co.uk/FruitMatrix.html

Tech Tips - Group Therapy - by Grant Clark

Tech Tips

"Moving lots of objects in a complex manner, without using lots of complex math"

Have you ever looked at a shoot-em-up game and wondered how some of the enemy formations are controlled? Watch the behaviour of groups of baddies in arcade games and you start to question how it's done. Most programmers will say that you have to use complex math to get all the baddies to move and rotate in a single group or particular way, math that often hurts the brain of indi coders who lack decent math skills. Take me for example, I have serious problems when it comes to anything more complex than SIN and COS and this holds back development of games that require complex group movement. There must be a solution to the problem of complex group movement that suits non 'math-savvy' programmers, and surprisingly there is.

Enter a universe you can't see (no, not the matrix - it's the magic of natures numbers)
The universe is held in place and controlled by invisible forces based on math driven principles, they control every aspect of the movement and behaviour of the universe yet we cannot see them, this is also true of the underlying math that is used to control the movement of groups of objects or baddies in computer games, there's no escaping the need for math even though it's not always visible to us. Everything that exists is based on math principles, even the great mystery of life itself relies on math. Thankfully for us DBP programmers, we have math which exists on two seperate levels within our favourite programming language. It's best to think of these levels as the math you program yourself (in DBP code) on one level, with the math the 3d portion of the DBP engine has built-in on the other level (the invisible math). We will exploit the latter to our advantage, which in turn will save us from many math headaches in the process.

Tumble and scale (the complex behaviours found in simple geometry using rotations and scaling)
Take a standard DBP cube and rotate it on a single axis in 3d space, this is the 3d version of your normal 'hello world' program. At fisrt you'll probably only notice the cube as a whole, rotating in space in a rather boring manner and being just a 'spinning cube', You would be right. Now look again, but this time look at the corners of the cube and watch how they move. If we take just the corners and ignore the rest of the object, we see that the corners appear to orbit the center of the cube in a rather controlled manner, this is a hidden by-product of the spinning geometry which often goes unnoticed by most DBP users and is extremely usefull to non math-headed DBP games and demo programers, basically our cube gives us a way to track the positions of 8 points in 3d space by addressing a single object. Now add the possibility of being able to scale the object up in size as it rotates, suddenly you have helical and spiral motions as the object rotates and scales which are pretty complex to program math wise.

Don't Panic (why we don't need vertex information for our system)
If we were trying to extract the pure vertex / point information from our cube to use as locational markers in 3d space, we would pretty much arrive back at the level of complexity we are trying to avoid. This would be a step in the wrong direction for this exersise (and my head!), so what can we do to make it simple again? Easy peasy, We can get around this problem by using geometry that is composed of smaller chunks attached to a master object as a series of limbs. We can then retrieve the positional data for any limb on demand and use it as positional information for the placement of visible objects in our game or demo, so eliminating the need to access object vertex information. DBP is very adept at handeling objects with multiple limbs and this makes our life super easy from a math point of view. We can either make our enemy control geometry using a 3d editor for simplicity and visual construction, or we could use pure DBP code to make an object from seperate meshes. Which ever method you use to make your control objects the principle is the same, I prefer to make control objects using the visual approach in a 3d editor for speed, with the added bonus you can see what your formations look like before using them. Usually I have cubes for limbs, but a single poly will be enough if you're worried about memory usage or system performance.

Tech Tips

Let's see some action then (the demonstration)
Download the zip file that comes with this article, and have a play. Try some experiments making you own control objects and placing them in the program. The system can work for sprites too, simply get the real screen co-ordinates from the various limbs and hey presto, instant sprite control from the hidden 3d object.

Tech Tips

Multiple control objects (mass group therapy)
There is no reason why you can't have many control objects in your game or demo, each control object being a different formation of enemy in your game. Using this technique with a few carefully constructed control objects can give the impression of masses of underlying complex code in your DBP game or demo without using much in the way of real program code and math. Another advantage of using this approach is the ability to detect collisions with the control object, and if a collision is detected with the control object, you know to check each object attached to it. So as well as making the movement math much more simple, It also makes collision detection more efficient if you use the control object as a pre-emptive check on the actual enemy collisions. What this little tutorial / demo is designed to show you more than anything else is this. Never take what you see in 3d as a whole, look closely and observe the usefull behaviours that can be extracted and used in place of complex code, letting you the programmer get on with the serious business of making games, not struggling with complex math.

Till next month, Cya.

Download the tutorial and source code.

DarkBASIC Professional DLL Round-Up

There have been a number of new DLLs released for DarkBASIC Professional recently. Here are a selection of those that caught our eye.

DBProAVI.dll

Here is the FIRST release of the imaginatively named DBProAVI.dll. Summary of what you get (so far): New Commands: 'EXTRACT AVI FRAME' will extract a single frame from an AVI file of your choice and save it as a BMP. 'MAKE AVI' will create a new AVI file. 'ADD IMAGE TO AVI' will add an image to your AVI animation. 'CLOSE AVI' closes your AVI file. Please take into account that this is a VERY early release and as such has a few bugs, but it IS useable in it's current state.

DBPro Collision DLL v2.0

"I've had this sitting around for a while now, with the posibility of including it as core commands in DBPro. But in order to preserve legacy code, and avoid the complexity of adding it in, it\'s being released as a seperate TPC DLL. Main new features are sphere casting / sliding, and an object collision(a,b) replacement."

Goga's Free DBP Plugin

"Hello world, in last days i've been worked on the second version of my "Goga's Free DBP Plugin" and here it is! Total Commands: 33, Version: 2.0 Beta. This DLL performs tasks such as opening System Properties, Save dialog, Run dialog, Open With, Organise your Favourites, MsgBoxes and more."

Tempest - A peer-to-peer UDP multiplayer plugin

"After almost a year of on-and-off development(and still developing) I have decided to release a free version of my multiplayer plugin. It is fully functional and there are no time restrictions. The difference between this and the commercial version is that the latter will have extra command sets and security features such as encryption and passwording. I created this plugin to allow speedy transfer of data between players, making it most useful for faster paced games. The two most important factors in this are the fact that it uses the peer-to-peer network model, and the low-overhead UDP protocol. I took into account the fact that UDP isn\'t a reliable protocol and I coded a guarantee system to ensure that messages would get to their destination (this can be used by specifying a flag when sending a message)."

Winsock 2.2 Plugin

"The plugin has 28+ commands so far and is fully documented. You can access the help files with F1 if your editing cursor is above a winsock command. All the commands start with "WINSOCK" to better keep them clustered. There are two server-clients examples included in the help directory, which should help you get started. The chat server and client is easier to begin with, as it uses the easy command: WINSOCK SEND STRING If you want to get more advanced, then have a look at the other server and client example included, where you can send packets that you made up in a memblock or memory location."

Whisterstore

"Hi. I just wanted to let DarkBASIC Pro users know about a new DBPro plugin, Whiskerstore, that provides easy access and storage for flexible objects in a datastore. Whiskerstore makes it easy for you to manage the complexity of your game data. There are two versions, a free one and a professional version. Both the Free and Professional versions can be used royalty free on any game you create, even commercial products. Both versions provide basic storage and retrieval of flexible objects with as many named properties per object as you wish. Unlike traditional table-based databases, your objects do not have to all have the same properties. The Professional version adds support for managing lists and lookup tables (often called hash tables or dictionaries) as well as support for classes, optimized indices, and complex logical queries."

D3D Func

The dll includes a variety of new DirectX commands including super fast antialiased text. 3D dots and lines plus new improved 2d box line and dot. All this and much much more!

This months Winner

Each month we plcuk the email address of one lucky subscriber from the list, and award them with a free copy of DarkBASIC Professional. To claim it all you have to do is send us an email (from the winning email address, naturally) The winner this month is: waltervdv@????????.net

Outro

Share your product / project news with over 12,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 40 deadline - April 28th.

Next month we will be featuring a complete round-up of all goings-on in the FPS Creator community. Oh and the 20-liner will return!

Valid XHTML 1.0 Transitional