We have held an annual programming competition for a number of years now, partnering up with the likes of NVIDIA and Alienware. And guess what? Yes, it's time for our 2006 TGC Programming competition to kick off! Sponsored by AGEIA and BFG Technologies we have thousands of dollars worth of awsome prizes on offer, for two competitions that will run concurrently. The theme this year is 'physics' (specifically Dark Physics / PhysX). Read the article this issue for the full details. The deadline is quite short on this one so start coding as soon as possible.
This month we see upgrades to nearly all of our core products: FPS Creator, Dark AI, Dark Physics, Unity, DarkGDK, TreeMagik and T.ED. You'll also see news of the new 'Hands on DBPro Vol. 2' book (including an exclusive 3 page sample PDF), three superb tutorials covering Dark Lights, bone based effects and speeding-up Dark Physics, as well as two new Model Packs for FPS Creator, a great game and a superb new plug-in for DBPro called Styx.
Don't forget you can read this newsletter online, which is a much nicer experience if you are stuck within a web mail client. See you next month for issue 45, and don't forget to start compo coding now! With so many cool prizes on offer you'd be mad to miss out on this one.
Cheers — Rich
(1) PhysX card promo (2) FPS Creator News: Upgrade 1.01, Model Pack 3 and 4, DarkFaction and Bird of Prey (3) TGC 2006 Competition (4) Dark AI Update (5) Dark Physics Update (6) Styx for DBPro (7) TreeMagik & Unity Updates (8) DBPro Mastery (Lighting Scenes) (9) From the Forums (10) Lee's Tip of the Month (11) T.ED v5 (12) Hands on DBPro Vol. 2 (13) DBPro Tech Tips (BendyBones) (14) PlayBasic News (15) UW DB Code Archive (16) Super Karting (17) DarkGDK (18) shmup-dev compo (19) The Winner (20) Outro
BFG Tech, AGEIA and The Game Creators are lowering the cost of entry to the exciting new world of dynamic physics programming with this special 60 day rebated offer. Simply buy a BFG Tech PhysX card from the online partner NewEgg. After purchase return to our promotion web page and buy your copy of Dark Physics (with DarkBASIC Professional if required). After the mail-in and online rebates you could have saved up to $90.
Massively Parallel Physics Architecture | Highly tuned multi-core processor complex optimized for dynamic, large-scale physics processing. Accelerates real-time physical motion and interaction at a scale and quality far beyond what’s possible with CPU or graphics processors. | |
High-speed GDDR3 Memory Interface | Support for GDDR3 memory delivers smoother game play via on-board acceleration of dynamic physics geometry and simulation objects. | |
AGEIA Universal Continuous Collision Detection | Enables entire environments to be interactive and destructible, with massive scale of collisions and response between fast moving objects. | |
AGEIA Physical Smart Particle Technology | Empowers tens of thousands of realistic smart particle calculations of volume, density and pressure for pervasive fluids, smoke, rain and debris. Goes beyond simple graphical particle systems which are unable to interact with dynamic objects. | |
AGEIA Complex Object Physics System | Drives physics processing beyond a few primitive shapes and simple effects to more accurate and realistic representations of physical objects and interactions. | |
AGEIA Scalable Terrain Fidelity | Delivers physical landscape accuracy and genuine surface reactions for true environmental experiences. | |
AGEIA Dynamic Gaming Framework | Flexible AGEIA PhysX hardware architecture provides an upgrade path to tomorrow’s powerful feature and performance enhancement via software. |
Read the full details at //www.thegamecreators.com/?m=view_product&id=2025
Things in the land of FPS Creator are certainly heating up. We are working on a wide range of developments within our research labs and for the best part of 2006 we have focused on the DarkBASIC Professional range of products. It's now time to focus on FPS Creator. Over the next few weeks we will be developing new fixes to the core FPSC product and also adding in a 'load' and 'save' game feature. For now this is all the news we plan to make public, but we do see FPS Creator as a very important development tool and will expand it further. More news of this will be revealed when we feel the time's right, but for now check out the first upgrade below.
This is an upgrade to the core FPS Creator Game Engine. It is available for download now and includes the following fixes:
Download the upgrade (4.6MB) and install it. You will need to enter your FPS Creator serial number to do this. It will then update the core game exe, so every time you 'Build Game' it will incorporate the fixes listed above. We are currently working on Upgrade 1.0.2 which will introduce load and save game features.
As revealed last issue Model Pack #3 for FPS Creator is now out. This pack follows a theme based around modern day styled warehouses. Containing over 340 segments and 183 entities, this pack is sure to add versatility to any FPS Creator game. Costing only $19.99 ($0.03 per item!) the contents include:
Segments:
There are also 183 new entities including cardboard boxes, wooden boxes and crates, heavy duty containers, doors, gates, lights, barrels, power boxes, pipes, planks, shelves and windows.
Model Pack #3 costs $19.99. Order from //www.thegamecreators.com/?m=view_product&id=2028
We've got a Model Pack double-whammy for you this issue! Model Pack #4 for FPS Creator is now out. This pack differs for the norm by offering up 21 brand new fully animated characters to drop into your games. They are ready to go including scripts, and some of them even have special features. Costing only $19.99 the contents include:
As well as the 'normal' characters above you also get ZOMBIES! These include a zombie surgeon - since most zombie outbreaks occur in hospitals due to mis-diagnosis, this poor doctor was the first to be infected. Features custom animations with a "melee" type attack. This zombie will descend upon you and swipe at you with an off-balance attack. Even his mouth moves! You also get a Zombie Nurse, a large heavy-set zombie with custom attack animations, and finally a gruesome zombie cop!
Model Pack #4 costs $19.99. Order from //www.thegamecreators.com/?m=view_product&id=2032
SkyMATTER is our range of popular skybox sets. Everything from alien landscapes, to moonlit skies to deep blue waters are available to wrap around your games and enhance the backdrops. We have now converted the entire SkyMATTER range to install seamlessly into FPS Creator. There are 5 packs on sale for $9.99 each, or you can save 30% and buy them all together (that is 76 unique skyboxes) for only $34.99. Purchase gives you access to both the FPS Creator versions of the skyboxes, and the raw formats suitable for use in DarkBASIC games. If you have purchased a SkyMATTER pack from us in the past then re-visit your TGC Order History where you will find the FPS Creator versions are available for download to you, free of charge.
On our forum we ran a small compo where the first 10 people to upload a video of FPS Creator in action to YouTube would receive a free copy of Model Pack 3 on release. Currently 28 videos now sit in our FPSC YouTube group including tutorials, game demos, tech notes and more. They are well worth checking out and can all be found here: YouTube FPS Creator Group. This video is one of my personal favourites, and shows well thought-out use of FPSC physics.
DarkFaction is a new game created by MaxRealms. It is a great example of what can be done if you combine FPS Creator with a lot of time, skill and energy. Check out the DarkFaction section on our web site where you'll find videos, screen shots and a demo download, or buy the full game online.
Wehtam announced on the FPSC Forum that the website for his new FPSC game is now open. Called Bird of Prey the game features some lovely looking level design and models, and the web site is pretty slick too. Check out screen shots in the gallery and eagerly await the download like the rest of us. Visit the site at http://www.wehtam.co.uk/bop/.
We're really excited about this years programming competition - not only because it will force you all to explore a new area of coding that you may not have touched before (namely physics), but also because we've got some excellent prizes from the sponsors: AGEIA and BFG Technologies. We're talking thousands of dollars worth of prizes here along with possible bundling deals! Here's the low-down...
We're running one competition split into two parts. The object is to create a game (or game demo) that uses Dark Physics and the PhysX processor to the max. Don't worry if you don't own a PhysX card yet as you can enter into either the 'Hardware' or 'Software' categories of this competition. Each competition will be judged separately and it is up to you which one you enter your game into.
So what qualifies? Virtually anything! There are no limits. You can write a full game, a single game level, or just a physics gaming showcase. If you prefer you could create an interactive simulation of some kind, i.e. a "puzzle game that plays with physics". We are setting no limits on the game genre this time around, you are free to go with whatever your imagination conjures up. It is important to note that you do not need to worry specifically about creating an entire game that runs from start to end. You could create just one single playable level, and as long as that level rocks our physics world it will stand just as good a chance of winning as a complete full game. Please bear this carefully in mind!
For the Hardware Competition (games created specifically to take advantage of the PhysX PPU) we have the following prizes up for grabs:
For the Software Competition (games created with Dark Physics in software mode) we have the following prizes up for grabs:
A Goodie-Pack consists of: AGEIA PhysX t-shirt, BFG t-shirt, AGEIA PhysX stress-ball and an AGEIA PhysX flashing pin. The Super Goodie Pack (awarded to the first place winners) includes the same as the goodie pack, plus and AGEIA PhysX soccer shirt and a C4 Teflon mouse-pad.
In addition to the prizes all winning games have bundle opportunities to be included with future AGEIA PhysX product offerings, and winners will all have their names and entries advertised on www.ageia.com for a minimum of sixty days after the contest ends. Other opportunities may include promotion at AGEIA or partner events.
Pretty darned cool huh?!
Not only could your game/demo net you some serious hardware for your rig, it will also get you worldwide exposure via some high traffic web sites and potential bundling deals.
Entries will be evaluated on a number of criteria, including: (1) Breadth of use of software PhysX features incorporated, including (but not limited to) rigid-bodies, joints and cloth within Dark Physics (2) Depth of use of software PhysX features incorporated, including level and scale of interaction between features (3) Gameplay physics interactions as well as effects physics (4) Playability and novel use of physics in the game design and logic (5) Creativity and 'fun' factor.
In short make your program as entertaining and as physics mad as possible.
Each competition has a different deadline, but both are quite tight so you need to get your coding skates on for this one folks. Both competitions start today (September 1st 2006). The software one ends October 15th 2006. The Hardware one ends November 15th 2006.
Basically get coding! We will publish a complete list of rules and all the small print on our web site at //www.thegamecreators.com/?m=view_product&id=2025 within the next couple of days, and in our Dark Physics forum. If you've got a Dark Physics related question, or get stuck when coding, then do ask in the forum and we'll help as best we can - we want to facilitate as many contributions as possible, and we understand that physics coding will be new to a lot of you.
If you don't own Dark Physics (or a PhysX card) then you can download a special trial version of DarkBASIC Professional 6.2 + Dark Physics from the Dark Physics web site. This version will expire at the end of November, but that is more than enough time for you to enter either competition. If you already own Dark Physics and would like to get a discounted PhysX card then check out this special promo offer now.
That's it folks - get coding, get creative and we'll see you on the forums!
We have released Dark A.I. 1.04. This is a free download to all Dark A.I. customers and incorporates the following new features and changes listed below. One of the main new features is that enemies can now be set to attack each other.
Dark A.I. customers simply login to the TGC web site, go to your Order History and re-download Dark A.I. The new filename is DarkAI_v104.zip and is 23MB in size. Un-zip and install this over your current version. This release requires DarkBASIC Professional 6.2b.
AI ENTITY ADD TARGET command added for more control over entity targets.
AI ENTITY REMOVE TARGET command added for more control over entity targets.
AI SET ENTITY CAN SELECT TARGETS command added for more control over entity targets.
AI SET ENTITY ANGLE Y to set the internal Y angle for an entity.
AI SET PLAYER ANGLE Y to set the internal Y angle for the player.
AI KILL PLAYER command did not exist, now added.
Added AI GET ENTITY ACTION$() command to return current the current action being performed
AI ENTITY RESET command is now recognised.
AI KILL PLAYER would cause a crash if the player was in a target list.
Patrolling entities now move on immediately when wait time is set to zero or less.
AI GET ENTITY CAN SEE now returns correct sight information.
Fixed a crash that could occur when view blocking obstacles were added without any static obstacles in the system.
AI CONTAINER EXIST command no longer produces an error when the container does not exist.
Improved performance when entity's destination is reset every update.
When using AI DEBUG SHOW PATHS paths would not disappear.
The Dark A.I. Competition deadline was extended due to popular demand and ended on August 31st 2006. A number of people have emailed me their games, or uploaded to our FTP server and we will start going through the games and announce the results next issue. If you would like confirmation that your game arrived then please email me ASAP. We will accept 'last minute' entries if there was a communication issue getting the file to us (email bounced, etc) but do let me know soon.
Dark A.I. is on sale now for $44.99 (€34.99, £23.99) from the Dark A.I. web page.
The AGEIA PhysX powered Dark Physics plugin for DarkBASIC Professional has been upgraded to version 1.01. The latest update introduces a number of new features, fixes and documentation modifications. Some of the key changes include:
When rigid bodies are updated scaling is now applied first to transform, this resolves problems where objects were not of the correct size on screen.
New command called phy set rigid body terrain extent, default is -1024
New command created phy set rigid body ccd iObject, iState, used to enable or disable CCD for the particular rigid body. A new demo program created to show this in operation.
You can now control the displacement direction when the character controller is moving, this is used to manually implement forces such as gravity or moving from side to side, use the command phy set character controller displacement ID, forward#, backward# to override the default behaviour, when the movement speed is less than 0.0 then the backward# value is applied to the Y axis, when the movement speed is greater than 0.0 then the forward# value is applied to the Y axis.
Vehicles has extra set-up options for wheels, providing more control over their properties including: brake torque, motor torque, steering angle, wheel radius, suspension travel, longitudinal tire force, lateral tire force and wheel flags.
Download Upgrade 1.01 from your Order History and apply it on-top of your previously installed version.
Dark Physics is on sale now priced $59.99 (€44.99, £29.99)
This is a combined time and feature limited trial of DarkBASIC Professional with Dark Physics. Please note that not all of Dark Physics is available in this trial (we have purposely removed several key areas of the physics DLL), but it comes with lots of example programs which you can run and tweak to get a good idea how the system works. The trial expires at the end of November 2006. Download from the Dark Physics Downloads page.
STYX is a new plugin for DarkBASIC Professional that is due for release very soon. It contains over 200 new commands allowing you to integrate your DarkBASIC Professional game and applications with common Microsoft technologies - .NET, ActiveX and COM. Not only this but it also provides for extra handling of Strings, Number operations, Windows (and Window shaping), Splash screens, MIDI support, XML support, Direct Memory Access, integration of Flash movies, INI file handling and Intervals (code running on interrupts).
Commands in this section allow you to load COM, ActiveX or .NET DLLs (and one of their classes). One loaded you can create new instances, call COM functions, check for the existence of COM classes, register DLLs and set/get values.
Open up standard Windows dialogs with a single call. Dialogs supported include: Color Picker, Folder Selection, Open File, Save File and Message Boxes. Full control over the properties of each dialog are included.
A selection of commands to make working with files easier. Commands such as: Add/Remove Backslash, Change File Extensions, Expand Filename (turn the relative file name into a fully qualified path name by merging in the current drive and directory), Extraction commands to obtain the Drive, Extension, File Name and Path. There are also commands for Temp file handling, including the ability to create Temp Files that live in the Windows Temp folder.
A set of commands to allow for the loading and playing of Flash movies within DarkBASIC Professional. You can load and position Flash files (up to 256 of them), resize them, rewind them, fast forward, set the frame rate, pass vars into the Flash movie, set the background colour, find out the width, height and other attributes, and finally delete them from memory. If you've ever wanted to use Flash to create a smart looking intro sequence or main menu to your game, now you can!
INI files are great for storing local settings without messing with the users Registry. These commands help you manage ini files quickly and easily. You can open them, read data from them, write to them, erase them, check for existing sections, count the values and perform validation and setting of data.
If you've ever wanted to be able to call a function on an interval basis (i.e. once every few seconds during your main game loop) then you can now do this with Styx. It allows you to create, start and stop intervals - you get to decide which functions are called, and how often, when you start the interval running.
You'd be amazed how many old-skool programmers ask us why DarkBASIC Professional doesn't have PEEK and POKE commands! Styx now provides that. You can PEEK and POKE directly into memory to your hearts content. It features correct handling of all data types including bytes, floats, longs, strings, words, double floats and double ints. You can also set the save mode of the memory, allowing for protection against crashes and over-writes.
Check for MIDI devices connected to your PC, then open a channel to them and send MIDI messages and notes..
Number and Math related commands include: Even (check if the given value is even or not), High Byte Order commands (to return high byte values) for Bytes, Words and Longs. Low Order Byte commands to return Low order values from Bytes, Words and Longs. Make Double Integer to create double int values (by combining two DWords). Also included as MAX, MIDDLE, MIN and ODD commands to return their respective values (MAX tells you which value is highest, etc).
Styx provides various string commands such as TRIM, LTRIM, RTRIM, SPLIT, REPLACE, INSTR, INSERT, DELETE, COPY and COMPARE.
This section offers various controls over how your Windows look and act. If you run your DBPro game in a Window (rather than full-screen) then you can use the CENTER command to centre the window in the middle of the users desktop. FIND DBPRO WINDOW will return a handle to the DBPro window (or any window) requested. You can retrieve window properties including: handle, height, width, moved, resized, state, x, y, client height, client width and active state. You can flash windows, send them to the back or front, force a window to be 'always on-top' (even when deactivated) and send a window to sleep.
These commands display a splash screen with an optional progress bar. You can define a background image with or without colour key (for shaping the window), set the transparency of the splash window, control the progress bar, allow the splash to be dragged (or not) and check if the user is within the drag zone.
The final section of STYX allows for XML file handling. You can create a new XML file in memory or load one, and then add/remove nodes and set node attributes and values. You can set nodes to root, parent or child status and iterate through the nodes. The resulting changes can be saved back again.
STYX is available to pre-order today. It costs only $30 and you will be sent the download on the day of release. STYX will be released in the month of September. More details available from the following page as they become available: //www.thegamecreators.com/?m=view_product&id=2079
Just a small piece to say that we have released a new version of TreeMagik G3. This version fixes the 'File' menu bug. You can download it from your TGC Order History, install it over the current version.
Unity has also been updated. It fixes the 'null string' bug and several new commands have been added including a 'reset' command which completely refreshes the environment and is extremely useful if you wish to clear your scene, for example when moving between levels in a game. Also added are two new commands, LUA COMPILE FILE and LUA COMPILE STRING, which allow you to produce compiled Lua code directly from your DBPro applications, rather than having to use an external compiler. This is especially useful for those who use Lua for storing savegame data, as you can now compile your data files form within your game to prevent peeping toms changing their game stats with editors such as Notepad. Download the new release from your Order History.
Sometimes as developers we become impervious to our own creations. We look at the technicalities and miss what is before our very eyes.
When I asked my wife to test the sample application for this tutorial one evening, she refused to continue within a minute or two. "Too scary, I'll have nightmares!" came the reply. "Success!" was my retort. This tutorial has no media whatsoever; it consists entirely of DarkBASIC Professional primitive objects, some simple texture generation and the power of Dark Lights to add the moody atmosphere.
This month, to illustrate the simplicity of Dark Lights, a maze will be built from primitive shapes. The resulting maze can be traversed in First Person view, by guiding the camera around with the arrow keys. There is as much, if not more information about creating the maze, as there is about lighting it. We will learn some simple yet useful techniques for creating a grid-based world in the first section. Dark Lights is so powerful that the addition of a small number of commands to this environment is all that is required to get the desired results. So let's get started.
The first step is to build a maze generating utility, or what is more commonly known as a map editor. For our purposes, this is a very simple grid-based system that allows us to:
You can investigate the source code of this editor, which is included in the download.
The starting point for our maze is to build the primitive objects as dictated by the map file. An array will hold the information about each square in our maze grid. Each array element will contain our essential data with the use of a type:
Once we have the array of information, we can convert it to a visible world. The maze file also holds the X and Z dimensions of the grid, and a very simple nested loop will enable the maze to be built easily:
For Z = 0 to (gridSizeZ - 1) For X = 0 to (GridSizeX - 1) square = (Z * GridSizeX) + X ` Create Maze Objects Next X Next Z
This structure is the key to converting a grid to array elements and vice-versa. An array is essentially a long string of data, whereas a grid is 2-dimensional. This formula, as illustrated in the small code snippet above, is a highly efficient and simple way to convert from a grid reference to the associated array element. In this example, square is our array element.
For each square, we will build a cube if the coordinate is blocked, a random primitive if it is debris, or nothing for traversable squares. Debris squares are simply blocked coordinates, but allow us to generate an environment with more interest when light mapped. The final step in populating the maze is to add a floor, using a plain. A texture has also been generated by using coloured boxes drawn on a bitmap and then grabbed to an image. The image is scaled down to repeat many times over.
Movement is extremely simple. Every time we press the forward key, we move to the next square, and the down key moves backward. Left and Right keys rotate 90 degrees in the appropriate direction. We check if the next move is valid by moving a hidden sphere first and checking if a collision has occurred. If it does, we do not move the camera. If collision ever seemed like a daunting prospect, take a look at the simple function that does this for us:
function checkCollision(direction) position object cCOLLIDER, camera position x(), _ camera position y(), camera position z() yrotate object cCOLLIDER, camera angle y() move object cCOLLIDER, 10 * direction ret = 0 if object collision(cCOLLIDER,0) > 0 then ret = 1 endfunction ret
The final line in this function simply returns a positive result if the collision between the hidden sphere and anything occurs.
We already have everything in place to load, build and walk around our maze. Download, compile and run example 1 to see the code in action. Less than 200 lines of code generates a fully-functional maze, which will work with any design you create with the simple editor. Now that is incredible in itself, and we haven't explored lightmapping yet!
Let's progress from our dull, lifeless environment to something a little more inspiring. The framework of this process is to initiate the lightmapping functionality, add lights and obstacles, generate the texture and finally clear the data from memory. Here are the main commands we will use to build the lighting for the scene:
The maze data has been used to define the positions of lights in the scene. Every primitive object making the maze has been added as a collision object, and also as a light map object to receive shadows and light. The floor is also added in the same fashion. Compile and run example 2, to see the results of the lightmapping process. In this tutorial we will be generating the lighting on the fly each time, which is also appropriate because the maze map can be updated at any time. Dark Lights can also be used to create dbo models which can be loaded like any other model, with the previously generated lighting included. This is obviously a much faster way to include lighting in a game. The examples use the threaded technique of generating the map, allowing the progress to be displayed onscreen.
The resulting scene is rather like an underexposed film. The darkness is just a little too dark, and we would need a great deal more lights to bring it up to an acceptable level. It's not always appropriate to add extra lights to compensate, especially when trying to replicate real lighting scenarios. One solution is to add an ambient light source, which works in a similar way to the ambient settings in DarkBASIC Professional; the greater the ambience, the brighter the scene. Ambience affects all objects:
LM Set Ambient Light 0.1, 0.1, 0.2
Compile and run example 3, to examine the results. The scene is now lit more brightly. However, it is still a little "flat", with unlit areas looking just like a standard scene with no lightmapping. We can fix this with another global lighting technique, which introduces direction:
LM Add Directional Light -45, -45, 10, 0.1, 0.1, 0.2
The first 3 parameters specify an X, Y and Z direction to the light, with the final 3 parameters defining the intensity of the colour channels. When you compile and run example 4, you will see a noticeable difference in the realism of the lighting. Walls cast shadows on one side of corridors, whilst the opposite sides are lit. It also adds a sense of direction, the shadows helping the players to orient themselves easily.
In this tutorial we have taken a media less, flat world and transformed it into a still media less world but with so much more depth and immersion. The effort involved is minimal, and we have also proved that it is possible to even light unknown scenes, allowing massive potential for random and user-defined arenas. There is one final example included, which delves further into Dark Lights. This example is much more intensive, but includes:
Feel free to modify and experiment with the supplied code. The examples can be changed in many different ways, to create different effects and moods, from softly lit realism to hard-edged retro like visuals.
Until next time, Happy Coding!
Download this tutorial and code.
Here is a selection of current hot topics worth checking out ...
This is a nice looking maze game. Work your way through the maze, but use the power-ups such as speed boost and jump to get around the tricky bits.
tschwarz has converted geecee3's excellent sky boxes for use in FPS Creator. Download the two packs and use them in your own freeware games.
What does it do? It catches most (not all!) of the runtime errors that can occur in DarkBasic Pro applications and allows you to insert code to recover safely from them.
Scraggle has released another superb Bitmap Font Pack. They are 64x64 fonts and he includes code to cut them out (preserving transparency) and to display. Loads of fonts on offer here, all look great!
TGC sponsored the Text Adventure Compo, organised by Matt Rock, and the results are in. The winner was Melody Machine, with Snappy and Ninestar coming close. Downloads and details in this thread.
Wilderbeast has released his Perfect Environment code to the forum. This is DB Classic code that allows users to simulate a range of weather effects including wind, sound, rain, clouds, cloud tracking, sun, moon and lovely cloud generation.
Two donkeys can carry more than one donkey. A plane with two jet engines can fly faster than a plane with just one jet engine. Unless you read this article, and follow this advice, you are going to fall into the trap of making one donkey games.
Should you decide to purchase Dark Physics, you are going to run some of the 100+ examples contained in an effort to bypass the instruction manual, and learn it from the inside out. You will deduce that everything boils down to adding PHY START at the top, PHY UPDATE next to SYNC, and adding all your physics objects in between.
I want to help you make your physics simulations faster by introducing you to the concept of asynchronous execution. Crudely, this basically means running several things side by side instead of one after the other. By default, Dark Physics runs things one after the other (synchronously) to keep your game simulation stable. By taking a little more control of Dark Physics you can squeeze extra frame rates out of your game. If you have a Physics Processing Unit in your machine, you can probably double it.
Instead of the basic physics loop "PHY START : DO : PHY UPDATE : SYNC : LOOP", you break up the work so that the physics can be calculated while the game loop is running by using: "PHY START : PHY UPDATE 0 : DO : PHY UPDATE 1 : PHY UPDATE 0 : SYNC : LOOP : PHY UPDATE 1". The zero means 'simulate' and the 1 means 'fetch results'.
As you can see, we start the loop and start the 'simulation' at the same time, so they run side by side. When we get to the SYNC, where we need to draw the results, we 'fetch' the physics results so we can draw them, and start a new 'simulation' as the game loop repeats. Providing you only make physics creation calls between the 'fetch' and 'simulate' period, your games will not only remain stable, by take full advantage of any multiprocessor or PPU chip available.
Version 5 of T.ED is out now. T.Ed is a dedicated terrain tool to allow the creation of small to large mesh landscapes, either as a series of blocks, or as a single terrain. It allows for superb blended textures either by using vertex alpha or by rendering a 'Supertexture' for each terrain block. This release includes a large number of new features over the previous version 4 range including extremely useful functions such as DDS Texture support, Birds-eye cam view, faster large map handling and more. The full list of new additions follows, there are also various bug fixes which you can read about on the T.ED web site:
T.ED is on-sale now for $27.99 from //www.thegamecreators.com/?m=view_product&id=2102
Alistair Stewart is nearly finished on Volume 2 of his DarkBASIC Professional series of programming books. Volume 1 covered all of the 2D (and control) aspects in its mammoth 740 large-format pages, and now Volume 2 is in the final stages.
The official release date is September 20th. It has over 710 large pages (page size 27cm by 20cm - 10.5 inches by 8 inches). Chapters cover 3D concepts, Basic 3D shapes, Texturing, Cameras, Lights, Meshes and Limbs, Importing 3D models, Collision Handling, Particles, BSP models, Terrain, Landscape Matrices, Handling Vertices, Pointers and Memblocks, ODE, Vectors and Matrices, Shaders and FX files Network Programming, FTP, and DLL Handling (including adding new commands to DarkBASIC Pro) - and a few games including Solitaire and Elevators (3rd person snakes and ladders). As usual, the book is full of Activities and their solutions.
When released it will sell for the same price as Volume 1 (£36.50). We've got an exclusive 3 page sampler PDF for you which you can download here. This will give you a good idea of the level of detail and structure of the book. We hope to have Volume 2 on sale by the end of the month, keep an eye on the DarkBASIC Professional web site for details.
One of the grooviest features of DBP is its use of bones to deform geometry. It sounds quite a complex thing to do, but is in fact really simple once you get used to them and know how to get working bone based models into DBP (it is possible to build a boned object from scratch in DBP, but that's not what I want to show you) I'll be using a simple boned rod shape made in a 3d application, virtually all 3D apps support bones and direct X export, what app you choose to use for your own creations I'll leave up to you. Personally I use truespace for preparing anything that will be going near DBP, all objects exported match the DBP scale which saves me time and headaches. Remember, we're trying to keep this as simple as possible, so I wont be animating anything complex, I'll simply be showing you one of the easier things you can do with bones, but it is rather cool.
Bones are hidden 3d components present in a model which allows the polygon mesh to deform in a controlled and realistic manner, boned objects can be though of as a skin wrapped around a control skeleton. Bones usually work in a linked fashion the same as the bones in your body, or like the branches of a tree. If you move or rotate the trunk or main branch of the tree, all the branches connected to the trunk will move or rotate with it. If you go further up the tree and move a single branch by bending it, all the sub branches of that branch will move also. this is how bones work in DBP too, great. (the only thing to remember with DBP bones is that they are technically object limbs.) This is what the objects and bones look like inside truespace, the bones are on the right and look similar in most 3d applications.
Okay, we have an object, it's a quite long and fairly high poly solid rod, it needs the poly count so it can bend and twist in a convincing way. Inside this object there are 65 bones that you can't see, these are connected one after the other in a queue, and these are the limbs we want to rotate to deform the object mesh. The axis point is at the centre of this object and the first hidden bone is on the far left of the object in the example (yellow object). The mesh objects however are not being moved or rotated in any way, only the bones are. this routine is simply turning each limb to a new direction based on it's limb ID number and a small bit of math.
Not bad for such simple code, I used the same code for the second example but split the for - next loop with some math and done a dual bend which is a bit more interesting looking. This is a great way to get cool animation and motion into the things you make with DBP. Using a simple mesh that has been populated with bones such as this, you could animate things like ferns unfurling with minimal code, or make springy and twisty things in your games. With some clever thinking you could make a snake style game with an object like this where the snake is a single object and is controlled by repositioning the snake object and setting the relevant bone or limb rotations to make the desired shape. By using object instancing you can animate lots of springs or twisty things by manipulating only the master object bones and the instances will follow. This really is powerful yet blissfully simple stuff.
Could you imagine a platform game in 3d with bendy platforms that can change shape?, or arcade game maps that can reconfigure themselves by changing a few limb rotations and then setting the relevant map data? Using this technique you can. the only real concern you have is in making sure your object scale fits your game world properly and your collisions might require a bit of deep thought, but hey, you know the positions of all the bones that deform the mesh, (by reading limb position data) so there's a start for a simple collision system on bendy paths or platforms. Another really cool thing you can do with this is make animated and evolving signatures and sketches, but all in glorious 3D. By spending some time making cool formations manually in a 3d editor or through DBP code, you can capture the limb rotation values to arrays and make a library of morph targets for your bendy meshes. Further clever programming should allow you to blend between these too, and provide have the basis for a dynamic bone based animation system. the possibilities for bending a line or rod are enormous, basically opening up a whole new style of homebrew 3D games and demos, and it's not difficult to do.
Shaders can also be applied to the objects, by using a pixel shader you could give the objects some extra detail by adding a normal map, or with a fur shader (a simple vertex shader) you could make a tail for an animal that has a volumetric and furry look. From a single concept a whole new world opens up for your DBP creations. Bendy things look complex and provide some serious eye candy for not a lot of work, but these features are underused by the community as a whole because they seem like complex things. We are ignoring a killer feature here that even newbies can get to grips with easily.
There is a small demo in the download. It's not remotely complex as you'll see if you look at the source (based on the example code), but the overall effect is quite pleasing and looks much more complex than it actually is. Try messing with the values in some of the variables and see what crazy things you can get the code to do, throw some new textures and sphere mapping images at it to change the whole feel of the thing, use fog to depth queue the 3d objects and get a better feeling of depth. You probably have a few ideas of your own now and will want to get stuck in for yourself, so have fun and make something that really moves!
Demo Video: You can view the end result of this tutorial on this YouTube page, but make sure you download it and run it for yourself to see it in its full glory. At the last moment Grant prepared an extra download for you which contains lots of new boned objects to test with his code - grab it here (707KB)
Till next month, Cya.
Download the tutorial and code (3.2MB)
While we've been working flat out this month, our development efforts have been split across various tasks. From our web site duties (Building a forum & New Site), to publishing stand alone editions of various PlayBasic related tools like Play Mapper & Play Shape, through to interleaving VM2 work around the production of new PlayBasic demo. So lets get to it !
While it doesn't feel like it, it's been two months since the demo was updated. So were in the process of rebuilding it. The latest changes mostly relate to efficiency, a few bug fixes and expanding existing features further. Which range from adding Z clipping to the Translate Mesh commands (allowing custom 2.5D & 3D scenes) (Used in the 3D Terrain and Mode 7 Racing demos below), copying complex types (supports arrays within arrays), more helper functions as always, but the biggest change has been to the runtime performance.
Last month we were testing a method of optimising math expressions during compilation (See Last Months issue.) At that time there were reliability issues, which has now been overcome. Resulting in a substantial performance increase to not only the retail editions, but to the NEW PBV1.48 DEMO also. The updated demo should be available on TGC later this week, with a bonus 60 day trial for you tinker with!
While I haven't had much time this month to work on PlayBasic's next generation runtime, referred to as VM2. The time away has allowed us to fine tune some design aspects even better. Previously we'd been working on rebuilding the memory manager. It's the foundation that the entire engine sits on top of. While it's not glamorous, it's critical that this base layer be as a efficient and flexibility as possible. Since everything sits on top it, from data types like strings / user defined types through to images, sprites etc etc. So that was our first priority.
Once the base memory manager was built, our attention turned to implementing better string support. Strings seem to be forgotten data type these days, that is, until your program needs to thrash through bucket loads of then. Where a bad string engine can make your [b]3 gig CPU look like a Vic 20[/b]. To counter this, has meant building special types of strings that could be used in specific situations. Those being "Default PB String", "Fixed Length PB Strings" and "Null terminated". We have a few others in mind, but they can always be dropped in it later.
So how fast is it? It's quick, surprisingly quick in fact. Bettering not only the performance of current PlayBasic string engine (by some *10 time), but our main competitors also (DBPro & BlitzPlus) and is generally 5 times faster on average than the competition. Check out a comparison. The next phase of development is to rebuild support for other base data types like arrays and types. Which are much simpler than strings, so it shouldn't take as much time. Hopefully we'll be able to squeeze some more performance out of those also.
Here's some tidbits and demo's that have been produced this month:
PlayBasic is available to buy for $34.95 (€26.99, £18.99) from //www.thegamecreators.com
Back before he worked on PlayBasic Kevin Picone of Underware Design released masses of DarkBASIC source code. His archive was offline for years but has now been re-opened and contains a complete treasure trove of code for you to download. The majority of it is for DarkBASIC Classic, some for DarkBASIC Professional, and most can be converted one way or the other.
The code is split into categories: 2D, Scrolling / Tile Maps, 3D Effects in 2D, Dot Effects, Shape Effects, 3D Misc, Collision and Intersection, Optimising, Misc Hacks, Sorting / Searching, File System Examples, File Format Loaders/Savers, Input Replacements, 2D / 3D Maths / Vectors / Data & Binary Logic and Parsers and String Functions.
There are 82 different bits of code on offer - grab the ones that take your fancy from: http://underwaredesign.com/prod_detail.php?id=20
Super Karting is a karting game written in DarkBASIC Professional and using Newton to handle the driving physics. Although there aren't any other opponents to race against yet, you still get a good feeling of karting action as you bomb around the circuit on offer - and if you manage a good time, you can send your high score up to the web site. Realistic handling and smooth visuals help make this an enjoyable, if unfinished little game - and one we hope to keep a close eye on as it progresses in development. For now you can download a demo version from the web site, or watch the YouTube video we made of it.
Super Karting can be downloaded from http://www.superkarting.com
DarkGDK 1.6.2c is now available for download to all existing customers. This fixes the last few remaining issues with compiling under the free version of Visual Studio Express. Customers can download it from their Order History by simply logging into their TGC account.
Soon to be added to the TGC product line: DarkGDK.NET
With DarkGDK.NET, you will be able to develop top quality games and multimedia applications using the new Microsoft .NET development tools. The DarkGDK.NET toolkit provides an easy, hassle free method of using the toolkit within your .NET programs. Applications can be developed using both the commercial and free versions of the Microsoft .NET development tools. You can even use DarkGDK.NET with SharpDevelop, the open source answer to .NET rapid application development.
Contained within, are instructions for setting up a simple project using one of the supported development environments. Developing with .NET and the DarkGDK.NET toolkit, will be rewarding and fun for both beginners, and professionals.
More information in our newsletter as DarkGDK .NET finishes beta testing and hits release status. It will be priced the same as the DarkGDK.
www.shmup-dev.com is proud to announce that our third competition, dubbed "AUTOFIRE 2007 SHOOTER COMPETITION" has been launched on Sep 1st, 2007. The competition focuses on shooters, mainly 2D Shooters and off of the Shoot-em-Up Genre.. There are dozens of prizes which are Games, Game development tools, and a whopping $250.00 CASH PRIZE (sent in money order USD)
This competition is focusing on any aspect of the shooter genre with the exception it must be from a 2D Perspective. Of course, 3D Graphics are welcome! The game must feature an autofire weapon of some sort for the main character. It can either be the primary and only weapon, a power up, or a weapon upgrade, or anything else you can muster up! The Competition setting is whatever any entrant desires, including the game style, and how the game plays!
Judges will be rating the games on most original, best graphics, best sound, and of course, best of the best! The contest is running from Sep 1st, to Jan 1st, and a more detailed list of rules along with a comprehensive FAQ are all available at www.shmup-dev.com after clicking on the "competitions" tab.
Each month we pluck a random 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. The winner this month is: ???@themsteam.com. Also, will people please stop emailing us asking if they can be 'selected' to win DBPro in the next issue. No, you cannot. It's a random lucky draw people. Random.
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 45 deadline - September 28th.