Dark Bit Factory & Gravity

PROGRAMMING => Freebasic => Topic started by: Xalthorn on June 12, 2008

Title: Oh I could have some serious fun with this...
Post by: Xalthorn on June 12, 2008
Hi folks,

I've just discovered freebasic and what fun I'm having :)

I threw a couple of things together and I make limited apologies for the messy code.  I'm going to work the ideas into a bigger demo but I figured it made sense to throw what I've done so far up here.

Please, if I'm doing something blindingly, obviously, dumb, let me know before I go much further with it.

Anyway, I've attached a couple of zips that include the source and an executable.

Xal.
Title: Re: Oh I could have some serious fun with this...
Post by: Shockwave on June 12, 2008
The spheres are my favourite  :clap:

This has to be in the top 10 of new members code posts, but then again Xalthorn I wouldn't expect less from you :)

Good job and have some good karma.
Title: Re: Oh I could have some serious fun with this...
Post by: Xalthorn on June 12, 2008
I had fun with the cube, but yeah, the spheres just seem more... interesting.

At least I didn't throw a gem in there.  I think near the end of my ps2yabasic time, pretty much everything had that darn gem in it :)
Title: Re: Oh I could have some serious fun with this...
Post by: Voltage on June 12, 2008
Nice examples!  Very clever.

p.s.  Nothing wrong with gems :) http://dbfinteractive.com/index.php?topic=1576
Title: Re: Oh I could have some serious fun with this...
Post by: Xalthorn on June 12, 2008
Nice examples!  Very clever.

p.s.  Nothing wrong with gems :) http://dbfinteractive.com/index.php?topic=1576

Thanks :)

That's a nice gem demo, I'll have to dust off my versions and throw some around for fun.

One thing I'm enjoying is the sheer amount of stuff that freebasic can cope with compared to an interpreted basic like ps2yabasic.
Title: Re: Oh I could have some serious fun with this...
Post by: Shockwave on June 12, 2008
One thing I'm enjoying is the sheer amount of stuff that freebasic can cope with compared to an interpreted basic like ps2yabasic.

You're only scratching the surface of what you can do... Believe me :)

Ugly Intro (http://dbfinteractive.com/index.php?topic=1510.0) <- yes thats a really ugly looking intro but it throws a lot around and it's using tinyptc and this intro is by no means as optimised as it could be.
Title: Re: Oh I could have some serious fun with this...
Post by: Xalthorn on June 12, 2008
One thing I'm enjoying is the sheer amount of stuff that freebasic can cope with compared to an interpreted basic like ps2yabasic.

You're only scratching the surface of what you can do... Believe me :)

Ugly Intro (http://dbfinteractive.com/index.php?topic=1510.0) <- yes thats a really ugly looking intro but it throws a lot around and it's using tinyptc and this intro is by no means as optimised as it could be.

Oh good grief, you had some fun with that one :)

I might as well leap in with both feet and see if I can come up with something with a scroller and stuff tonight.
Title: Re: Oh I could have some serious fun with this...
Post by: WidowMaker [retired] on June 12, 2008
I must admit I liked both things you have done there Xalthorn. Welcome along to this forum :)

I also use tinyptc and freebasic for quite a lot of things and it is indeed surprising what you can throw around.

The down side of tinyptc is that its most practical for 640 X 480 mode and possibly 800 X 600 depending what you are doing but if you want high res stuff you will need to use hardware accelerated graphics. It's still perfectly possible to make some quite viable demos with tinyptc and freebasic.

Rbz did a really top job on ptc _ ext!


Title: Re: Oh I could have some serious fun with this...
Post by: Xalthorn on June 12, 2008
I must admit I liked both things you have done there Xalthorn. Welcome along to this forum :)

I also use tinyptc and freebasic for quite a lot of things and it is indeed surprising what you can throw around.

The down side of tinyptc is that its most practical for 640 X 480 mode and possibly 800 X 600 depending what you are doing but if you want high res stuff you will need to use hardware accelerated graphics. It's still perfectly possible to make some quite viable demos with tinyptc and freebasic.

Rbz did a really top job on ptc _ ext!


Thanks, it seems like a nice place to be.

I'm only messing around with it at the moment to see what I can do.  As Shockwave has already said, I'm nowhere near the boundary of what I can do with it yet, but if I get that far I guess I'll have to think of some alternatives :)
Title: Re: Oh I could have some serious fun with this...
Post by: Shockwave on June 12, 2008
I don't normally do this, but Xalthorn and I had a similar kind of coding history some years ago and I know the kind of things he's likely to be trying.
So heres a useful list of stuff that caught me out when I started.... Hopefully it will save you some time.

Some resources I figure you'll be working on now...

If you are going to draw text, you'll either want to create a font inside the program or load a bitmap font.
It's simpler to create the fonts in data statements, it's nicer looking to use real bitmaps :)

At first I took the easy route.. These first three links have binary fonts;

Crap sinescroll;
http://dbfinteractive.com/index.php?topic=224.0

Binary font, slightly better, Sine scroll example in topic;
http://dbfinteractive.com/index.php?topic=646.0

Another binary font;
http://dbfinteractive.com/index.php?topic=1360.0

If you want to load a picture in and make it part of your exe, this one deals with 24 bit windows bmp images;

How to load bitmaps and make them part of your exe;
http://dbfinteractive.com/index.php?topic=2524.0

You will notice that 24 bit bitmaps are perhaps not the most optimal way of storing bitmaps when your exe comes out at about 1mb!
use upx or something similar to squish it :)

Or.. There is another choice, rbz made some great tools to include 256 colour bmps
These are a little bit hidden away, so here's a link;

bmp2raw:
http://dbfinteractive.com/index.php?topic=370.0

Make sure that it's only 256 colour bitmaps you convert with this, be careful too I know
you use irfanview, when irfanview converts a 24 bit bitmap to 256 colours it ruins
the background colour. if it was black, the value will change to #040204
You can set it back to black by altering the first three bytes in the palette file that
bmp2raw creates (after you use bin2bas on it).

bin2bas:
http://dbfinteractive.com/index.php?topic=368.0


Title: Re: Oh I could have some serious fun with this...
Post by: rain_storm on June 12, 2008
Great intro, I love the one that looks like ripples, really nice morphing Xalthorn. Karma coming your way for the source code.
Title: Re: Oh I could have some serious fun with this...
Post by: Xalthorn on June 12, 2008
I don't normally do this, but Xalthorn and I had a similar kind of coding history some years ago and I know the kind of things he's likely to be trying.
So heres a useful list of stuff that caught me out when I started.... Hopefully it will save you some time.

Hehe, you know me too well.  Although to be fair, recoding things that I used to be familiar with is the fastest way to learn a new language (I hope).

I'll probably be churning out a bunch of quick and simple tests to see how the language differs and what can be done to enhance them.

Some resources I figure you'll be working on now...

If you are going to draw text, you'll either want to create a font inside the program or load a bitmap font.
It's simpler to create the fonts in data statements, it's nicer looking to use real bitmaps :)

At first I took the easy route.. These first three links have binary fonts;

Crap sinescroll;
http://dbfinteractive.com/index.php?topic=224.0

Binary font, slightly better, Sine scroll example in topic;
http://dbfinteractive.com/index.php?topic=646.0

Another binary font;
http://dbfinteractive.com/index.php?topic=1360.0

I have a few ideas on fonts, but I think I need to do a basic scroller to get to grips with it again.  The problem with a language that has more potential is that my ideas get crazier ;)

If you want to load a picture in and make it part of your exe, this one deals with 24 bit windows bmp images;

How to load bitmaps and make them part of your exe;
http://dbfinteractive.com/index.php?topic=2524.0

You will notice that 24 bit bitmaps are perhaps not the most optimal way of storing bitmaps when your exe comes out at about 1mb!
use upx or something similar to squish it :)

Or.. There is another choice, rbz made some great tools to include 256 colour bmps
These are a little bit hidden away, so here's a link;

bmp2raw:
http://dbfinteractive.com/index.php?topic=370.0

Make sure that it's only 256 colour bitmaps you convert with this, be careful too I know
you use irfanview, when irfanview converts a 24 bit bitmap to 256 colours it ruins
the background colour. if it was black, the value will change to #040204
You can set it back to black by altering the first three bytes in the palette file that
bmp2raw creates (after you use bin2bas on it).

bin2bas:
http://dbfinteractive.com/index.php?topic=368.0

Of course, if I start messing with bitmaps I'll spend ages in Photoshop rather than coding :D

Thanks for the links and hints, I'll try to put them to use.
Title: Re: Oh I could have some serious fun with this...
Post by: Xalthorn on June 12, 2008
Great intro, I love the one that looks like ripples, really nice morphing Xalthorn. Karma coming your way for the source code.

Thanks, I had fun with that.  I've already planned some bigger and better tricks with that but I figured I needed to get in the habit of submitting code again.  Otherwise I'd end up spending weeks on a particular thing and then throw it away as my interest moved to another idea.
Title: Re: Oh I could have some serious fun with this...
Post by: Clyde on June 12, 2008
Welldone Xalthorn, I especially like the morphing dot objects.

Cheers and all the best,
Clyde.
Title: Re: Oh I could have some serious fun with this...
Post by: Dr.Death on June 12, 2008
What can i say m8 i am impressed with your first go with freebasic i never knew it was that good i am using purebasic keep it up  :clap:
Title: Re: Oh I could have some serious fun with this...
Post by: Xalthorn on June 13, 2008
Thanks for the lovely comments folks :D

I'm messing around with an idea for a scroller, which seems to be getting there.  I think my main hurdle is keeping the code clean and tidy.  It's really bad practice I know, but I tend to sit at the editor and start typing, working straight from silly ideas.

One day I'll plan a project before I start coding..... maybe ;)
Title: Re: Oh I could have some serious fun with this...
Post by: nkk_kan on June 13, 2008
good work Xalthorn!
i liked the spheres

maybe you should code a small arcade game or something to start with if you just sit at the editor and start typing. Because that's what i do..  :P
By the way, if you like game programming in Fb, you might consider joining here (http://games.freebasic.net/forum)
Title: Re: Oh I could have some serious fun with this...
Post by: Shockwave on June 13, 2008
To be honest I think Xal would get much more help on the official freebasic forums than on that one. Or maybe SHMUPDEV (http://www.shmup-dev.com/forum/) , but let's not try and entice any new members away from here shall we. In all honesty there has never ever been a programming question here that we havent been able to answer.
Title: Re: Oh I could have some serious fun with this...
Post by: Xalthorn on June 13, 2008
Please don't send me to even more forums, I don't keep up with all the ones I'm registered on now :)

To be honest, the only reason I'd look for other freebasic forums would be for inspiration, and google would satisfy that curiosity.
Title: Re: Oh I could have some serious fun with this...
Post by: va!n on June 13, 2008
brilliant! cool stuff! thumb up!