Jump to content

  • Log In with Google      Sign In   
  • Create Account


How to produce FAST 2D hi-res scrolling engine ?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
13 replies to this topic

#1 Paladin   Members   -  Reputation: 122

Like
Likes
Like

Posted 01 December 1999 - 05:55 PM

Hi everyone !

I'm very new over here, but I think that I'm going to be using LOTS of time with you guys

I started designing my own game, which supposed to be very "hardcore" design:
Fast speed without 3D-acc.
Then I started to collect my team up, and right now game has been under design for about half year.

Originally we started to create 2D- tile engine & mapeditor, but then we got problem:
Game didn't look great, mostly because of the lack of resolution (320 x 200). We were thinking that we could make fast (30fps atleast) scrolling engine for 640x480 WITH 16bit colors, but it seems to be that we were "wron". After couple of months, without doing almost anything for project, we started to dream about getting 3D-acceleratioin for help:
Quake & friends are very fast "scrolling" games, and what we were thinking, because of 3D-acceleration.

First we were thinking about adding just OPENGL & Direct-X API to speed the graphics, but then we started to dream full
3D-world... and now... and noww.... I'm dreaming about going back to original idea:

Fast (30 fps) scrolling engine for 640x480 16bit colors.

IS THIS "IMPOSSIBLE" to create ?
Jazz Jack Rabbit 2 did use this resolution and colors (I think), and some other games, Doom ect. can actually draw graphics pretty fast to screen... How is the code optimized ? We have been using Allegro, and we were thinking that Allegro's code is already very fast, but we couldn't figure out how to get smoot 640x480 with rainbow colors...

I have asked this question from many places half year ago, and no one gave me answer... Maybe I have better luck this time

Thank You


Sponsor:

#2 Dragun   Members   -  Reputation: 123

Like
Likes
Like

Posted 30 November 1999 - 11:16 AM

Ummmmmm...I think it's pretty hard to fuck up a 2D side scroller with DirectX as the API, unless there are too many overlays and alpha blending. DOOM and Quake are 3D games, not "scrolling" games.

A side scrolling engine using DirectX on a Pentium 133 would acheive about 32 fps with a first generation video card.


#3 mmcconnell   Members   -  Reputation: 122

Like
Likes
Like

Posted 30 November 1999 - 03:03 PM

Take a look at how many tiles you're blitting, how many layers you've got, and if you're alpha blending or not. Blit your base tiles with DX so you can get hardware acceleration. If you're not doing alpha, blit everything with DX.

Create an off screen surface that is two tiles taller and wider than your viewport. Blit the tiles into the off screen surface, then blit a sub section of that into your viewport. You could also create a blitter that clips and blit the tiles directly into your view port.

Hope this helps. There are lots of good articles in the programming section about tile based games. I've got a 32bit 640x480 tile engine that runs 150fps+ on a Pentium II.



#4 Paladin   Members   -  Reputation: 122

Like
Likes
Like

Posted 30 November 1999 - 03:29 PM

Yes, there are, but mostly those are talking just about 320x200 resolution, AND if it's about 640x480, engine ISN'T made for "fast" use... I don't know why, but it seems to be that 640x480 "changes" scroller to strategy game or so...

So this engine that you made, was done with Direct-X API or not ?
It sounds pretty NICE
Just what I'm looking for...


#5 Hoff   Members   -  Reputation: 122

Like
Likes
Like

Posted 30 November 1999 - 04:30 PM

30 fps in 640x480x16 isn't an unreasonable goal. But you're going ot have to work for it

You might want to look into the new Allegro extensions, which add hardware acceleration for some cards. I don't remember what it's called, but last I knew they had it implemented for some Matrox and ATI cards.

And keep in mind that you don't necessarily need 30 fps for this type of game. First Person games and Sidescroller games are two completely different animals.


#6 Paladin   Members   -  Reputation: 122

Like
Likes
Like

Posted 01 December 1999 - 12:59 AM

OK.

Mostly the problem is that I don't know almost anything about optimizing programs. Actually I just saw pretty nice tutorial with something like 25 different ways to make small piece of blit() code better, but still I'm "newbie"

About assembly, are there any GOOD beginner tutorials for assembly ? I would like to know "basics" (if there is such a thing for assembly) ?

What do you mean that 30fps isn't reasonable for side scroller ? It needs to be smooth... In my opinion... STILL I'm wondering how the HELL did you manage to build same engine for 32bit WITH 640x480 ... and damn 120 fps

When I tried to build own engine, with 16bit, it was running with speed like 15fps with flickering car, and when it started to scroll, game dropped to under 10 frames.

So 32bit is actually two times more than 16bit... DARN, did you write whole thing with assembly ?

If you have any idea where to find this kind of "how to build FAST scroller" (for hi-res), I would like to know... Thats so freaking cool.. I mean 32bit 640x480 120fps


#7 mmcconnell   Members   -  Reputation: 122

Like
Likes
Like

Posted 01 December 1999 - 04:25 AM

OK, here's the basic run down on what I did:

First, get your generic windows program running. Don't lock the game loop to any frame rate at all. I calculate a variable called DeltaTime which tells me how much time has passed since the last frame. Movement for objects is based on pixels per second / deltatime.

OK, on to the tile part. I'm using 64x64 tiles because I don't need lots of small items. Create a primary surface, attach a back buffer. Create BOTH in video memory! This is important. Load your tile bitmap in the video memory too. If your bitmaps don't fit in video memory, your blits won't be hardware accelerated and will be dog slow compared to ones in video memory.

