Everyone knows that the programmers greatest excuse for slacking off is compile time. Next time your waiting for your software to build burn a few minutes playing the Delphi Cannon Demo! It’s a simple VCL/OpenGL app I wrote in a few short afternoons.
By hosting an OpenGL canvas on top of a standard TPanel I was able to easily integrate a simple windows app with basic OpenGL rendering. This allowed me to create the simple game you see here, and encapsulate it in the easy to design UI of VCL. It works for more than just games too. A OpenGL enables TPanel is great for rendering complex graphs and data processed by your Delphi application!
So enjoy playing the demo, and think about what other things could be done with a faster rendering system attached to VCL controls.
Note, since this demo uses OpenGL you will need compatable video card drivers. These can be obtained by your video card manufacturer in MOST cases. Cirtain cards may need to search for OpenGL compatable drivers, as the manufacturers drivers are not always compliant. Also, if anyone has any questions reguarding the TPanel hosting OpenGL, or about the game itself, feel free to reply to this post.Posted by David Lock on November 20th, 2007 under Uncategorized | 18 Comments »
I’ve always been a little shady on the reason the StringBuilder class was created in dotnet. Obviously it has some advanced string formatting functionality which allow you to create complex composite strings easily, but what else does it provide. The answer to that question came to me when I was debugging our internal translation application written in C#.
We were receiving out of memory exceptions on and off from the app. After analyzing the code by hand for several hours I was still lacking an answer as to why this program swelled to 3 gigs of memory usage. It did store a massive size of string data in string classes, but since the database containing the strings was only 90 megs, it made no sense that string data would be the reason the program was eating memory.
However I had not taken one important thing into account, .Net strings are immutable, and in several places we we’re playing fun games with the strings values to properly format them to the output, calling string functions such as SubString and Trim liberaly. Turns out 2.7 gigs of memory we’re being used by all the intermediate string values as the string mutated to its final output.
The solution here was to use the StringBuilder class. After replacement memeory usage dropped down to 300 megs for the entire program, simply because we were not creating a bunch of invariant strings as we mutated our data.
Moral of the story, when handling string data that you expect to be changing alot in place, or strings that are quite hefty in size, StringBuilder is hands down a better solution, especially if memory use is a prime concern.Posted by David Lock on July 20th, 2007 under Uncategorized | 10 Comments »
So with the release of the roadmaps I can finally divulge to you what’s been cooking in secret for the upcoming release of Tiburon. For those of you who haven’t read the roapmap yet, get ready for a Unicode Delphi. Not only VCL, but also full Unicode RTL support as well. The plan is to upgrade the RTL and VCL to allow existing a new Delphi applications to process Unicode string data with all the existing logic. So here we go, a fully Unicode Win32 Delphi solution for Tiburon.Posted by David Lock on June 12th, 2007 under Uncategorized | 11 Comments »
I expected there to be alot of feedback, but man you guys really surprised me. I didn’t think anyone really read these things :). The good news is alot of you are putting the same two or three big ticket items as your number one requests. The bad news of course being that theres so much other totally valid requests in there that it will take me years to get to it all. Reguardless, I have your feedback now and fully intend to push as hard as I can on product management to make your requests part of the VCL in the future. In case any of you are wondering, heres what came up the most:
Unicode for Win32 - Yeah this is pretty much a no brainer. I myself just had a fun bout with upgrading our internal translation system (for speed, accuracy, and sym ship), and I can tell you not having unicode in Win32 makes things a bit of a pain. I imagine it will be easy convincing the crew that this one needs to be done asap.
ThreadSafe VCL - With the influx of multicore technology into the market I can see the need for VCL to be threadsafe. We will definatly want to take advantage of the shifting architecture of processing power.
Remove Application Main Form - Wow would I love to do that. Unfortunatly I think I’m the only one who does. Being the junior VCL guy means I can make suggestions, but if I went tearing through the codebase to make a major change like that I might be in for it. I will continue to press the team for the removal of this, well, hack.
Thats the major stuff anyway. There were some requests for better databinding, as well as new controls like the ribbon controls. These things are important too, but theres a limit to the amount of work Seppy and myself can get up to inbetween releases. Anyway, thanks for the feedback. We will do as much as we can to keep VCL meaningful and useful in the future.
Well the easy days of working just on internal tooling and processes are over. I’ve been assigned my first real area which you guys actually touch. Luckily enough I’ll have help on this one. I’m to assist Seppy Bloom with VCL, an assignment that I’m diving into with some enthusiasm. It’s going to be treat working on such a useful architecture (we’ll see if thats still my opinion in a few months). With more people working on VCL we can hopefully put in alot of extra features and bug fixing into future releases of the source for you guys. There is alot of work to be done, features to be added, and ideas to be tested and I’m always looking for good feedback. If anyone has ideas for features, lists of bugs, or any other sort of work you’d like to see implemented in future VCL releases, feel free to respond to this post or email me at firstname.lastname@example.org to discuss them. I’d be happy to get any feedback you can send me!Posted by David Lock on May 30th, 2007 under Uncategorized | 111 Comments »
Hey Everyone, I finally got around to posting the source to Turboman on code central. It includes quite a bit of updates from the last binaries I sent out, including as advertised the David I familiar which helps you in battle. Binaries are included as well as resources so if you just want to play the latest game then you should download this as well. Heres the link to CC:
Enjoy fiddling with my code. Go Turboman Go!Posted by David Lock on September 13th, 2006 under Uncategorized | 2 Comments »
In response to screen shot requests I’ve been receiving, heres one of a newly added feature. Now David I’s disembodied head flys a propeller cap about and helps TurboMan by assaulting enemies!
Go David I go!
Uncategorized | 4 Comments »
In a mad rush to be part of the Turbo excitement, I went ahead and coded our very own TurboMan videogame! Go ahead and download it at http://cc.borland.com/Download.aspx?id=24083.
Be advised, it is a work in progress. The current version allows for basic movement and combat, as well as leveling up TurboMan. Hopefully if time permits I can add all sorts of features to TurboMan the Video Game for all of you.
As I move along with development I hope to post all the source, as well as peices of the source which I believe make good game design demos as tutorials to my blog.
Alright everyone, its time to TurboMan!Posted by David Lock on August 23rd, 2006 under Uncategorized | 8 Comments »
Sorry for the complete and utter lack of post, content, and progress on anything related to Delphi, games, or any combination of the two. Time just gets short when they want you to get real work done in the office (the nerve of those people ). However being hard at work on the next IDE is as good for you guys as being hard at work on gaming stuff, probably better. So fear not! My time is still well devoted to making your lives easier.
Due to these restrictions on time I’ve decided to shift gears a bit. Im going to scale back the scope of the game idea, since I have made almost zero game specific program anyway. Not quite sure what direction I’m going to take it. Think “Simpler”. The plan being to still demo some of the game programming techniques I have picked up and/or developed over the years, while reducing the complexity of the game specific code. Short version: same amount of example information wrapped up in a smaller scope game.
When class gets out and I graduate in June I should have some more time to fiddle with non-work related stuff. Expect more demos material then. Till then, cheers.Posted by David Lock on May 5th, 2006 under Uncategorized | 1 Comment »
I’ve completed another simple component which will be used in the development of my SDL.Net game. While loading and rendering textures is not exactly a complex task, especially with the advantages that .Net provides for the loading of image data, it is none-the-less an important aspect to any application that uses 3d rendering.
Heres a screenshot of the latest running.
Get the Source code : http://cc.borland.com/item.aspx?id=23959
The new file is TextureMap.pas, and it includes the following things. The singleton class TextureResource, which loads and manages textures in an instance of any Delphi.Net application. The function DrawTexturedQuad which will draw a quad on the screen with the given texture, and also draw it either masked or unmasked.
A quick overview of how the TextureResource class works. It has only two public functions: get() which retreives the singleton instance, and Texture(String) which retreives the OpenGl ID of the texture. TextureResource stored loaded textures into a hashtable to prevent loading any texture file twice. The first time Texture is called on an unloaded image the texture is loaded and cached. Texture will also generate a masked textured for any file by prepending the filename with MASK.
Take a look into the TextureMap.pas file if your interested. The specifics of loading the image data and generating the textures are fairly well explained in comments in the code.
Also youll notice that in the test code I have a file called GUICore.pas. This is some beta code for doing basic in game gui stuff like button, panels, and windows. Feel free to check out that code too, but its pretty rough and uncommented at this point.
I’ve got some more work to do on the basic GUI stuff, then perhaps Ill be able to get started on some actual game logic work.Posted by David Lock on March 29th, 2006 under Uncategorized | 2 Comments »