Many people get into game-coding with a great concept in their heads, and are ready to launch themselves into realising their big idea. The reality is nearly always a rude awakening, a shock to the system, and a dose of disappointment at the first results. It doesn't need to be like that.
This year The Game Creators have launched themsleves at a great pace into the world of iPhone applications. Some of the game concepts are so simple that they leave a trail of developers thinking; why didn't we do that? They do have the advantage of being well designed, produced and containing just enough addictve elements to make them a success. You can read later just how successful they have been.
This story is not unique to The Game Creators. Many games rise from nothing to be great successes. There are other games such as Lemmings, Worms, Sim City and Civilisation that grip the imaginations and take off. So don't be disheartened by the effort required to make the next killer game. Think simple and let the code evolve, you may soon be publishing the next big idea.
Until next time,
(1) DarkBASIC Pro (2) Dark Data (3) iPhone Apps (4) FPSC News (5) Model Packs (6) TGC Store (7) Community Pack (8) 3D Compo (9) Tip Of The Month (10) Summer Contest (11) DBP Tutorial (12) Videos (14) PlayBasic (15) Winner (16) Outro (17) From the Forums
Behind the scenes, an internal version of U75 has undergone a few tweaks and is scheduled for beta any day now. The U75 beta will continue the small run of tweaks started in U74, and will also focus more on the editor. Although fully functional and less likely to eat your source code, the new editor still has a few minor glitches such as not associating itself with DBA and DBPRO files, and a number of reports from the U74 beta thread. Hopefully U75 will deliver resolutions to these final niggles and those still using the legacy editor can finally upgrade their IDE experience. DarkGDK also received an update too, based on the U74 version. Many of the benefits of the update are internal such as faster rendering performance and bug fixes. For more information, check out the DarkGDK section of our website.
Special offer while stocks last: Dark Game Studio, Dark Physics, Dark Lights, Dark AI and Extends for an incredibly low price of $49.99. Save over $170!
Creating your own PC games is now easier than ever with this special compilation of game making tools:
DarkBASIC Professional
DarkBASIC Professional is the most advanced games development package built on the BASIC language currently available. No other package out there makes it as easy to incorporate all of the special features and effects you see in todays games and no other package natively offers the benefits of Microsofts DirectX 9 technology.
DarkBASIC Classic
DarkBASIC allows you to create your own games, demos, slideshows, even business applications using the easy to understand BASIC programming language. Even if you've never coded before, just follow the in-depth tutorials and you'll be generating results in minutes! Harness the power of Direct X and make 3D objects come to life in just a few simple commands.
DarkGDK
Dark GDK offers you the power of DarkBASIC Professional, with complete integration into Visual C++ 2008 Express's development environment.
Dark Edit
Easy to use source code editor to make coding easy.
DarkMATTER
Hundreds of Royalty FREE 3D Models and Textures including fully animated game characters to populate your Creations.
DarkVOICES
DarkVOICES allows you to create lip sync mouth movement for your game characters easily, quickly and cost effectively. It is based on the technology of loading in any WAV file that contains speech, and converting it to a series of annotations which describe how the mouth should move.
Visually create, tweak and export dynamic shader effects directly to your DarkBASIC Professional games. DarkShader allows you to select a shader from a collection that are provided with the application, or one of your own, and to modify any variables it contains without having to open the shader's source code.
The shader variables can be modified using sliders, color pickers, or text entry depending on the variable's type. Changes can then be exported along with any model and textures you have selected to be used in DarkBASIC Professional.
Game Creator Store
Log in to the Game Creator Store and search through the thousands of game ready media assets. In seconds you'll have downloaded the media you need and be able to complete your masterpiece. There is a wealth of free assets to get you started.
FPS Creator FREE
Create your game instantly with the intuitive 3D editor. Drag and drop walls, lights, doors, enemies, ammo, weapons and more - with pixel perfect precision, and watch as they intelligently link together. Then with one click of the mouse, play your game! The free version can be upgraded if you want to create and share standalone games.
Low-poly and high quality 3D tree creation has never been easier. TreemagikG3 introduces new breakthroughs in tree creation. With TreemagikG3 you'll be able to create some of the most beautiful 3D trees for your games, and all within seconds.
Plant Life
Designed for low polygon environments, such as fast 3D games, Plant Life delivers a unique approach to creating photo-realistic foliage for use in real-time 3D environments. Without sacrificing quality, Plant Life creates vivid, colourful and realistic media at the lowest poly-count possible, all from a friendly and easy-to-use interface.
Cartography Shop
Cartography Shop is a modeling program for creating architecture and calculating lighting. The program is ideal for game environments, 3D presentations and other commercial applications.
Dark Physics
Add features into your game such as realistic cloth that tears and rips when shot - particle systems for smoke and fog, where each particle can collide with any other object in your scene - fully driveable vehicles, with proper physics handling - hardware accelerated liquids - and much more.
Dark Lights
Dark Lights adds a suite of new light mapping commands and features to DarkBASIC Professional, and also includes a versatile lightmapping tool with full source code. Three light types, attenuation, transparency, curved surfaces and self-shadowing are just a few of the features.
Dark AI
Dark AI is a set of commands that help with pathfinding, and adding intelligent behaviour into your games, making opponents and allies smarter. Implement teams, entities, obstruction avoidance and zones in both 2D and 3D environments.
Extends
This pack includes a host of new commands, covering GUIs, bitmap fonts, 2D effects, sprite collision, billboards, virtual lights, particles and real-time skies.
Demo Games
Various games to demonstrate the power of the languages.
Physics Demos
Many examples to get you started with Dark Physics.
Save over $170 on this special deal. Be sure to check out the screen shots and the online videos. You can of course order safely and securely online, for delivery via postal mail.
Todd Riggins has made his Xbox 360 controller plugin available for free download. You can replace the term controller with just about any device, such as a game guitar. The plugin is now available for both DarkBASIC Professional and DarkGDK, albeit still in beta phase. The functionality is complete, it simply needs the community to prove that it is robust enough for full release.
The plugin includes a comprehensive set of commands. Alongside the functionality you expect - movement and button control - the full suite of peripheral commands are also available; check for the availability of a headset, battery level, controller type and connectivity to name but a few.
Voice support is part of the plugin, with the ability to convert the sound to native memblock data. From there, you are free to treat the data like any other DBPro sound.
You can use the forum thread to feedback any issues you have with the plugin, and to get the latest updates and news from the author.
Dark Data is a library that gives you the ability to create a database with keyed filing systems, and resuable direct access records. With Dark Data you can create invoicing systems, planetary systems for your space games, character data storage in RPG games or anything your imagination conjures up that requires fast record seeking and database storage.
Commands are split between KFS for the Keyed Filing System and DFS for the Dynamic File System. KFS is the index or lookup file. DFS is your actual database. You can have a customer database called Customer.DAT and three indexes for easy search and sorts like CustName.KFS, CustID.KFS, CustPostal.KFS for example. Mix and match. If you only need to report by the customer name, you only need to open the customer name index and the customer file. The overhead of having multiple files open is unnecessary.
Adventure, Role Play and Strategy games all have one thing in common; an abundance of in-game items and objects that the player must interact with at some level. Traditionally these items are supported in your game code through the creation of your own file system, parsers and internal data structures, and often this code needs to change as your item and object data grows and changes structure. Additionally, when it comes time to populate your game with the remaining hundreds of item instances you will find yourself writing an editor to organize and store your item data. With Dark Data you can remove a whole chunk of coding by replacing your own file handler with one that has been tested for efficiency, speed, stability and flexibility. Whether you game has ten objects or a thousand complex items, your code remains small and flexible while the grunt work is handled by Dark Data.
As Dark Data is designed to be a fast lightweight module, you can even employ it as a real-time component of your game. With no external database dependencies to worry about, a few lines of code and your game is linked with a potentially massive archive of information without eating up megabytes of dynamic memory. Imagine a trading game or inventory component which needs to keep track of item descriptions, prices, quantities, strengths, abilities, experience points and game specific data for which you need instant access. Furthermore, because it is a database architecture, you can access the same data from other tools such as an item or level editor without having to copy and paste your entire parser to the other applications.
Dark Data is available now from The Game Creators. Check out the product pages for full information, code examples and to purchase.
We'd all be happy knowing that almost 3,000 gamers were playing our latest creation. Here at TGC we're pleased too, that's the number of downloads we have had for Mission Control Lite, one of a number of games we've created this year for the iPhone. But that's not even the tip of the iceberg.
These are recent figures for The Game Creators library of iPhone games. The total downloads for the full suite has now topped four million downloads! And with enhanced versions, additional levels and new offerings in the pipeline, we look forward to continuing this trend.
For those glued to their forum accounts you will no doubt be aware of the V116 BETA that started up early August and is charging through the beta versions nicely. The significance of V116 cannot be underestimated and perhaps we should explain this statement. Prior to V116 all versions of FPS Creator where built with an internal version of DBP which originates from early 2008 and has been modified in parallel with the current latest version of DBP. Although good for retaining predictability and stability, it is terrible for bringing DBP bug fixes across and for source code management. More recently, it has also been bad for sharing the source code with the public.
We could not ask everyone who wanted to recompile the FPSC engine to grab a copy of our internal (outdated) DBP as this would just be confusing and messy. As part of our 'gradual migration effort' one of the first steps was to bring the FPS Creator source code onto the very latest version of DBP and in doing so solves all the problems previously stated. We now compile FPSC on the same version of DBP that you have, which means access to the source code for public use is much easier for us to provide and it means you get a few bonus benefits too, such as a performance increase.
Currently the beta is behaving itself and running anything we throw at it, but due to the significant shift under the bonnet we are keeping it in the public beta stage to make sure we have not missed anything. Also, thanks again to some source code streamlining, the map editor component of the FPS Creator software is also built using the extact same code. Once V116 is officially released, we will bundle the exact same source code and release it as a new DBP extras release. Hopefully we can continue to release the production source code in step with the official FPSC updates, ideal if you are a modder wanting the latest fixes and features as part of your own collection of features. To keep involved, check out the V116 BETA thread in the FPS Creator forum and help us forge a stronger, more stable version.
We are almost ready to start the next beta which will test the store component and the new editor. This will bring in almost 3000 new items for you to create your games with, but be warned that a beta is not for the faint hearted. It is likely the early versions of the editor will hide features you normally took for granted and the worst case scenario is that it may eat your hard work and levels. If you are still undeterred, then keep an eye out in the X10 forum for the announcement of the V110 BETA.
This update is only intended to release the store component and new editor, and does not introduce new features. I think we will find that fixing issues relating to incompatible store assets will keep us all busy through the beta process. The good news is that we have already done a lot of work making sure the older model packs work in X10, so hopefully the transition will be swift and we can tap into a lot of new content without too much ado.
Take advantage of this whopping special offer! Get FPS Creator, FPS Creator Tutorial Course and 8 Model Packs for an incredibly low price of $29.99 USD (€22.00 EUR, £19.99 GBP). This deal includes:
Click here to purchase the Bonanza pack, including FPS Creator
for just $29.99 / €22.00 / £19.99
If you wish to go further into FPS Creator scripting, there is no better place to start than the excellent third party tool FPI EditPad developed by Terry Cox. If you're currently in and out of Notepad, then you will find this tool will help increase your scripting productivity. Not only does the tool highlight FPI syntax, but it will alert you when you type a condition or action incorrectly, meaning your scripts will be grammatically correct first time around. Check out the built-in help system for a complete run-down of features in this excellent addition to the 'modders' tool kit.
The download is available here, and any future updates will be found on the FPS Creator download page
After multiple requests by users, we, the developers of FPSC IP and GameStarter, have
made our programs compatible so that users can now create great multiplayer games with
chat and lobby features, while still using the advantages that GameStarter brings. Your multiplayer game can now have launcher and configuration features too.
The two publishers are offering up to 20% discount when purchasing products from FPSC IP and GameStarter. Head over to their respective websites for full details on the offer.
The Office Pack comprises of 75 entities including laptops, lamps, chairs, tables, and pictures, add to this four high rise buildings plus 21 full segment rooms to complete this comprehensive package. With this collection the possibilities are endless for creating interior based games, whether they are serious business simulations, or FPS games based in a business/office environment.
Imagine taking your covert operations troops through a complex office block, the enemy hiding out in any one of a warren of rooms. Use desks, water coolers and chairs for cover, and breathe life into every room with rotating ceiling fans. Break from the traditional dimly lit cavernous feel of many FPS games, and fight your way through bright, modern office spaces.
Model Pack 32 is available to purchase now from the FPS Creator website.
The sports pack can compliment any game style, containing a large variety of sports items including gym equipment, tennis, boxing and soccer.
The pack contains 70 detailed entities and 12 room segments. Create an entire Gym, from the locker rooms to the training room, the leisure facilities of snooker and table tennis to the boxing ring. Take your game outdoors with a lush sports field, with goal and rugby posts. How about chilling out with surfing and skateboarding elements? Add a more upmarket feel with Golf and Badminton.
Model Pack 33 is available to purchase now from the FPS Creator website.
Did you know you can sell your models, segments, music and sky boxes in the Game Creator Store? We already have dozens of artists selling their media, and we welcome anyone with the talent to provide our community with quality assets to do the same. If you are interested in becoming a store seller, please contact Janet, our Store Administrator directly.
Set your game against the deep red sands and dusky sunset glow of an alien sky. Ideal for recreating an off-world or barren Moonscape scene with enough detail to convince the player they can see far into the distant horizon. This skybox is part of the Skymatter Three collection and works well with entities and segments from the Sci-fi category.
An old wooden barn with an open door. Players can enter the structure and use it for cover, or use it to store additional ammo, weapons and health.
This model includes a 512x512 diffuse texture.
The character from the Viking era is armed with a dagger. He is one of many from Model Pack 25. Many of the models can be downloaded as individual entities from the store, or purchased as a full collection of related and themed items as a Model Pack.
The Viking collection also contains a number of themed buildings, also available individually from the Store.
A small saloon to drink your fill, play some cards or billiards. Many a fight has broken out in these joints.
This is one of a collection of three Western buildings, including a Hotel and Doctors to complement.
All of the above models are available to purchase and download through the inbuilt Game Creator Store in FPS Creator, and also using the standalone store for other game-making tools.
Cosmic Prophet, Valued Member of the forum, has released part 3 of his Mega Sci-Fi Pack. Included in this free offering are various skyboxes, weapons, characters, scripts and more. The banner for this article is in fact created from one of the skyboxes included in the pack.
Many of the entities have been contributed by other willing members of our community, and are acknowledged in despatches. The skyboxes, such as the one displayed here, are created by Fallen One. Weapons include the work of DJMaster. Jewish Dude has contributed the incredible alien character, while Explosys has added his scripting skills to the mix. Finally, the character animations are finely tuned thanks to the contributions of Bond1.
Thanks go to all the people who made the pack possible. You can download it here, and you can join the forum thread to post feedback and display screenshots of how you have put the pack to good use.
Do you see what I see? This competition revolves around your computer. It's simple, you can model anything that is within sight of your computer. Pretend your computer has 360 degree view but cannot see through walls. Pick an object, any object within sight and make a model.
This Competition will run up to and include September 25.
Some of the rules need clarification, to ensure the judges receive everything required and no one misses out on a technicality:
1) To win Best Model we need to view your model, so be sure to upload it.
2) To win Best Texture we need to see the texture. Make a render and/or upload the texture so we can see it. (preferably with the model)
3) It would help if you made more than one render of your final entry. (viewed from different angles)
4) Keep any renders to a maximum size of 640x480. (.jpg format please)
The competition details, work in progress and final entries have now been consolidated into one thread. Once you are satisfied with your entry post a picture and label the post "This is my Final Entry." You can follow the competition and post your entries here.
The accolades for the winners are retained until the next competition winners, and are as follows:
3DMaster - Champion awarded to the overall winner in the competition, an entry which displays both modeling and texturing excellence.
3DMaster - Best Model awarded to the runner up who demonstrates the finest modeling skills in the competition.
3DMaster - Best Texture awarded to the runner up who demonstrates texturing wizardry in the competition.
The awards will cling to your Avatar until the results of the following competition are announced. So to keep your award, you must defend your honour in battle once again!
Prior to U75 you could not easily create a realtime cube map for use by a shader. This left you to either create your cube map offline and use it as a static reflection source or stick with the fixed function pipeline version of the real-time cube map. A third splinter group managed to get dynamic cube maps into a shader but it was something of a dark art mastered only by those in the know. Thanks to a recent U75 update in the beta, you can now have the best of both worlds and I have provided a full example with media to demonstrate it in action.
Fear not, I will not just drop the final code in your lap and wave farewell. I will step through the code to show you what each part does, and hopefully add to your arsenal of shader tricks, ready to augment your next blockbuster.
A special thanks must go out to Green Gandalf for his specialised and superior grasp of shaders, and for the loan of his FX shader which made this example possible, and also a grateful nod to the 'Star Wraith Guy' who was determined to see dynamic cube mapping shading a reality in DBP.
The program itself is pretty simple, and so some lines will be skipped to prevent this tip turning into an essay. If you want to learn more about the skipped sections, previous newsletters covered the basics in more detail and you can always find a helping hand on the forums. I will skip straight to this piece of code:
rem Using spheres are good cube map testers as they reflect everything evenly!
spheretest=0
rem Load an object to apply the effect to
if spheretest=1
make object sphere 1,150
scale object texture 1,2,2
move camera -50
else
load object "statue.X",1
scale object texture 1,2,2
scale object 1,200,200,200
position object 1,0,-250,0
rotate object 1,270,135,0
endif
A useful trick when working with cube maps is to have the objects that will enjoy the effect have a test mode where they turn into spheres. The reason is that spheres reflect a cube map perfectly, and from it you can clearly see whether your cube map is oriented correctly (the right way up) and is reflecting the correct exterior geometry. As a test, change spheretest=1 and re-run the example to see what I mean.
The next line will load a normal map texture into image two, which is used by the effect to describe how bumpy the surface of the object will be. We will later be combining this with the cube map information.
rem Load normal for shader effect
load image "cobblenormals.dds",2
And then we load the shader effect into effect index three and specify that we do not want the shader to use it's own textures as we will be providing them later.
rem Load shader which will combine the normal with the dynamic cube map
load effect "shader.fx",3,0
The next part is really the main part of the whole technique and creates six new cameras for the dynamic real-time cube mapping effect.
rem Create cameras that will generate our dynamic cube map
for c = 0 to 5
make camera 1+c
backdrop off 1+c
set camera fov 1+c,90
set camera aspect 1+c,1.0
position camera 1+c,0,0,0
if c=0 then rotate camera 1+c,0,90,0
if c=1 then rotate camera 1+c,0,270,0
if c=2 then rotate camera 1+c,270,0,0
if c=3 then rotate camera 1+c,90,0,0
if c=4 then rotate camera 1+c,0,0,0
if c=5 then rotate camera 1+c,0,180,0
rem this command creates 'camera target images' turning a camera view into a real-time image (10-15)
set camera to image 1+c,10+c,256,256
next c
You will notice in addition to creating the cameras, for each one we need to point them in the right direction, switch off their backdrop, set their field of view to 90 degrees and change their aspect ratio to 1:1. This ensures each camera captures exactly one sixth of the scene from each of the main axis directions and the final command is the magic call to turn a camera view into a dynamic image at a resolution of 256x256. We can subsequently use these images anywhere in the remaining program and each time the camera draws it's scene, it will draw it directly to the image.
The next three commands will setup the object to use the new effect. For this effect we need to place our previously loaded normal map texture into stage zero (the first layer of texture in the object), then we need to place the cube map texture into stage one (the second layer). To do this the order of the command calls is all important.
rem Now apply the normal map to stage zero
istage=0 : texture object 1,istage,2
rem And then apply the shader (which will use stage zero for normal and stage one for cubemap)
set object effect 1,3
rem Finally apply the cube map using the 'camera target images' we created above (uses stage one)
set cube mapping on 1,10,11,12,13,14,15
The first command textures the object with the normal map, the second applies the FX shader and prepares the object by converting the internal data ready for rendering but the object at this stage is still missing a cube map texture in stage one. The third command generates a cube map at stage one using the dynamic images 10 through 15.
The final significant part of the program happens right at the end where we render our cameras.
rem First render all six 'cube' cameras quickly
sync mask %1111110 : fastsync
rem Finally render the visible scene
sync mask %0000001 : Sync
You will notice two sync calls instead of the usual single sync call. This is because we need to render the cameras generating the cube map first, so that when we render the main camera we have all the textures we need to render the reflections on the cube mapped object. Failure to do this in the right order and you will either see a reflection from the previous scene instead of the current one, or not see any cube maps due to the dynamic images being locked for rendering.
This is by no means the only way to create a dynamic cube mapping effect, and you should experiment with other approaches as you see fit. For those that like the technique but until now have never had the code needed to reproduce it, you're in luck. You don't need any extra modules or specially designed cube map textures. All you need is the above code and the kind permission of Green Gandalf. This technique relies on a tweak in Upgrade 7.5, so if you feel brave and want to play around with the code, join the U75 BETA in the forums and grab the latest version of the beta. I have also provided a running example of the technique which you can download right now.
You can download the files associated with this issue's Tip of the Month and run the demo for yourself.
The winning game can be seen in full, and downloaded the forums.
We're back! It's been a while since that last installment, 3 issues of the newsletter in fact. In that time though, Bruce has really taken shape with a complete level layout, 2 end bosses, and some sparkly new effects.
Bruce is at the stage now where we can make a game build, which will be a case of removing all the non-essential code and optimizing anything we can. That will give us a chance to re-organize those functions, as so many of them are being culled for the game build, it makes sense to tidy things up a bit. Right now though the game is fully playable, there will be some tweaks here and there in the game build, as well as some revised AI, but it already puts up a decent challenge already so give it a go.
Download the full tutorial here.
All of the necessary files, media and code can be downloaded here. For a quick taster of this month's lesson, here is an extract:
Previous Installments:
Part 1, Issue 62
//www.thegamecreators.com/pages/newsletters/newsletter_issue_62.html
Part 2, Issue 63
//www.thegamecreators.com/pages/newsletters/newsletter_issue_63.html
Part 3, Issue 64
//www.thegamecreators.com/pages/newsletters/newsletter_issue_64.html
Part 4, Issue 65
//www.thegamecreators.com/pages/newsletters/newsletter_issue_65.html
Part 5, Issue 67
//www.thegamecreators.com/pages/newsletters/newsletter_issue_67.html
Part 6, Issue 68
//www.thegamecreators.com/pages/newsletters/newsletter_issue_68.html
Part 7, Issue 70
//www.thegamecreators.com/pages/newsletters/newsletter_issue_70.html
Part 8, Issue 71
//www.thegamecreators.com/pages/newsletters/newsletter_issue_71.html
Part 9, Issue 75
//www.thegamecreators.com/pages/newsletters/newsletter_issue_75.html
Part 10, Issue 76
//www.thegamecreators.com/pages/newsletters/newsletter_issue_76.html
Featured in a previous issue of the newsletter, Airheads is a game controlled by your mind. The more relaxed you are, the closer you get to your goal. This tech demo - written in DarkBASIC Professional - was recently featured on The Gadget Show. Roll7 are currently in the process of revamping Airheads taking it from a simple one player experience to an online multiplayer mind race.
A preview of the contents of Model Pack 32 - office interiors. The full details of this pack can be found in the FPSC section of the newsletter.
The sports pack can compliment any game style, containing a large variety of sports items including gym equipment, tennis, boxing and soccer.
The pack contains 70 detailed entities and 12 room segments. Full details can be found earlier in the newsletter.
Ok, let's not mention the Ashes Cricket shall we? (Oh let's do! England won them back! Rick V)
So what's been happening this month ? Well, I've been mostly focused upon building the new Playbasic.com web site, of which a WIP version should be available by the time you read this. Beyond that, I've been continuing to write more examples & mini tutorials. So this month I think we'll run through a few recent ones. Conceptually, most of stuff is fairly universal, but obviously the examples are written for PlayBasic.
This example demonstrates a basic platform game control system with acceleration, jumping, falling and collision. The collision is really the only interesting part of the demo, since the rest of is cut and pasted from an example you can find in the PlayBasic/Projects/Tutorials/Physics folder.
In this demo, we're using an image as our collision environment, the image is a 2 colour representation of the 'hard floor' areas that a character can stand upon. When the character is moved / updated we're using the ray Casting function PixelRunLength() on this collision image to detect our position, relative to the floor. Then we apply some logic to determine what that character should do, given how far from the height it is.
Characters have 3 modes. They're either Walking, Jumping or Falling. If the character is Walking then we need to get some idea of the terrain they're walking upon, so we run a ray down from the character's origin point until it hits the ground. If you're walking upon a slope, within this demo we're going to assume the slope never raises / drops move than the character's height in gradient. So if we're running up/down hill, then this assumption will hold us upon the ground, until the ground if too far away. In that situation, the character changes from walk mode to falling mode.
If the character is Jumping, then we don't need to check for ground collisions at all, only when it's falling. When the character is falling, we're casting a ray down from it's current position. This time we're assuming the ground is further away than the character's height. If it is, we keep falling; if it isn't, then it's landed upon something. So we use the distance from ground to reposition the character relatively.
We could expand upon this logic further and detect situations where the character is only just above the ground perhaps. This can happen if we try and jump up onto something and almost miss. Here, you could trigger a climbing animation or perhaps the character moves into a hanging by hands mode or something. In the demo it just forces a reposition, which can be a bit clunky.
Anyway, have fun experimenting with it, you can download the demo here.
The aim of this example is to demonstrate an approach for decoupling your games logic from the host computer's drawing performance, which is commonly referred to as timer based movement. However in this approach, we're going to keep our frame based approach also. By doing this, our game logic is virtually the same as what it would be, except we're selectively executing the logic, and trying to tween (interpolate) the graphical output between logic refreshes. So if the host machine is running faster than we need, the player should see smoother motion. But when the host is running slower, it'll start to step of course, since we're missing redraws. There's not really much that can be done about that. Regardless, by using such an approach it no longer matters how fast the host computer can draw the scene.
The concept is simple enough, our game has it's own Ideal refresh rate, this is the speed/rate that our game logic executes per second. Logic refers to the code that controls our games' characters. Surprisingly these don't have to be updated every frame (here we're considering a frame to be refresh of graphical display), in fact a refresh of about 30 FPS or less, is more than adequate in most cases. So in other words, we're only polling the user input and moving the bad guys (or whatever character types are in your game) at this fixed 30 FPS period.
The test program does this by calculating the number of milliseconds between logic refreshes. If you want 30 logic updates per second and there's 1000 milliseconds per second. Then we calc the number of ticks between logic refreshes by dividing 1000 by our ideal rate. Eg (1000/30) - So each execution of our program's main loop, we're checking the current time (in milliseconds) against the expected time (in milliseconds) of the next logic update. If enough time has passed, we refresh the logic to move our characters in our scene, if not, we fall through to and render the scene output. This is fine for machines that can run the game loop faster than the our required ideal logic rate, but on slower machine it's possible that more than one frame has passed since we last processed logic. In this situation we calc the number of frames that have passed, then simply refresh our logic this number of times. In this demo, I'm simply scaling the movement speeds by the number of the frames passed, but it's the same thing.
By now, you're probably thinking that if the logic only refreshes intermittently (slower than the monitor refresh rate), wouldn't the graphical output look a bit choppy ? Yes, possibly, so to smooth out the motion this is where interpolated movement (tweening) comes into the equation. Each logic refresh, we're storing the position that our character is moving to, as well keeping track of the position that it was last located. If a redraw occurs before the logic refreshes, and it most certainly will, then we render the character's movement interpolated against the time passed. So the player sees intermediate steps, which smooth out the motion. One thing to note is this is at the end of the drawing a frame, we're not waiting until the next frame is due to start (and therefore giving this time back to the computer). So the speed of the display loop is only limited to how fast the machine can render the graphics on the screen.
Since our logic is decoupled from the graphics refresh, it doesn't really matter how frequently the screen is drawn. So we can use a Vsync'd screen mode or cap the sync rate manually. However, if you want your program to behave NICER on faster systems, it's generally a good idea to limit the refresh below a certain point, say 100 fps. Otherwise your program will hog all of the systems resources, which can be really annoying on desktop games.
The example demonstrates the approach in the overview above, in the demo it gives you control over the the logic FPS rate, ranging from 2fps to 30fps. You'll notice that regardless of how fast the logic executes the scene looks virtually the same.
Download this demo package here.
It's been a while since we've taken a look see at what some of the PB users have been tinkering away with. One user has knocked out seven games in as many months, which is quite an achievement for somebody new to programming. So, until next time enjoy !
Holly Platformer: http://www.underwaredesign.com/forums/index.php?topic=3144.0
Quake MD2 animation test: http://www.underwaredesign.com/forums/index.php?topic=3149.0
Bingo V1.0: http://www.underwaredesign.com/forums/index.php?topic=3137.0
Cops & Robbers: http://www.underwaredesign.com/forums/index.php?topic=3165.0
Simple Particle Library: http://www.underwaredesign.com/forums/index.php?topic=3135.0
Spooky Shadows: http://www.underwaredesign.com/forums/index.php?topic=3125.0
In2Deep: http://www.underwaredesign.com/forums/index.php?topic=3074.msg20739#msg20739
Each month we pluck one lucky subscriber from the newsletter mailing list and award them a free copy of DarkBASIC Professional and 1,000 Game Creator Store points. The email address of this month's winner is: zscom***93@**mail.hu We have emailed the lucky winner, congratulations!
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 81 deadline - September 26th 2009.
This DB Pro creation is a nice take on the Air Hockey theme. Originally written in DarkGDK and rewritten in DBP, the physics have been updated along with a few other tweaks thanks to community feedback..
Roll7 are looking for feedback on their latest mind-controlled game. Although the hardware may not be in your grasp, there is a demo posted which allows you to experience the game using traditional control methods.
Interested in a FPSC videocast? What's a video cast? It's a bit like a video mag with reviews, chats, may be a few hints & tips. Would people be interested in contributing? Would you do a video Q&A session about your game? Would you like to review a game?
A thread dedicated to 2D artwork. Whether it's computer generated, hand drawn or otherwise, this is the place to show off your skills and offer constructive feedback for others. You'll already find a selection of pixel art, Photoshopped designs, pencil sketches and full colour pastels.