The Game Creators Newsletter Issue 27For sheer number of articles and bytes of actual content (as opposed to HTML!) this is one of the largest issues we've ever released. It was also one of the most fun to put together because of the massive amount of quality items this month. The four Games on test are all excellent - especially the commercial quality Firewall RTS and Math89s Doom. On the commercial game front we've got details of the excellent new space combat title Evochron and landing simulator Easy Lander. The PC Extreme team bring us a great article on SLI and what it will mean for graphics cards, and for DBPro developers we've got two great tutorials, one for Beginners about transparent objects and one for more Advanced developers to do with Functions. Add into this mix the Forum news, new product releases, FPS Creator information, DBPro Upgrades / Bug Week / Chat news and plenty more and it all creates one heady concoction of game development loveliness! Before I forget, thanks to Marshall Lawson for the front cover image last month (created with FPS Creator naturally). We hope you enjoy this read, there is certainly enough of it :) and don't forget to attend the TGC Chat Session if you can. ContentsDarkBASIC Professional Bug WeekAs promised last issue the team are gearing up for another intense DBPro Bug Week. A Bug Week will see the development team blast through as many reported bugs as possible in a set time period, at the end a new Upgrade will be released. Over to Lee to explain: "I can confirm that we will be putting in five twelve hour days starting the 28th March 2005 with the sole aim of squashing as many of the baddest bugs reported for a new Upgrade 5.8 release. This includes the already secretly fixed debugger which can now handle the entire FPS Creator source code (and that's big), some other bug fixes that have already been implemented since 5.7, and a cleanup of some internal code (which Mike is doing even now)." "Our aim is to get feedback from testers during this week to ensure we are going in the right direction, and if you want to be one of those voices email Mike (mike at thegamecreators dot com) on the morning of the 28th and we will include you in providing updates. By the end of the week, if we have something solid and the feedback from testers is good, we will wrap it up there and then for an Upgrade 5.8 release on the following Monday. It will be a bank holiday here, but I will work through it just for you. You will find the list we are working on, in the bug base, which has been kindly compiled by community members on a voting basis. If your personal hated bug is not on that list, get involved on the 28th onwards and tell us your woes. Catch you then!" Access the DBPro Bug List here: http://forum.thegamecreators.com/?m=forum_view&t=44853&b=1 TGC IRC Chat SessionOn Sunday the 27th of March The Game Creators will be holding a Question and Answers session in the DarkBASIC IRC channel. Lee Bamber and Mike Johnson will be present and ready to answer your questions about all things DBPro and its future direction. This Q&A session will kick-off the start of another DBPro Bug Bashing Week.
IRC Server: irc.darkbasicnet.info As with previous IRC chat sessions the channel will be moderated, the questions being approved by the ops before appearing in the queue. Don't have an IRC client installed? Then you can use the Java IRC applet built into our web site: //www.thegamecreators.com/ EZRotate for Dark Game SDK ReleasedA new version of the EZRotate library has been released - this time for the Dark Game SDK. It offers the same great object/world rotation controls as the DarkBASIC Professional release but for Dark Game SDK developers. What's more - if you already own EZRotate you can download the Dark Game SDK version free of charge! Infact anyone who buys EZRotate will now get both the DBPro and SDK versions in the same archive. Definitely good value for money.
What does EZRotate do?
Existing Owners:
Interested? More details here: //www.thegamecreators.com/?m=view_product&id=2082 FPS Creator NewsAfter the successful release of the Early Adopter version of FPS Creator a number of you are wondering "what next?". Well since the EA release we've been hard at work building Version 1 which includes integrating two major new features to FPS Creator: Physics and Multi-player.
PhysicsFor the past few weeks we have been playing the new FPSC physics test games and it is improving the gameplay experience in leaps and bounds. At this moment in time all objects in the scene can now be assigned weights and then blown around in a convincing manner! Throw a grenade into a stack of boxes and they'll fly across the room. Fire a rocket into the scene and watch everything get kicked back realistically. What's more you can now pick up and carry objects (as well as throw them around) which in itself will lend a great new diversity of FPS Creator built games. Imagine a scene with a lake of toxic waste in which you need to throw crates to jump across, this would now be possible. Ok, so we ripped that idea straight from Half-Life 2, but it just goes to show the new level of inter-activity it could bring to your games. Especially with control over the players carrying potential, throw strength, etc.
Multi-Player Both new features will be part of the Version 1 release this Summer.
Community HappeningsFor such a new product that isn't even in release status yet the community around FPS Creator is growing steadily. As a result of this a new FPS Creator dedicated web site has been opened and is building up content daily. FPSCreators.com contains some genuinely useful content such as a bunch of tutorials, Prefabs (covering WW2, Sci-Fi and other), various FPI Scripts, a very decent Media Bank (downloads of models, textures, sounds, etc), a Utilities section and last but not least - Game Demos! Phew. That's a whole lot of FPSC related stuff - so check it out at http://www.fpscreators.com
Screen Shot CompetitionAlthough time has nearly run out for the month of March we are offering no less than $250 for the best screen shot submitted on our web site! There are no limits on the number of times you can enter and you can create the screen shot with either the full EA release or the trial version of FPS Creator. All we ask is that it features media that we either supplied or that *you* own copyright over (so don't go sticking in models ripped from Call of Duty please!). Full details can be found here: //www.thegamecreators.com/?m=view_product&id=2001FPS Creator EA Release is available to buy now for only $56 (€43, £30) with a heavily discounted upgrade path to Version 1 when available. More details here: //www.thegamecreators.com/?m=view_product&id=2001 PC Extreme - Graphics Card Workshop - SLI ExplainedThis is the first in a new series of articles from the talented tech gurus over at PC Extreme magazine. Each month they'll delve into a current or emerging PC technology, always with a gaming / development related theme. This month we're going to be examining the technology underlying the buzzword on everyone's lips at the moment - SLI. We're going to look at the origins of SLI and its application in 3D graphics way back at the dawn of time (also known as 1998). We'll then attempt to decipher its current implementation today. 3DFX was the dominant graphics card player back in the late 90s. In fact, for a long while it was the only major graphics player, at least when it came to mainstream graphics cards. When it introduced its original Voodoo 3D card, which weighed-in with a whopping 4MB of memory, it revolutionised gaming. The basics of a 3D scene consist of geometry (the shapes), textures (the pictures laid over the top of geometry), and lighting. Before dedicated 3D hardware, the main CPU took care of all these calculations. In a game, the CPU would handle all the data about player statistics as well as any artificial intelligence routines, physics data (or other calculations for the game engine), as well as all the geometry, texturing and lighting calculations. This happened in games such as the original Quake and CPUs certainly didn't have enough muscle to calculate lighting or to apply any kind of filtering to textures back then. Consequently, graphics in games looked ugly. Very ugly. Dedicated 3D graphics hardware changed everything. The Voodoo card took on all the texture and lighting calculations and computed them via dedicated hardware. Hardware designed for a certain job is always going to be quicker than a general-purpose processor, such as the CPU, so games developers were able to make a huge leap forward in graphics almost overnight by simply tweaking their games. By the time the successor to the Voodoo was out - the cunningly named Voodoo 2 - hardware rendering was well established. The Voodoo 2 was the fastest card on the planet but 3DFX devised a scheme to make it even faster. That scheme was SLI. SLI stands for Scan Line Interleave and the technology was relatively simple. The CPU calculated the geometry data. It then passed the graphics scene to the 3D hardware for texturing and lighting. The 3DFX driver split the scene up line by line (hence 'scan line'), from the top to the bottom. Two graphics cards each rendered their share of the lines and a cable was used between the two cards to combine the scene together (hence 'interleave'). The two sets of lines were then sent to the monitor. SLI had several performance 'characteristics'. First of all, the scene was combined in an analog way - the graphics cards rendered alternate lines and the two output scenes were literally laid over each other via an analog cable. Because the signal was being passed out of one card, down a cable, into another card, back out of that and through yet another cable, the monitor image tended to look a little fuzzy. This softness was often flattering to games titles but made the Windows desktop look a bit hazy. Moving on the original Voodoo card was always limited in comparison to the processors of the time and games were invariably bound by their fill-rate potential - how fast the cards could generate the goods. In contrast, two Voodoo 2s in SLI were able to calculate rendering data far quicker - in fact, faster than any CPU at the time of the initial release could keep up with. As chips from Cyrix and AMD became popular, such as the K5, the problem was exacerbated - these chips had appalling floating point performance, making them slower at calculating geometry than their Intel equivalents (a situation that, in the case of AMD, has definitely changed today). The result was that SLI would never allow faster frame rates, since the performance was CPU limited. What it did allow was higher resolutions with no drop in performance, because even when doing more work to render more pixels, the SLI combo could still outpace the CPU. The cards weren't really digitally linked because they worked separately. The PCI bus was fast enough to carry data to both cards, having a total throughput of 100MB/s. However, as the bus began to get busier with intensive graphics calculations going back and forth between the graphics cards and the CPU, the fluidity of gameplay would often be spiked when large amounts of data were occupying the bus for other purposes, such as when being sent to hard drives or soundcards. Of course, all of this aside, history tells us that 3DFX eventually went under after consistently strong opposition in the market from Nvidia. Nvidia brought about a revolution in the graphics market by being the first vendor to relieve the CPU of all geometry calculations for a 3D scene. This stopped the CPU being the bottleneck in 3D graphics performance and led to the evolution of the ultra-sophisticated graphics market we have today. The AGP standard also came to replace PCI as the connection method of choice for graphics cards. It offered far more bandwidth and solved the problem of congestion on the PCI bus. However, there was one thing that restricted innovation - the AGP specification only allowed for one slot. With the advent of PCI Express, we're back in a situation where multiple graphics cards can be catered for on a mainboard. Nvidia took advantage of this to leverage the technology it grabbed from the buyout of 3DFX and reintroduce SLI in a modern incarnation. The Nvidia way SLI, under Nvidia's moniker, stands for Scalable Link Interface. In truth, this renaming is fair because what we have here is very different to the original method of multi-card rendering. However, Nvidia is no doubt aware of the blurry-eyed love many enthusiasts have for the original SLI and picked an acronym to exploit it. The Nvidia approach is far more sophisticated than the 3DFX implementation and requires some explanation. The first thing to bear in mind is that the PCI Express bus is so incredibly wide - it can transport up to 6GB/s - that the question of a bus bottleneck isn't really an issue. Secondly, with all 3D calculations being done on the card and games becoming increasingly 3D intensive, the processor is rarely a bottleneck in single-GPU setups. Nvidia uses two different types of dual-card rendering depending on the requirements of the game or application being used. These two implementations both have different characteristics. In a nutshell, the two methods employed are AFR (Alternate Frame Rendering) and SFR (Split Frame Rendering). In an AFR setup, each graphics card in the SLI configuration renders a full frame in turn - GPU 1 renders frame one at the same time as GPU 2 renders frame two, then GPU 1 renders frame three as GPU 2 renders frame four. In contrast, SFR is more akin to the 3DFX method but is a little more sophisticated. Using SFR, a 3D scene is split in half and each half is sent to a different card. These are rendered and then combined (digitally rather than analogously), before being sent to the monitor. Got the gist? Good! But let's move onto the guts of how this all works. AFR is the simpler of the two modes. Whilst one frame is being rendered, the CPU is preparing data for the next render and sending it to the second graphics card. If there is spare 3D rendering capacity, the CPU can send the next frame and then the next frame, buffering them in the secondary GPU ready to be swapped out to the frame buffer on the primary GPU. However, problems with this setup occur if the frame rate drops too low. This might happen if the 3D scene is too complex or some other system component is dominating CPU time. In this case, not enough buffering occurs and there's not enough time to interleave changes caused by player input into the rendering process. Consequently, the game will feel 'laggy' - there will be too much delay between the player pressing a button and something happening. Utterly lagless SFR has the potential to reduce lag but brings its own set of problems. Because both cards work together to render the same frame to the screen, lag is reduced because there is less buffering. With SFR, the screen is split into two halves for each GPU to render. However, it is often the case that the top half of the screen contains far more graphics than the bottom half of the screen (such as with first-person shooters, where the bottom part might contain weapon displays or the arm of the character holding the weapon). In these cases, the driver has to draw the horizontal render separation a little further up the screen to balance the rendering load between the two cards. But how about another dimension of complication? As well as rendering what is on screen, in modern games 3D hardware has to render a lot of off-screen objects too. These objects are rendered off screen before being swapped in to the scene on the screen. So not only does the load have to be split between halves of the screen but all the off-screen rendering has to be split too. This is a heck of a job for the driver to manage. Not only that but the driver has to manage geometry creation as well as the rendering of the geometry. The driver has to work out where the geometry is and find an appropriate place to split it before it even allocates the halves to each GPU (and that's before it's done any operations such as discarding hidden geometry in the scene!). Whilst technically there's double the rendering power in a two-GPU setup, you can see why Nvidia claims that you won't get double the real-world performance - the amount of calculations the driver has to do in order to balance the load introduce an overhead. Added to that, because the hardware is rendering the same frame concurrently, the two cards have to be kept in time with each other. This is where inter-card linking comes in, via the characteristic PCB that you see on all pictures of a modern SLI set up - a timing signal is sent between the two to keep them in step. The PCB is also used to transfer the contents of the frame buffer from the secondary GPU to the primary GPU for amalgamation.
Conclusion PC Extreme magazine is available monthly: http://www.livepublishing.co.uk/pcextreme/ Newton Game Dynamics Wrapper 1.32Newton is a very popular physics engine that has been tightly integrated with DBPro thanks to the Newton Wrapper of which this is the latest release, it has been carefully constructed to work smoothly together with the latest version of the Newton Game Dynamics SDK v1.32. The archive includes:
The demos include:
There is also an update to the Rigid Body Designer, loads of bug fixes and some core changes to this excellent wrapper (and physics engine). More details in our forum: http://forum.thegamecreators.com/?m=forum_view&t=50438&b=5 Easy Lander ... the lunar landing simulation game!Pay a visit to the Kennedy Space Centre in Florida and you'll soon be able to buy a software package created by Stephen Guenther consisting of Saturn V Explorer and Easy Lander, both of which were written in DarkBASIC Professional. Easy Lander is a full simulation of the landing of the historic Lunar Module - can you get it onto the lunar surface safely? The simulation features:
The web site features a great video of the program in action, screen shots and ordering details. Easy Lander costs $16 and is available now. The uniqueness of the title warranted it the front cover place on the newsletter this month. More details from: http://www.easylander.com DBPro Tutorial - The Ins and Outs of FunctionsThis month we have the first in a new range of tutorials aimed specifically at DarkBASIC Professional developers. Here author Steve Vink introduces us to the wonders of functions. This is a shorter version of the tutorial, the full length verison can be downloaded - details at the end. Being a father of 3, working full-time, acting as a school governor and trying to keep up with the plot in The Bill, I don't always know when I'm going to sit down to a coding session next. So when I do, I need to make sure I can pick a task, and complete it. That's the first reason why functions are my friend. A function is a self-contained operation. You tell it what to do; it does it; end of story. Functions, as clever as they are, don't remember anything. If you call it twice, it will have no recollection of what it did the first time. Far from being a drawback, this is where the power lies. Load, run and look at example 1, which demonstrates that when incrementing a variable in a function, it resets itself every time. If you are unfamiliar with functions, and how they are called, this example will also introduce the syntax to you. Functions would not be very useful if they could only do one thing. The input parameters, specified in parentheses, allow you to customise each and every call. Load, run and look at example 2, which illustrates a more versatile function with parameters. You can supply simple values for mathematical calculations, or "instructions" that force your code to branch and perform more precise tasks within the confines of a more generic function. We are still somewhat limited at the moment. We can run isolated code that has a life of it's own, and even tidies up after itself. We can customise each new "life" by feeding it with parameters. But to complete the cycle, we need feedback. Functions are capable of doing just that. By giving back information to the main program routine, the full potential is released. Now, your function can integrate with the main body. Example 3 demonstrates how the first example can be extended to "remember" the values it so easily forgot, and instantly become more versatile yet. Note the change of syntax when returning a value. Here are some key points to bear in mind:
Before I sign off, it's essential to know that in the world of Dark Basic, there are other entities that cross the boundaries of functions. These are your 2D, 3D and other world entities. A function can make reference to 3D objects, 2D sprites, images, sounds, lights, cameras and other such concepts. It's possible to write generic functions to interrogate and manipulate an entire collection of objects. Good design and program flow, however, should lead you to acting on specific items, through the use of parameters. This tutorial has been packaged up into a nice friendly installer that will load a full-length (far more detailed) version of the tutorial, along with source code into your Start Menu (in The Game Creators program group). Each month this collection will build-up into a formidable resource. Download this tutorial + code: DBPro_March_Tutorial.exe Fizz! Super Easy 2D PhysicsFizz! is a set of very easy to use functions that allows you to have real world physics in your 2D games with Newton. How to install:
Now you've done that get on over to the Fizz forum thread where you'll find example source code, sample programs, videos showing it all in action, screen shots and more. This is a great little bit of code that can bring 2D games alive with explosions, forces and all the other things you need for convincing movements. More details in our forum: http://forum.thegamecreators.com/?m=forum_view&t=50908&b=8 Cartography Shop 5 is coming...Cartography Shop developer Josh Klint is busy at work on the brand-new Version 5. This version will feature a host of tools and options not yet seen before in the package and is currently in heavy beta testing. Some of the features built in include:
We'll bring you more details about version 5 as we get them. Members of the Leadwerks Developer Network have exclusive access to the beta releases (as well as monthly models and texture packs). More details here: http://www.leadwerks.com Omega Basic 1.4 UpdateOmega Basic is a development language for mobile devices (phones and PDAs). A new version of Omega Basic was released today which includes general optimisations to the compiler system, leading to faster compile times. There are also new documented commands and an improved build engine that only includes the features used by your program. With input from a number of users this has led to greater compatbility with mobile devices. Existing users can download from our site to get the latest version. All new customers will be sent this version by default. More details here: //www.thegamecreators.com Evochron ReleasedWe bought you an exclusive video of this brilliant new looking game last issue and here we are with the full press release, take it away SW3D Games: StarWraith 3D Games LLC is excited to announce the release of Evochron, a space combat and trading simulation built using the award-winning combat and graphics technology of the Star Wraith series. In this challenging and addictive new game, you are placed in a recently discovered region of space where your survival depends on your ability to manage wealth and resources as well as your skills in combat. Small colonies populate the various planets and stations that you interact with in your quest. Other ships aren't merely objects to shoot at or fly by, they are an important part of the game's interactive universe. With the unique ship-to-ship trade system, you can negotiate trade deals and offer bribes to change your reputation, all in real-time gameplay. The game's complete player interaction system also puts you in control of planetary descents, station docking, asteroid mining, jump drive navigation, and much more. Evochron's freeform gameplay lets you play the game in a variety of ways. You can accept contracts for combat or transport duties and receive a set amount of money, or complete objectives on your own terms and fly for yourself. The game features a unified single player and multiplayer gameplay architecture, which lets you keep what you earn in either mode to use anywhere in the game. Evochron puts you in the action with a first person perspective and real-time gameplay events. Buy and sell right from the cockpit and manipulate the dynamic economy to your advantage. Explore massive systems featuring highly-detailed environments including nebula clouds, asteroid fields, planets, radiation zones, gravity fields, and more. You can travel to uncharted space for hidden benefits, but remain aware of possible threats such as a black hole or massive star. You manage all long range travel with the built-in open space navigation and jump drive system, with no jump gates or trade lanes to hold you back. The freedom of unrestricted travel also brings new dangers. You must learn how to navigate around planets and other obstacles in addition to conserving valuable fuel. Evochron runs under Windows 98/ME/2000/XP with a recommended minimum system configuration that includes a 700 MHz processor, 64 MB 3D accelerator, 128 MB of RAM, and 50 MB of hard drive space. The game supports keyboard, mouse, and joystick/gamepad flight control. The full version of the game features unrestricted gameplay, multiplayer, plus access to all systems, ships, and weapons. A free trial version of Evochron (18 MB in size) is available. More details here: http://starfighter.home.att.net/evochron/index.htm DarkBASIC Professional Cartography Shop Map ImporterThis is the major new release v3.2.0 of the DarkBASIC Professional - Cartography Shop map importer. This will allow you to load Cartography Shop v4.x map files into DarkBASIC Professional, providing many functions to help you manage your map files easily and quickly. The advantages of this plugin are:
More details from: http://www.apexnow.co.uk Leadwerks Game Media Subscription ServiceLeadwerks if now offering their high-quality game media subscription service. For a monthly fee, users receive two high-res texture packs (1024x1024) by texture master Alec Moody, plus a models pack each month. Media will be themed based on the votes of the subscribers. New subscribers will also receive our existing sci-fi and terrain textures packs. You can view samples and learn more at: http://www.leadwerks.com onGamedev's First Spring Programming ContestFeel like getting involved in a spring programming contest? Then why not join in with the onGameDev "Shooter" contest? There are over $1000 worth of prizes up for grabs including copies of DarkBASIC Professional and FPS Creator. The genre for this contest is "Shooter." This can include a space shooter (Galaga-type), an FPS(Doom style), or any derivative thereof. Your submission must include the source code and the deadline is June 21st 2005. Read more here: http://www.ongamedev.com/contest.html Games to TestAnoter month and another bunch of cool games that have caught our eye, each of them worth downloading and leaving comments in their forum threads. Firewall RTSFirewall is a firm favourite of the TGC staff and Firewall RTS is no exception. We hope to bring you a detailed review of it when it hits full commercial release shortly (congrats Xander!), for now enjoy the gorgeous screen shots and play this great game for yourself. Download Firewall RTS from: http://www.boltsoftwaregames.com/. Write about Firewall RTS: http://forum.thegamecreators.com/?m=forum_view&t=49676&b=5 Time PilotThis is a remake of an awesome 80s arcade game. The simple gameplay of blasting hundreds of aircraft to pieces whilst dodging bullets in your time jet is ridiculously addictive, and the urge to make it through to the next level keeps you glued to the screen for many, many attempts. Download Time Pilot from: http://www.byhmm.co.uk/programs/timepilot.htm where you can also find various other games such as The City, i World and Smash. Write about Time Pilot: http://forum.thegamecreators.com/?m=forum_view&t=50368&b=5 DoomThis is a very nice heavily Doom3 influenced FPS game from Math89. Run around a seriously creepy (and very dark!) sci-fi complex, blow away the baddies and see how far you can get. There are some lovely particle effects, great graphics, nice smooth gameplay and eerie sound effects. Well worth playing. Video and download in the forum thread. Write about and download Math89 Doom from: http://forum.thegamecreators.com/?m=forum_view&t=49880&b=8 Blast-o-maticAlex certainly seems to be on a roll recently! We featured one of his games last month and here's another. This time we've gone back to the classic 2D shoot-em-up school of game design. Waste the aliens spread over 3 levels using various weapons, defeat the huge end of level bosses and have fun in the process! Download it now from: http://alexrivaz.altervista.org/MyFreeware.html Write about Blast-o-matic: http://forum.thegamecreators.com/?m=forum_view&t=50614&b=5 Got a game you'd like to see here? Then email us now! From the ForumsOur forums are a diverse and interesting place to hang-out and here are a selection of hot topics this month. Last month we added a new forum feature called MailBack, this month we've added the ability to disable a MailBack from any subscribed thread. Here are a selection of forum threads this month that are worth looking over:
Irrlicht - Cartography Shop map importer
MP3 Length
Free Sci-Fi Weapon Models
ETV Racer Source Code Released
IBSE DarkMATTER Browser Replacement
Vi-Studio (Visual Interface Creator) You can find our forums at: http://forum.thegamecreators.com 20-Liner - Ring RageRobo Cat has managed to turn a simple concept into an addictive and challenging mini-game in only 17 lines. The goal is to avoid the bouncing rings for as long as possible, and since they rebound logically, quick thinking as well as deft keyboarding will help you survive longer and attain a greater score. See if you can beat the high scores in the forum thread! (Thanks to Ian for the review) Download the 20-Line code from: http://forum.thegamecreators.com/?m=forum_view&t=49380&b=11 Ring Tone MakerMake your own ringtones! No fees - No subscriptions - No downloads!
Ring Tone Maker is available now for $38.99 (€28.99, £19.99) More information here: //www.thegamecreators.com/ Beginners DBPro Tutorial - Banish Black EdgesIn this tutorial Michael Shah tackles the common problem of "awful black edges around transparent images" head on and shows you how to combat this problem via commented DarkBASIC Professional source code. sync on : sync rate 60 `Set the refresh rate to 60 set display mode 1024,768,32 `Set the resolution of our screen autocam off `Turn off the automatic positioning of the camera. ` This is our transparent image. ` It's good practice to use a prefix in variables like "img" for images so you can remember what they're for. ` It's also good to make variables so you're able to tweak them easily, without digging through all your code. imgTransparent=1 load image "Leaf1.bmp",1,imgTransparent ` Notice how there's a 1 in between the image file and image number. The value there can be 1 or 0. ` When set to 1, the image never will get messed with in DBP, so it'll retain its perfect quality. ` This is important to ensure that we don't get any black lines around our objects when textured. ` Now we can set the transparency for our program. ` All we have to do is define which color isn't to be drawn in our program. We set this color by using ` the 'set image colorkey' command. By default, the value is 0,0,0 so we don't need to worry about this, ` since in our image we want black parts to be an rgb of 0,0,0. If you want another value to be transparent ` then go ahead and change the rgb values. `set image colorkey 0,0,0 ` We'll now make a bunch of plains, cubes, and spheres to texture. A simple for-next statement is used ` to create the objects, make the object transparent, and finally texture the object with our image. for x = 1 to 5 make object plain x,1,1 set object transparency x,1 texture object x,imgTransparent next x for x = 6 to 11 make object cube x,1 set object transparency x,1 texture object x,imgTransparent next x for x = 12 to 17 make object sphere x,1 set object transparency x,1 texture object x,imgTransparent next x ` Just so the objects aren't in one big glob, we'll randomly position them all around our world. for x=1 to 17 position object x,rnd(50),1,rnd(50) next x ` Lets make some ground for our scene. make object plain 200,100,100 `Make the plain xrotate object 200,-90 `X rotate it, so it lies parallel with the camera. color object 200,rgb(0,60,0) `Color the object a greenish color. position camera 5,1,5 `Position our camera in the 3D world. do `Start our main loop. control camera using arrowkeys 0,1,1 `An easy to use command that lets us move the camera. ` Just to add a little flare to our tutorial, lets have the leaves fall to the ground when space is held. if spacekey()=1 `Check to see if the spacekey is pressed for x=1 to 17 `Start our for-next statement. move object down x,0.05 `Move the objects down ` If the y position of the object is zero, then we move it back up. if object position y(x)<=0 position object x,object position x(x),10,object position z(x) endif yrotate object x,object angle y(x)+1 `Y rotate the object 1 more degree xrotate object x,object angle x(x)+1 `X rotate the object 1 more degree zrotate object x,object angle z(x)+rnd(2)-1 `Z rotate the object 1 more degree ` When the random number equals 2.(1-1=0 : 2-1=1) next x `Go to the next x (our next object in this case.). endif `End our if-statement. sync `Refresh the screen. loop `Send us all the way back to our due statement.
Some Final Words of Wisdom Download the Source + Tutorial: DBPro_March_Tutorial_Alpha_Transparency.zip This months winner
Each month we award one lucky newsletter subscriber a free copy of DarkBASIC Professional. The winner this month is: bearlm1@???????.com OutroIt now seems somewhat ironic that last issue I was talking about the fact I would be worried about getting content each month. This month we've produced a newsletter large enough to be split into two! While I don't anticipate the size of the newsletter will continue expanding, I do expect it to remain "larger" rather than smaller. To that end we may have to switch to providing an alternative means to view the newsletter on-line as it'll get too large for some mailboxes. If you have something you'd like featured in a futue issue then please get in touch, I know our 10,000+ readers would love to hear about it. |
||