BBC BASIC for Windows
Programming >> Graphics and Games >> DirectX
http://bb4w.conforums.com/index.cgi?board=graphics&action=display&num=1386770459

DirectX
Post by Kirkkaf13 on Oct 1st, 2013, 12:15am

Hi all,

I am new to programming and want to learn to program using the Windows API / DirectX for game development. I first started learning C and found the learning curve was too high for me.

After looking around the internet for some time I came across a couple of BASIC dialects that could access the WinAPI.

I have narrowed my search down to BB4W and Creative BASIC http://www.ionicwind.com/cbasic.html

Before I open my wallet to purchase one of these, what would benefit me using BB4W over CB and can I use it to create games in DirectX?

Thank you for reading.
Re: DirectX
Post by admin on Oct 1st, 2013, 02:25am

on Oct 1st, 2013, 12:15am, Kirkkaf13 wrote:
what would benefit me using BB4W over CB and can I use it to create games in DirectX?

I am not familiar with Creative BASIC, and there is precious little information available at the link you gave, so I cannot attempt a comparison.

As far as games programming in BBC BASIC for Windows is concerned I would recommend that you visit http://www.bb4wgames.com where you will find a large number of programs - some available in source code form - to illustrate what is possible.

The majority of those programs do not use DirectX since they are 2D games, and there is little benefit in using DirectX over plain GDI or GDI+ for pure 2D work (I am here excluding using DirectX as a route to programming the GPU, i.e. writing shader code, which is very specialised).

For 3D programming BBC BASIC for Windows comes with a library - D3DLIB - to simplify the use of Direct3D. There's an example of its use at http://www.bbcbasic.co.uk/bbcwin/examples/lighting.html however in all fairness I'm not aware of it having been used to create any complex games.

For another Direct3D example you can download the free trial (memory limited) version of BB4W and look at the supplied sample program TEAPOT.BBC.

Richard.
Re: DirectX
Post by Kirkkaf13 on Oct 1st, 2013, 10:17am

Hi Richard

What is the difference between direct3d and D3Dlib, is it a wrapper to simplify development?

As I am new to programming I was not looking to learn directx right away until I have created some small games similar to the ones at the link you provided. When I become more experienced is when I wanted to give directx a go. Would that still be possible with BB4W?


Re: DirectX
Post by admin on Oct 1st, 2013, 1:17pm

on Oct 1st, 2013, 10:17am, Kirkkaf13 wrote:
What is the difference between direct3d and D3Dlib, is it a wrapper to simplify development?

Yes, D3DLIB is a wrapper. It presents a simpler interface to the programmer than making direct API calls. It doesn't pretend to support anything like the full range of Direct3D features so you may occasionally still have to make direct calls, but it's still a lot easier than doing everything at a low level.

Quote:
When I become more experienced is when I wanted to give directx a go. Would that still be possible with BB4W?

Of course you can always choose to "give DirectX a go" but converting an exisiting program from (say) GDI to DirectX probably isn't particularly straightforward nor particularly fruitful. Personally, based on my experience, I would say not to bother with DirectX for 2D games but others might take a different view.

Richard.

Re: DirectX
Post by Kirkkaf13 on Oct 1st, 2013, 1:45pm

Hi Richard

Thank you for your assistance. I have made my mind up and I think BB4W is a steal for the price as soon as I am home I will be making the purchase.

Can you email me your bank details I will transfer the money over.

Re: DirectX
Post by admin on Oct 1st, 2013, 2:18pm

on Oct 1st, 2013, 1:45pm, Kirkkaf13 wrote:
Thank you for your assistance. I have made my mind up and I think BB4W is a steal for the price as soon as I am home I will be making the purchase.

That's very kind of you.

I feel, in all fairness, I should point out that many of the examples on the 'bb4wgames.com' site were created using the GFXLIB library by David Williams, which was designed specifically for writing 2D games. David has quite recently said that he does not wish to continue supporting that library, which is a great pity.

There are a few other people who have used the library who I am sure will be able to provide help if you need it, but it may not be of the standard that David was able to supply. I wouldn't want you to discover this after purchase and feel you had been misled.

Quote:
Can you email me your bank details I will transfer the money over.

I will as soon as I am on my main computer, where I have the details.

Richard.
Re: DirectX
Post by Kirkkaf13 on Oct 1st, 2013, 2:40pm

Richard,

I appreciate your honesty, however, I think BB4W would be a good starting point for myself. I would start small as there is much to learn, creating some small applications for automating some admin tasks.

I will check my emails later for your details.
Re: DirectX
Post by Kirkkaf13 on Oct 1st, 2013, 11:05pm

The Mandelbrot is extremely impressive example and renders very quick.

I have question regarding running applications from the IDE, I have to make sure the cursor is at the end of the application for it to run correctly, is this normal behaviour?

Thanks.
Re: DirectX
Post by admin on Oct 2nd, 2013, 07:03am

on Oct 1st, 2013, 11:05pm, Kirkkaf13 wrote:
The Mandelbrot is extremely impressive example and renders very quick.

Achieved with SIMD assembler code, as you'll see if you examine the listing.

Quote:
I have question regarding running applications from the IDE, I have to make sure the cursor is at the end of the application for it to run correctly, is this normal behaviour?

Not at all! The only explanation I can think of would be if you run the program using 'Run to cursor' (F6) rather than the regular 'Run' (F9 or the toolbar button). If that's not the case it's very strange.

Richard.
Re: DirectX
Post by Kirkkaf13 on Oct 2nd, 2013, 11:48am

Quote:
The only explanation I can think of would be if you run the program using 'Run to cursor' (F6) rather than the regular 'Run' (F9 or the toolbar button).


That is exactly what I was doing. I read through the manual on the IDE, helps alot.

Kirk.
Re: DirectX
Post by Michael Hutton on Oct 6th, 2013, 09:37am

I'll put in my tuppence worth.

I have been interested in DirectX applications and have made a few. There are definitely some pros and cons:

Pros:
1. Most times quite phenomenal performance, often depending on the GPU.
2. You can achieve the most amazing effects with BB4W. You can use DirectX, write HLSL effects and more, even use Direct compute to use your GPU as a mutlicore processor!

Cons:
1. A steep learning curve. The way to interact with DirectX can either be via a fairly archane (and fairly obscure) method of calling an interface which can be fairly difficult to understand at first. However, using structures it is easier, but not for the faint hearted.
2. You'll need to download the API documentation and then translate that from siliconvalley-ese to English then to BB4W!
3. It takes quite a lot of effort to achieve the simplest of programs. I have now written a few libraries for DirectX which automate the process for you but it can be tedious to debug even the simplest of problems.
4. It can be frustrating that you get it working on one computer and then it will fail silently on another (some methods don't have success/fail return codes!).
5. Although the D3DLIB is a good starting point for DirectX 8.0, I would recommend starting with DirectX9 or even 11 if your really brave. The reason for this would be that DirectX8 is now 'unsupported' although it does have the advantage of being preinstalled with all windows versions (?8). This may not be an issue.
6. No native 4 byte float support with BB4W but there is a decent workround.
7. There seem to be more pitfalls with DirectX but it is a great feeling to be able to get what you want on the screen.


If you do decide to do so. I don't mind helping just get in contact and I'll share my experience.

Michael

Re: DirectX
Post by admin on Oct 6th, 2013, 10:36am

on Oct 6th, 2013, 09:37am, Michael Hutton wrote:
The reason for this would be that DirectX8 is now 'unsupported' although it does have the advantage of being preinstalled with all windows versions (?8). This may not be an issue.

Just to confirm, if you were unsure, that all the DirectX 8 demos supplied with BB4W (PYRAMID, TEAPOT etc.) run perfectly in Windows 8 (64-bits).

Richard.
Re: DirectX
Post by Kirkkaf13 on Oct 6th, 2013, 6:59pm

Dear Michael,

Thank you for providing a pros and cons of DirectX.

As I am quite new to programming and just finishing through the tutorial of BB4W I think it will be best for me to play around with D3DLIB when I am more familiar with the language.

Once I have some experience creating games I want to move to DirectX.

Do you think that is a logical approach? Any advise is welcome on how to get started with game programming / concepts would be nice.

Thanks.
Re: DirectX
Post by Barry Marks on Dec 19th, 2013, 6:31pm

I'm not sure if anyone cares anymore since this is an older thread but I know a bit about Creative Basic so I'll tell you what I know.

It's an interpreted Basic originally written for the Amiga as Ibasic by Paul Turley. Paul was an excellent programmer and he did a good job with it. He later ported it to Windows. Then he wrote a compiled version and all but forgot about the interpreted version. It got a little more development but not much.

He sold them to someone else and wrote what were nearly exact copies of them called Creative Basic for the interpreted version and Ebasic for the compiled version. Then he sold those to someone else and wrote a nearly exact copy ... it gets kind of confusing.

Anyway Paul is in prison for the next 30 years as of a few months ago and other programmers are still supporting and selling his products. They're very good products but I'll be surprised if they have much future. Creative Basic gets almost no attention from them.

Paul was a really excellent programmer. He wrote good, solid, tight code, made it work well and he did it quickly. If he'd been a better man he'd have been a phenom. smiley

Creative Basic is a beautiful little interpreter that has one big advantage: it doesn't try to do much. It's a far less powerful version of Basic and because of that it's a lot simpler and more straightforward. But if you want to do something serious with Basic it's probably not the best choice. It's great for playing around.

Barry

Re: DirectX
Post by admin on Dec 19th, 2013, 7:29pm

on Dec 19th, 2013, 6:31pm, Barry Marks wrote:
It's a far less powerful version of Basic and because of that it's a lot simpler and more straightforward.

You can't get much 'simpler' than BBC BASIC - the BB4W interpreter is smaller than 64 Kbytes and as such will fit in the instruction cache of some modern processors. That contributes to its relatively high speed (for a traditional interpreter).

The challenge is to ensure that the simplicity and small size aren't limiting, by carefully choosing which features to build in and which to offload to libraries. I think BBC BASIC achieves that balance pretty well.

So I believe it is possible to have simplicity and power at the same time. But I appreciate that such comments are unwelcome here.

Richard.

Re: DirectX
Post by Barry Marks on Dec 20th, 2013, 03:33am

I wasn't saying BBC4W wasn't simple. I don't really know it well enough to know. I bought it a few years ago and have used it a bit now and then, but not for anything very difficult or complex.

Based on the little I know, I'd say BBC4W is by far the more powerful of the two. Once learned, it's probably the simpler as well, although I can only guess at that. But for the new programmer I think it probably has a steeper learning curve.

I'm an old guy now and I don't do much programming anymore. I can't really focus well enough to do anything very complicated. But after a long career as a programmer I still enjoy playing with it from time to time. I installed both Creative Basic and BBC4W about a week ago and I've been playing around with them and having a good time.

Honestly, I wasn't putting your system down at all. I think it's pretty impressive. If this thread had been a recent one I'd probably have suggested BBC4W, not only because Creative doesn't have much future, it's not nearly as useful.

I didn't suggest that because I assumed the issue was probably decided by the original poster long ago.

Barry