Rb

Don Jero
Unregistered
 
Post: #1
I was just wondering if many (any) of you use RealBasic as a dev. environment. I've been using it to work on a game engine, but right now I'm finding myself at dead ends at every corner, because the features of the language are just too inhibitive. Should I throw RB in the trash and move on to something else? If so, what, and where to start?
Quote this message in a reply
Member
Posts: 161
Joined: 2005.07
Post: #2
Don Jero Wrote:Should I throw RB in the trash and move on to something else? If so, what, and where to start?
For games? Absolutely. REALbasic and game development do not mix.

I've used REALbasic for software development before, but I would definitely not recommend it for games. Try a combination of C++ and OpenGL instead. C++ can be as readable as REALbasic code if you do it right (the syntax is still class.method() and class.property), but you need to manage the memory manually if you use pointers.

If you use OpenGL, GLUT is pretty easy to use. It's a front-end for creating a window with an OpenGL context for drawing, among other things.

EDIT: By the way, there are countless plugins for REALbasic that extend the language nicely. The only reason I don't recommend REALbasic for game development is because it's typically slower than straight C++ code, meaning the game's overall system requirements will be slightly higher. It could still be a great language if you don't mind that minor problem and having to download external plugins.
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #3
imikedaman Wrote:For games? Absolutely. REALbasic and game development do not mix.
Admittedly there aren't many good examples, but from my on-goning internal work I found it's actually a decent environment for games. Certainly good enough for free/shareware type stuff.

imikedaman Wrote:The only reason I don't recommend REALbasic for game development is because it's typically slower than straight C++ code, meaning the game's overall system requirements will be slightly higher.
Not entirely true - Rb is a compiled language and as long as you turn off some of the built-in safety nets inside computationally-heavy loops the speed is often comparable to C. There are times when C can spank Rb however, since Rb lacks direct memory access. If you're doing image manipulation or otherwise modifying large batches of vector data you'll want to use a plugin or external library, but the fact that Rb can utilize C/C++ code and existing libraries should be regarded as a plus. Now, Rb ain't perfect, and I still prefer/need C for a lot of stuff, but I've found mixing the two can be more productive than just using one or the other. I use C when I absolutely need or just plain want to, and Rb when I want to get something up and running quickly and easily.

This thread has inspired me to release a new demo/test of my in-progress 3D engine built with Rb2005: oxide3d_test02.dmg It's just a renderer test but hopefully it demonstrates the kind of stuff you can do in Rb if you put your mind to it...

The developer link in my sig has a bunch of free/open source game related stuff for Rb, including plugins to patch up some particularly weak areas (display configuration and mouse input for two).
Quote this message in a reply
Moderator
Posts: 529
Joined: 2003.03
Post: #4
Or check out BlitzMax which is made for games and is very fast.

"Yes, well, that's the sort of blinkered, Philistine pig-ignorance I've come to expect from you non-creative garbage."
Quote this message in a reply
Don Jero
Unregistered
 
Post: #5
So where can I find a good Mac C++ book to start with?
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #6
C++ is language independent. I learned C++ from The C++ Programming Language, which is written by the very person who created C++. After you learn the basics, you can try to find a good Carbon book, which would show you the specifics of windows, creating graphics contexts, menus, event handling, etc. on the Mac.
Quote this message in a reply
Member
Posts: 161
Joined: 2005.07
Post: #7
Just to specify, when I hear someone is making a game with REALbasic, they almost always use the SpriteSurface or Canvas control instead of the OpenGL module. Both built-in controls are incredibly slow, and the SpriteSurface offers almost nothing in terms of graphical goodies - no alpha support, no direct scaling/rotation effects, etc. The Canvas control supports alpha masks, but it is even slower than the SpriteSurface.

If the original poster was in fact using OpenGL, REALbasic can potentially be fast enough for games.

Just make sure you do some benchmarks, because some things in RB are still pretty slow. For example, here were some benchmarks for a standard 3D collision detection function I made:

REALbasic: 700 collision checks per second
Objective-C: 100,000
Objective-C (optimized): 333,000
C++ (using above optimized code): 1,000,000
C++ (even more optimizations): 2,500,000

My code called a class constructor quite a bit, which might by why the REALbasic code was so much slower. Objective-C is inherently slower than C++ because of the internal messaging system that runs during program execution. C++ gave me the fastest results overall. Of course, by the time I finished with the optimizations, the code was no longer portable back to RB. Oh well. Rasp

I have never seen RB code run as fast as C++ code, but it usually doesn't matter unless you're making something insanely CPU-intensive. In most cases the bottleneck is the graphical output, not the CPU.

Just something to think about. Grin
Quote this message in a reply
Moderator
Posts: 130
Joined: 2002.04
Post: #8
Yeah, if you want to make a fast pased game, you should probably not use either of the SpriteSurface or the Canvas. If you are making a 2D game and don't want to learn OpenGL, I would recommend that you check out SuperSpriteSurface at http://tinrocket.com
Sure, it's not free, but it's easy to use, OpenGL based and rather fast. I've heard it'll soon be ported to Windows too.

"Gameplay Uber Alles. And if you can make it psychedelic too, great!" - Jeff Minter
Quote this message in a reply
Don Jero
Unregistered
 
Post: #9
I'd been using the SpriteSurface, and when I started working on it I realized right away it was pretty limited. Right now I've got scaling, rotation, group control of sprites, a horrible particle effects system, and some basic curve movements. Right now I'm just getting sick of RB fighting me at every corner. You have no idea how much code went into scaling and rotating (not to mention its a very boggy process). I'll look into C++.
Quote this message in a reply
Member
Posts: 161
Joined: 2005.07
Post: #10
Don Jero Wrote:You have no idea how much code went into scaling and rotating (not to mention its a very boggy process).
If you use the Micono image plugin, the answer is one line. The problem isn't that the code is very long and tedious, it's that the overall product is too slow if you use the limited SpriteSurface control.

I've used scaling and rotations before with SpriteSurfaces, but the game required a 800 MHz G4 for simple 2D graphics. One was a Mario clone (used scaling), and the other was a Sonic clone (used rotations for running around loops). The system requirements were pathetic. If you use OpenGL (even in REALbasic), it has built-in and hardware-accelerated scaling and rotation of graphics. It's lovely.
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #11
imikedaman Wrote:REALbasic: 700 collision checks per second
Objective-C: 100,000
Objective-C (optimized): 333,000
C++ (using above optimized code): 1,000,000
C++ (even more optimizations): 2,500,000
Well those numbers are *way* far off from what I've seen in my tests, but I can't really comment without seeing some code. Rb has quirks and you do have to optimize things differently than you might in other languages. That said, I fully admit (and said so in my previous post) that there are situations were C/C++ is clearly the best choice. I just tend to wrap that sort of stuff up in plugins and do the final build with Rb rather than building the whole thing in C. Use the best tool for the job...

Yer right that Rb's built-in functionality is limited when it comes to games. SpriteSurface is dated and not much use for anything but the simplest of things, but Rb3D is getting better, and is actually very good for simple-looking stuff and prototyping (and tools). I've opted to use OpenGL directly through declares though, 'cause one texture per triangle just doesn't cut it IMHO.
Quote this message in a reply
Don Jero
Unregistered
 
Post: #12
I tried some C++ in XCode 2, and I was wondering if I'm going to have to put that stupid std thing before every command.

Like,

std::cout << "STD sucks, whatever it is. I hate typing it every time.\n";

On another note, I've been emailing RealSoftware about maybe making SpriteSurface better, but seem to be ignoring my email. Normally, that wouldn't bother me much, but I emailed them at version 4.5.... RB 2005 is a disaster, too. I'm not sure whats going on with the Window's MDI style, but I'm not using it anymore. I'm going to finish my crappy SpriteSurface expansion classes and then leave it in the road for whoever wants it.
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #13
std is the namespace. In order to use functions in that namespace without using std, you can put
Code:
using namespace std;
between your imports and your code.
Quote this message in a reply
Apprentice
Posts: 10
Joined: 2003.06
Post: #14
I feel your pain Don Jero. Before pitching all of your work I second the suggestion to try out the superspritesurface class. You can download and try it for free. I think the only limitation is a time limit on debug and compiled runs. If it works for you, then you can pay to register it. I don’t’ think it is a drop in replacement for the spritesurface, but it wouldn’t take to much work to adapt your code to it.

The demo that comes with it, is pretty impressive, and runs even on my old 500mhz iBook. The smoothness of the animation, size of the sprites and rotation effects were especially nice. I wouldn’t have believed they were done in RB if it didn’t come with the source to play around with. It has gotten me energized to try a project with it.

-jim
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #15
In the long run, you should still ditch REALbasic. I used it before I learned how to program in a REAL language (Wink), and I also realized how limited it is at that point. What was worse is the fact that I couldn't finish a project because of a bug in REALbasic that would cause my program to crash! That was pretty much the last straw for me.
Quote this message in a reply
Post Reply