With your tiles and back surface in video memory, blit your tiles onto the screen. Use a blit function that will clip them to your screen or viewport.

I've got a TNT card (not a TNT2) and everything runs great.

Hope this helps.

Marcus


#8 Paladin   Members   -  Reputation: 122

Like
Likes
Like

Posted 01 December 1999 - 05:25 AM

Hmm... so we can get some hi-speeds with hi-resolution when we are using DX... How about software ? What kind of FPS could I get without hardware acceleration ? And how about OPENGL API ? (mostly I'm just interested because of Linux port).

#9 mmcconnell   Members   -  Reputation: 122

Like
Likes
Like

Posted 01 December 1999 - 06:16 AM

I honestly don't know what kind of fps to expect without hardware acceleration. I'm fairly new to game programming and I don't have any OpenGL experience. If there is a graphics library for Linux that supports hardware acceleration (there should be one) then you'll be fine.



#10 Rock2000   Members   -  Reputation: 122

Like
Likes
Like

Posted 01 December 1999 - 11:04 AM

I've got a 2D vertical scroller, and in 16bit color, with DX, it does about 130fps (with all the music, colliosion detection, ....). When using the hardware, you can generally get pretty close results between the different color depths, so going to 32bit color isn't too much of a hit. However, there really isn't much chance of pulling off a 32bit software scroller, and I'd say that greater than 16bit color for 2D is way overkill. Those colors are for 3D shading.

Anyways, for my software version, I pull off almost 100FPS in 16bit mode. That's a fully tiled (only 1 level, no parallax) 640x480 scoller on a Mystique. It is a little tricky though (many optimizations, but no MMX yet), and if you don't know assembly it isn't likely you'll reach it. Also, for software drawing, the video card write speed is critical, so the FPS values can fluctuate quite a bit.

If you are fairly new, I'll just give you the age old advice of 'get something smaller and easier under your belt'. 2D scrollers are a good place to start, but to make it very fast requires some more experience.

Rock


#11 Paladin   Members   -  Reputation: 122

Like
Likes
Like

Posted 01 December 1999 - 11:45 AM

Yes, I'm pretty "newbie", with about 1 1/2 year experience. I don't have experience with DX, but I'm trying to fix this at upcoming christmas (ah, my present; Lamothes new book .
I made this scroller engine already (allegro, djgpp), but I really didn't get enough speed out from it, and actually many people told that its not possible to get scroller with over 256 colors (hmm... I didn't believe this

Actually I'm not the head programmer of this project that I'm LEADING, but I have been trying to get some help, because we have been wondering so much about this big question: Are we going to need 3D-API to get this game fast enough ?

"My" programmer is working with Linux, and so he wouldn't like the idea that we use DX (he doesn't have windows next to linux), and I would like to have DX, so I have been just wondering that do we need API afterall, IF we can make scrolling fast enough with pure Allegro code (only software)... hmm... this has been pretty hard question. Actually if you people think that it's stupid to skip 3D-acceleration (mostly just for 2D purpose), let me know !

It's just that game will need two API's, DX and OPENGL (for Linux)... And how much is this extrawork ?


#12 Kyle Radue   Members   -  Reputation: 122

Like
Likes
Like

Posted 01 December 1999 - 02:39 PM

There's no reason you need two API's to get hardware accelerated graphics, just use OpenGL. If you like the idea of only writing input routines once also, I'd suggest you use GLUT with OpenGL. It handles the OS-specifics for creating windows and you can also use it for keyboard and mouse input and timing. I can't recommend GLUT for commercial games or applications, but for games which are mainly for the experience and knowledge of the developers, I don't know why you'd want to spend your time working on multiple renderers and input routines instead of working on what's important: the game.

#13 Zenroth   Members   -  Reputation: 127

Like
Likes
Like

Posted 01 December 1999 - 03:04 PM

Ok a few comments yes that speed is possible.
In software... Yes i think so though im not all that sure(almost all cards support accelerated blitting).

I have a tile engine using 64x64 tiles. I have a old vodoo rush hercules stingray with 6mb of memory(4mb in 2d). I get 75 fps in 640x480x16,800x600x16,and probally at 1024x786(dont know cant run the mode because i have my refresh rate for all modes locked to 75hz and 1024x786 doesnt support it).

I use directx and flipping (with vsync/wait)
I place both the back buffer and primary surface in vid mem(which only takes like 1.8mb video mem in 640x480x16). Right now all my tiles are in system memory(including some animation for a character).

As far as opengl goes ( i know it supports 2d)but i didnt think it was really made for or great for 2d?



#14 Abe   Members   -  Reputation: 122

Like
Likes
Like

Posted 01 December 1999 - 05:55 PM

I had the exact same problem for awhile with my sidescroller, and I'm using DJGPP and Allegro too. My game runs at around 20 fps using entirely software in 640x480x16-bit, with 5 layers (it has parallax scrolling, and one of the layers can also be translucent.) This is on my PII-233 Mhz with a crappy old video card with 2MB of VRAM that doesn't have hardware acceleration support. To make it run this fast, I use RLE sprites (compiled sprites are a little bit faster, but then I can't use transparencies). 20 fps really isn't that bad - it's a little bit choppy, but not really that noticeable. It still plays perfectly fine. I'm pretty sure I could get a lot better with hardware acceleration though.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS