View previous topic - View next topic |
Author |
Message |
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Tue Nov 15, 2005 10:11 pm Post subject: Re: QB's usefulness |
[quote] |
|
white_door wrote: | In an age of emulation, QB's compatablity is only going to grow with each passing year. Using a dos or x86 emulator, I can run a lot of old dos games that just won't go under XP. Ironically you might have more compatablity with a dos app than a windows one, as many dos apps are easier to emulate under linux and other OSes.
So reguardless of how stuff changes or what becomes popular, you can be sure that games designed for old systems will never die. |
In an age of emulation?? With what CPU??? Surely you don't mean those dual core things that can hardly cooperate with each other!
I still don't understand why it takes a 1ghz system to do in QB what it takes 30mhz to do in C. I mean, even integer array copying is a cpu hog! I think, personally, that MS did something to cripple it....
I just want to say that I am not going to be doing anything to the effect of implementing BASIC into the future. So, anyone who wants to create a "fast" QB should know that there will be little competition. I think Dyne is superior, personally, and I'm focusing on it.
I'm all for a faster QB, but I won't be bringing it about.
|
|
Back to top |
|
|
Ren Wandering Minstrel
Joined: 07 Aug 2004 Posts: 130 Location: turn around...
|
Posted: Wed Nov 16, 2005 1:07 am Post subject: |
[quote] |
|
Ninkazu wrote: | That certainly is quite a crappy tile engine. |
Helpful as ever I see.
Box: Does it work? The problem is, you're posting one sub of an entire program with an unspecified problem (i.e. it runs too fast). You're using wait &h3da,8 which is an emulation of the qb wait command, so in theory it should run at exactly the same framerate as your QB prog. So, i'm not sure what to suggest. If you feel the screen is wavy, just make sure you've set the paging to the right place (setscreen 1,0 after your screen call) and that you put your fake screen wait command directly after you swap the screens.
Personally, I prefer screenlock/screenunlock to buffering, it runs quicker and just seems neater to me. Not sure if it would sort out the wavyness, but it might. Try it, an explination is in the docs. _________________ Previous nicks: MidnightDreamer, The_Anarchist, Shroomasta.
ren-tek.net : BGC games and more!
|
|
Back to top |
|
|
Ninkazu Demon Hunter
Joined: 08 Aug 2002 Posts: 945 Location: Location:
|
Posted: Wed Nov 16, 2005 3:01 am Post subject: |
[quote] |
|
Ren wrote: | Ninkazu wrote: | That certainly is quite a crappy tile engine. |
Helpful as ever I see. |
WELL I was going to post and example of a more efficient engine, but I saw that he wasn't using pixel-scrolling so I decided against recoding something to prove a point (On a second look, it is pixel-scrolling but very weirdly). I'll just say my beef with this routine.
1) It isn't showing a freeze-frame of one scroll state. It has to scroll to the next tile before returning to the main program (thus any data processing is put on hold and moving NPCs etc would fuck up).
2) It copies data to another array when it could just read from the original array. Wasted processing and memory.
3) From the strange way it does the pixel scrolling, there are excess multiplications.
Here's my scrolling routine with C++/Allegro
Code: | int CX = (pPlayer->getPos().x - (SCREEN_W>>1))>>4;
int CY = (pPlayer->getPos().y - (SCREEN_H>>1))>>4;
int PxX = (pPlayer->getPos().x - (SCREEN_W>>1)) % 16;
int PxY = (pPlayer->getPos().y - (SCREEN_H>>1)) % 16;
int CamX = CX, CamY = CY;
if (CamX < 0) { CamX = 0; PxX = 0; }
if (CamY < 0) { CamY = 0; PxY = 0; }
int offs = CamY * dim.x + CamX;
int tile = 0, dx = 0, dy = 0;
int ybound = (SCREEN_H)>>4, xbound = (SCREEN_W)>>4;
if (dim.x < xbound) xbound = dim.x-1;
if (dim.y < ybound) ybound = dim.y-1;
for (int y = 0; y <= ybound; y++)
{
dy = y<<4;
for (int x = 0; x <= xbound; x++)
{
dx = x<<4;
tile = data[offs+x]->bkg;
tileset->draw(dx-PxX, dy-PxY, tile);
tile = data[offs+x]->obj;
if (tile) tileset->draw(dx-PxX, dy-PxY, tile);
pPlayer->drawToMap(this, CX, CY);
tile = data[offs+x]->ovr;
if (tile) tileset->draw(dx-PxX, dy-PxY, tile);
}
offs += dim.x;
}
} |
This of course uses a camera as well. It first sets the coordinates to the center of the screen. The PxX is "pixel X" which is how many pixels over the tile the player is to later be subtracted from the absolute positions. I use bit shifting for faster multiplications, so x<<4 is X*(2^4) which is X*16.
Also, I use a one-dimensional map array for faster access to data. 2D arrays have more pointer math to do.
::EDIT::
Here's drawToMap() to show how I use the camera to move the character. I'm not using a sprite but just a rectangle here
Code: | void CNPC::drawToMap(CMap* pMap, int CamX, int CamY)
{
CPoint pos;
//check x is left bound
if (CamX < 0) pos.x = m_AbsPos.x;
//check x is right bound
else if (CamX >= pMap->getDim().x-1) pos.x = m_AbsPos.x - CamX<<4;
//check x is not bound
else pos.x = (SCREEN_W)>>1;
//check y is left bound
if (CamY < 0) pos.y = m_AbsPos.y;
//check y is right bound
else if (CamY == pMap->getDim().y-1) pos.y = m_AbsPos.y - CamY<<4;
//check y is not bound
else pos.y = (SCREEN_H)>>1;
rect(buffer, pos.x, pos.y, pos.x+m_iWidth-1, pos.y+m_iHeight-1, makecol16(140, 40, 36));
} |
|
|
Back to top |
|
|
BadMrBox Bringer of Apocalypse
Joined: 26 Jun 2002 Posts: 1022 Location: Dark Forest's of Sweden
|
Posted: Wed Nov 16, 2005 7:30 pm Post subject: |
[quote] |
|
Ninkazu wrote:
Quote: |
That certainly is quite a crappy tile engine.
|
Can't take any credits for it really :). I have done minimum changes to it. You'll have to blame DarkDread who have used it in, well, all he's games. I'm thinking pixel*pixel engine for the future but tos2 is going to be my usual way.
Ren: wait &h3da,8 does not do much of anything. That is very strange. Is there no other way to limit the framerate? _________________
|
|
Back to top |
|
|
tcaudilllg Dragonmaster
Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Wed Nov 16, 2005 11:15 pm Post subject: |
[quote] |
|
"wait &h3da, 8" monitors the vertical retrace. 0x3DA is the port number for several VGA state flags, among them the vtrace processing flag.
The first call is designed to delay execution until the beginning of the next vertical retrace. This "syncs" your execution to the beginning of the vertical retrace period. (hence the name "vertical sync") Once the wait instruction has run its course (that is, once the 3rd bit from the right at port 0x3DA is set), the vertical retrace is in motion. It is important to perform the page copy IMMEDIATELY following this interval. (ditto for the double buffer) Otherwise you will have flicker.
In QB, it is possible to PUT an entire screen to the display at this moment without flicker, using the PSET method for speed. Drawing the screen to a PUT-compatible array beforehand is another problem.
|
|
Back to top |
|
|
BadMrBox Bringer of Apocalypse
Joined: 26 Jun 2002 Posts: 1022 Location: Dark Forest's of Sweden
|
Posted: Thu Nov 17, 2005 8:02 pm Post subject: |
[quote] |
|
Thanks for the help and all but I guess I leave Tos2 in the world of QB and I'll be taking on FreeBasic on my next project.
It seems to be the best as nearly all code is finish in QB and the project itself is over half finished. Maybe I'll port the game to FB later on. _________________
|
|
Back to top |
|
|
BadMrBox Bringer of Apocalypse
Joined: 26 Jun 2002 Posts: 1022 Location: Dark Forest's of Sweden
|
Posted: Thu Nov 17, 2005 8:11 pm Post subject: |
[quote] |
|
By the way Ren.
I have now played through The tales of Sophy 1 and thought I could help you a bit with the problem you had.
You refer to a slimemonster but there is no such thing so I guess you mean the demon frog.
When you have beaten the demon frog in the basement, go back into the castle, go upstairs and there you have an open door. Beat the evil creature and then go back into the basement and there an door will have opened. Enter the sewer kill the monster and head back into the castle. When you have been into every room, exit the castle and go into the tower at the roof and there you will have the final brawl with the Shaddow King. _________________
|
|
Back to top |
|
|
bay Wandering Minstrel
Joined: 17 Mar 2004 Posts: 138 Location: new jersey, usa
|
Posted: Fri Nov 18, 2005 3:36 am Post subject: |
[quote] |
|
Ninkazu wrote: | That certainly is quite a crappy tile engine. |
i think whenever someone says something blantantly flaming like you do quite frequently, they should attach their version in code as well as an exe of their code in action - language differences aside.
so, your working tile engine code and a walk around demo?.. where is it? mr. ninkazu, why are you staring blankly into space?
replying to your squabble is always enjoyable.
.02$ _________________ INTJ
|
|
Back to top |
|
|
BadMrBox Bringer of Apocalypse
Joined: 26 Jun 2002 Posts: 1022 Location: Dark Forest's of Sweden
|
Posted: Sat Nov 19, 2005 1:14 am Post subject: |
[quote] |
|
Ah, bay. I dont mind him calling it crappy and I'm sure he's code works well. But crappy or not, that tileengine is invoked in some of the best QB-RPGs ever created. _________________
|
|
Back to top |
|
|
bay Wandering Minstrel
Joined: 17 Mar 2004 Posts: 138 Location: new jersey, usa
|
Posted: Sat Nov 19, 2005 8:41 pm Post subject: |
[quote] |
|
BadMrBox wrote: | Ah, bay. I dont mind him calling it crappy and I'm sure he's code works well. But crappy or not, that tileengine is invoked in some of the best QB-RPGs ever created. |
it pretty much comes down to that. finish products and games that work good enough to be enjoyable.
on the other side is, don't sit back and criticize without having something constructive.
as for ninkazu's approach with most things, criticize first help later.
.02$ _________________ INTJ
|
|
Back to top |
|
|
Ninkazu Demon Hunter
Joined: 08 Aug 2002 Posts: 945 Location: Location:
|
Posted: Sat Nov 19, 2005 10:27 pm Post subject: |
[quote] |
|
I recognized that he was copying the map data into a new array like the msong engine did, but he used a different method for pixel scrolling, since msong did something even stupider. DeviusCreed wrote the routine, FYI. It copied an entire column of tiles to paste it pixel to the side. I know these details because jkettles16 used the routine for Cai's Quest 3 and when DarkDread got wind of it, he banned me and James from DarknessEthereal (it was also because I was a 13-year-old hot-headed newb that flamed him every chance I had, heh).
But anyway. Try not to take my comments as total insults. I'm what people call overly straightforward (rude).
|
|
Back to top |
|
|
BadMrBox Bringer of Apocalypse
Joined: 26 Jun 2002 Posts: 1022 Location: Dark Forest's of Sweden
|
Posted: Sun Nov 20, 2005 7:08 pm Post subject: |
[quote] |
|
Quote: |
But anyway. Try not to take my comments as total insults. I'm what people call overly straightforward (rude).
|
Heh, no, I can live with it ;). But on the other hand, try to give something more like constructive critism. Yet you gave me help later so I really nothing to complain about ;).
Anyway, I have designed a couple of more tilesets and I'm building building building maps. Much create a better mapeditor... The one I have now kills me :¤. _________________
|
|
Back to top |
|
|
BadMrBox Bringer of Apocalypse
Joined: 26 Jun 2002 Posts: 1022 Location: Dark Forest's of Sweden
|
Posted: Sun Dec 18, 2005 7:11 am Post subject: |
[quote] |
|
Here we go again.
I'm in a sharing mode and its almost christmas.
-Hello santa, you seem to be drunk.
Eh, anyway. I have found some code on freebasic.net that cut down the framerate to what you want it to be (more or less). There was a ton of examples and I will implent each and every one of them in my code to see if/what code that works best. If it works good, The Tales of SophyII are freebasic again. _________________
|
|
Back to top |
|
|
tunginobi Wandering Minstrel
Joined: 13 Dec 2005 Posts: 91
|
Posted: Mon Dec 19, 2005 1:46 am Post subject: |
[quote] |
|
Just a quick question about the code that's been posted in this thread: the C++ code takes advantage of bit shifting to speed up its processing, so is there a way to implement bit shifting in QBasic? I don't recall any functions or operators that do that.
|
|
Back to top |
|
|
Ninkazu Demon Hunter
Joined: 08 Aug 2002 Posts: 945 Location: Location:
|
Posted: Mon Dec 19, 2005 2:17 am Post subject: |
[quote] |
|
Nope. Not supported in QB.
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|