My very first p*p scroller.

Announce and discuss the progress of your various programming-related projects...programs, games, websites, tutorials, libraries...anything!

Moderators: Pete, Mods

Post Reply
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

My very first p*p scroller.

Post 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.
Image
User avatar
Anima
Coder
Posts: 31
Joined: Tue Aug 23, 2005 7:25 pm
Location: Fort Wayne, IN
Contact:

Post 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?
My site = animaproductions.us.tf
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post 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.
Image
User avatar
redcrab
Newbie
Posts: 4
Joined: Mon Jul 03, 2006 9:29 am
Location: France
Contact:

Post by redcrab »

Nice ! Keep going !
User avatar
Anima
Coder
Posts: 31
Joined: Tue Aug 23, 2005 7:25 pm
Location: Fort Wayne, IN
Contact:

Post 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 :)
My site = animaproductions.us.tf
User avatar
Robot2037
Newbie
Posts: 6
Joined: Mon Nov 07, 2005 10:18 am
Contact:

Post 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
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post 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.
Image
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post 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.
I have left this dump.
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post 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.
Image
User avatar
Robot2037
Newbie
Posts: 6
Joined: Mon Nov 07, 2005 10:18 am
Contact:

Post 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.
.Robot2037's website.
http://robot2037.mysteria.cz

Need a music (MOD, S3M, XM, IT) for your game? Feel free to contact me via ICQ or mail...you can also check music section at my web.
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post 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...
Image
Post Reply