Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 14 in printed book and digital formats -- plus a one-year subscription so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview

Buy Now

Issue 1.3


Build a First-Person Shooter in REALbasic

Issue: 1.3 (December/January 2002)
Author: Joe Strout
Author Bio: Joe Strout is part of the engineering team at REAL Software, and gets tired of hearing people say "You couldn't write Quake in REALbasic..."
Article Description: No description available.
Article Length (in bytes): 36,122
Starting Page Number: 18
Article Number: 1311
Resource File(s):

Download Icon 1311.zip Updated: 2013-03-11 19:07:56

Related Link(s): None

Excerpt of article text...

If you don't know what a "First-Person Shooter" is, then you have probably been living in a cave for the last five years. A genre of games exemplified by Doom and Quake have grown enormously popular, especially among male gamers. The term "first person" indicates a 3D game in which the camera appears to be inside the player's eyes (as opposed to looking at the player from the outside). And "shooter," of course, describes the main point of most of these games, which is to shoot things, though the same basic game engine can be used for other types of games, such as exploration or adventure games.

This article will cover the basics of making a first-person shooter (FPS) game in REALbasic. Not even RB can make such a game trivial, so we're going to have to cut some corners and accept some limitations in order to fit this into a single article. I'll point out where these limitations are and how they might be addressed. By the end, you should have a working FPS demo which could serve as a solid foundation for a real game.

As a first goal, let's get the 3D display working. Make a new window with a width of 640 and height of 480. Now drag in an RB3DSpace, name it "MainView," and set its width to 640 and height to 384, leaving a bit of room above and below. That will leave us space to add status and debugging displays. Set its Hither and Yon values to 0 and 250, respectively, and the FieldOfView to 50 degrees. I also set both the AmbientLight and FloodLight to 40, though of course you can tweak these to get the desired lighting. Finally, set the SkyColor to a neutral gray; this may be visible through tiny gaps in the scenery, and you don't want it to be too obvious.

Next, we need to add the scenery itself. To keep things neat, create a folder next to your project file called "Models." Place the scenery model in that folder. The scenery we'll be using for this demo is called "Level 1 Scenery.3DMF" (see Figure 1) and may be downloaded from the subscriber section of the RB Developer web site. Now, load that scenery into the game, and do additional lighting and camera set-up, with this code in the Open event of the window:

...End of Excerpt. Please purchase the magazine to read the full article.