Page 1 of 1

My very first p*p scroller.

Posted: Sun Jul 09, 2006 10:00 am
by {Nathan}
This is the very first engine I ever made, in QB/QBASIC or FreeBASIC, that uses p*p scrolling. I must say, I am very proud. The code is short, sweet, and too the point, but most of all -- organized. A very good learning source (although it is currently uncommented).

This zip contains source code, .bmp's needed (thank god for bload), and compiled source code (on FB .16).

http://www.petesqbsite.com/downloads/fb_pixel_.01.zip

Tell me what you think! I plan on improving it a TON later this week.

Posted: Sun Jul 09, 2006 11:30 am
by Anima
Hmm... main program is only 82 lines, that's pretty good, but it would've been better if there were things in there besides just the same blocks over and over again... :?

It's still pretty good anyways, what do you plan to make with it?

Posted: Sun Jul 09, 2006 1:03 pm
by {Nathan}
I honestly am not sure as to what I am going to make of it. Mostly I plan of a RPG engine that can create a whole new game (well, almost) with just a loadmap(map2938.dat). It is going to be completely configureable from outside files.

I once read a tutorial that stated you only have to make 1 engine, then modify the maps and scripts to make a whole new game.

And dammit, it made sense.

Posted: Sun Jul 09, 2006 4:42 pm
by redcrab
Nice ! Keep going !

Posted: Sun Jul 09, 2006 6:09 pm
by Anima
Nathan1993 wrote:I honestly am not sure as to what I am going to make of it. Mostly I plan of a RPG engine that can create a whole new game (well, almost) with just a loadmap(map2938.dat). It is going to be completely configureable from outside files.
If you will make an RPG out of it then I'm looking forward to it :)

Posted: Fri Jul 14, 2006 4:44 am
by Robot2037
i tryied it and its flickering...maybe you should have to use a double buffer or lock/unlock page or something like that...and dont use CLS in your DrawScreen sub (you will always redraw old stuff with new one, so dont need to clear this page)

and just one small tip - dont use * and / for operations with numbers which are power of 2 (0, 1, 2, 4, 8, 16, 32, 64...), use bit operations (shift left and shift right) instead, its faster than * or / operation

e.g. line 82 of your code:

Code: Select all

put (x * 32 - xOffset, y * 32 - yOffset), Wall
should be done:

Code: Select all

put ((x SHL 5) - xOffset, (y SHL 5) - yOffset), Wall

Posted: Sun Jul 16, 2006 6:57 pm
by {Nathan}
Thanks Robot - my new version (I had it written on Monday) does use page flipping and I was unaware that FB supported bitshifting, as I remember Seb had some major issues with bitshifting in QB.

Posted: Mon Jul 17, 2006 7:58 am
by Z!re
Robot2037 wrote:i tryied it and its flickering...maybe you should have to use a double buffer or lock/unlock page or something like that...and dont use CLS in your DrawScreen sub (you will always redraw old stuff with new one, so dont need to clear this page)

and just one small tip - dont use * and / for operations with numbers which are power of 2 (0, 1, 2, 4, 8, 16, 32, 64...), use bit operations (shift left and shift right) instead, its faster than * or / operation

e.g. line 82 of your code:

Code: Select all

put (x * 32 - xOffset, y * 32 - yOffset), Wall
should be done:

Code: Select all

put ((x SHL 5) - xOffset, (y SHL 5) - yOffset), Wall
FreeBASIC optimizes that itself, no use in obfuscating your code.

Posted: Mon Jul 17, 2006 1:22 pm
by {Nathan}
Z!re:

While I was writing my reply, I was asking myself why freebasic didn't do that on its own during compilation.

Posted: Tue Jul 18, 2006 3:48 am
by Robot2037
okay, im not so skilled in FB...i programmed in QB couple of years ago. Then i learned the java and now im writing j2me games for mobiles and i know, you have to optimalize your code and make you game as fast as possible, every single milisecond is needed :D
Now i trying to do some game in FB, so im used to use bithifting and other kinds of code optimalizations...i didnt know that FB makes it automatically during compilation.

Posted: Tue Jul 18, 2006 4:46 pm
by {Nathan}
New release!

Changelog -
Now uses page flipping with two pages
Supports much more versitile maps and "tilesets" (check readme.txt)
Default map is slightly less boring
Comes with compiled source code for linux and windows -- tested on both.

Check readme.txt and you can make your own maps with your own graphics - as many tiles as you want.

Link: http://www.filefactory.com/?ecb03b

Tell me what you think. Pretty soon I will actually implement a player...