Search Results

Sunday, January 23, 2011

Setting Up Development for BennuGD - Part 1

Hey, there. So today, I'll be helping you to set up a game development environment for use with the BennuGD programming language to develop games or applications, create a simple Hello World program, and even port the program to the great open-source handheld, Game Park Holding's Caanoo.
First, you'll need to download some tools. Here they are:
  1. Komodo Edit, which is a free development environment for write source code. It will be our development environment for making games and applications using BennuGD. Here's the download page; the link is at the bottom. Komodo Edit 6 IDE
  2. BennuGD Runtimes, which are the programs and dependencies necessary to compile and run our game. Here's the download page; download the Caanoo build and whatever PC (Windows, Linux, or Mac OSX) build you need. BennuGD Compiler and Runtime There's also the BennuPack on that page, which is a pack of helpful tools and examples to help you make your game.
So then, the basic idea behind this is that we will use Komodo Edit to write our source code and compile our source with BennuGD's compiler. We'll then use the runtime for the computer to test the game out. Then, we put the runtimes and the compiled source code on the Caanoo and then execute the game interpreter to run our compiled program. It's actually easier than it sounds.

So, first install the BennuGD PC pack onto your computer. For this example, it is installed in C:\BennuGD. Next, install Komodo Edit. It should be a very simple and easy process. Once it's finished, you should end up with something like this:

Basic Startup screen of Komodo Edit 6 - Your startup screen will probably look different from this one."

Now, then, you can see the basic startup screen above fairly clearly. Our goal for this IDE is to enable it to compile our source code and run the compiled file from the IDE. Now, in the ToolBox to the right, right-click and, from the menu that appears, select the Add menu, and from that, New Custom Toolbar. Name it BennuGD Bar - this will contain our tools for compiling and running BennuGD games. You don't actually need to create a toolbar for this, but it will allow the tools to be catagorized easily.

Now, right click in the newly created BennuGD Bar, and then from the menu that appears, select Add > New Command. Name the command 'Compile Main with Debug' - this command will compile our file with debugging mode enabled (so that one can debug problems and dissect the game's processes while running). Here's a screenshot of how the command should appear.

The command in Komodo Edit for compiling the main file in our project.

As you can see, the command runs the BennuGD compiler file (bgdc.exe), located in the C:\BennuGD directory. If spaces are present in the path to the BennuGD pack, then you may have to surround the path with quotes. The -g argument tells the compiler to compile the game's source code in debug-enabled mode.

The -i argument tells the compiler program to adds the directory stated ("C:\BennuGD\bin") to the path for the game for it to compile correctly. Finally, "%p\main.prg" tells the compiler to compile the file named 'main.prg', which would be the main source file of our game, in the directory of the project (%p is replaced by the directory of the game project when you call the command). This way, we don't have to highlight the main file in Komodo Edit to build and run the game - we can just call the command while the game project is open, assuming there's a Komodo project file present in our game project folder.

Next, you'll need to create another command - the Run Main command.

Command for running the main project file in Komodo Edit

Notice that this is a lot like the Compile Main command - except that this command runs the interpreter program (bgdi.exe) and passes the compiled source file ('main.dcb'), to play. It runs the interpreter in the project folder, which is evident from the 'Start In' section of the command. Once this is done, next you'll need to assign a keybinding to this command. Click on the keybinding tab and assign a nice key to bind it to, like F6. For us, we'll use F5 to compile the program, and F6 to run it.

The Save and Compile Macro - Saves all files open and compiles the main source file.
You might be saying that we haven't set the keybinding for the compiling program - that is true. But, rather than just setting the keybinding to compile the 'main.prg' project file, we would rather save all of the files open in the project, and then compile the source. This way, we don't have to save individual files. So, we'll build a macro for this. What's a macro? Well, a macro is a list of instructions that Komodo Edit will execute to save us time. How do we make a new one? Well, it's really simple. Click on the Tools menu at the top of the window, and select Macro > Start Recording. Now, Komodo is recording what actions you perform. So, go to the File menu and select Save All. Then, Click the Compile With Debug command that we created before. After this, click on the Tools menu again and from the Macro submenu, select Stop Recording. At this point, the macro is finished and from the same Tools > Macro submenu, select Save Macro to Toolbox. It will ask for a name; give it something like "Save and Compile", and put the new macro in the BennuGD toolbox. Finally, right-click on the macro and select properties. The macro code should look something like that to the right; as you probably can tell, Komodo Edit will automatically form the code when you record the macro.

Click the Keybinding tab, and assign it a nice key, like F5. This way, you can select F5 to save all files and compile the 'main.prg' BennuGD program file, and then F6 would play the same main program file. Great! The next part of the tutorial will be in writing a simple Hello World program and porting it to the Caanoo!

No comments:

Post a Comment