• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

granat

How to render 2-3 layers of tiles...

14 posts in this topic

Hi everybody! I''m trying to make a platform type of game with 2-3 layers of tiles in DirectX. With up to 3 layers I fear I will waste to much time rendering tiles on top of each other. Should I try to optimize my drawing code by making sure that no pixel is drawn twice ? This is just so much work and will there be any speed gains ? I mean isn''t it slow to render the entire screen pixel by pixel for each layer checking if pixel has been set by a higher layer ? Is writing pixels "manually" to the screen slow ? What about hardware-acceleration? Hope anyone can help me with this problem..
0

Share this post


Link to post
Share on other sites
I would recommend using directx blitters, because they use hardware acceleration (if there is any) and that''s many times faster.
0

Share this post


Link to post
Share on other sites
Okay, let''s figure this out... I ran a small program that displayed a 50x50 grid to the screen. That''s 2500 tiles. When I tested the frame rate, it showed as about 60 fps. That''s including processing (which wasn''t very much to decrease the fps, but processing time is usually minimal compared to a blit or frame refresh). So lets assume you blit 5000 tiles and/or sprites, which would also include other objects, buildings, or trees, and at the very worst, you''ll experience half the frame rate, which is 30fps. 30fps is more than enough to run a good game, so unless you''re planning on thousands upon thousands of blits, then you can worry. So don''t sweat it. Just blit everything you want and more than likely you''ll be just fine.

-John
0

Share this post


Link to post
Share on other sites
The fact that it was 60fps sounds to me like it was probably tied to refresh rate, which means you probably had loads of clock cycles going spare aswell, so you could actually have many more tiles (blits) or more room for game logic and AI etc
0

Share this post


Link to post
Share on other sites

First of all. Thank you for your answers..

I think I will try blitting everything. Later I might try to optimize a little bit (very little). If a tile would be completely covered by other tiles I would not blit it. That sort of optimization is easier to handle than doing it pixel by pixel..(I hate optimizations, the gameplay is the fun part of a game I think)..

By the way. The resolution of the game is to be 640x480 (16/32 bit). Maybe 32 bit because i don´t want to mess around with pixel formats if I can avoid it.

Most importantly I want the game to run on a 233 mhz Pentium.

Thanks again guys... :)
0

Share this post


Link to post
Share on other sites
I love to optimize! I get more enjoyment from optimizing a function then adding another cannon to the game.
0

Share this post


Link to post
Share on other sites


The difference is probably that I´m result-orientated and you are process-orentated.
If I can´t see some progress visually I loose my motivation very quickly.

And sadly (I think) I´ve never liked to code just for the sake of coding. "Sadly" because your attitude most likely makes you a better coder than me.

I will shut up for now...I have a game to make.....OH NO I FORGOT !!!!!! I´m at work!!!! DAMN!!!!!!!!

FACT: Polar-bears do not live in Denmark.

0

Share this post


Link to post
Share on other sites
Hi Granat I have a question for you. When you say 2-3 levels of tile do you mean that from the 3rd level you can see the second levl and so on. Cause I''m also looking at making a game that has many levels, like if you go on top of a building you can see the street and the people moveing on it. Just wondering if you working on something like that too:-).
0

Share this post


Link to post
Share on other sites

Yeah something like that I think. (but you weren´t too specific).

I´m going to have a character jump around some platforms. The platforms are the top level and then I have 1 or 2 layers of tiles behind that which move slower to give a sense of depth/3d.


FACT: There IS something rotten in the state of Denmark!




0

Share this post


Link to post
Share on other sites
In Artifact, I blit the main map in this sequence:

1. Base-terrain graphics
2. Base-level transitions (below roads)
3. Roads
4. Top-level terrain transitions (above roads)
5. Structures (facilities and walls)
6. Overgrowth for walls
7. Facility details
8. Cities
9. Fog of war
10. Map markers
11. Military Units

And then on top of that, I put stuff like path tracing or player chatter/game messages.

I don''t even use DirectX. I use CreateDIBSection. Each "layer" is done for the entire visible map, and I completely regenerate the whole thing for every frame.

I generally see 20+ frames per second on any 266+ MHz PC, and I have players playing on their Pentium 75 getting 10+ frames per second (which is quite playable, if not great-looking). The frame rate is almost regardless of the resolution, but slower PCs tend to see their rates drop noticeably if they run the game at 1024x768.


DavidRM
Samu Games
0

Share this post


Link to post
Share on other sites

I just looked at your Artifact homepage. It seems to me that that Artifact is a type of game which does not rely on fast framerate.
But an actiongame like a platform game the framerate can mean either success or failure when trying to do precision jumps.

20+ frames on a 266 mhz pentium ? I would say that for a platform game it should be at least 30 frames. Maybe thats too optimistic ?
BTW your "entire visible map" is not that big is it ?Because you use a lot of space for other stuff. But it sure sounds like you blit like a madman

I just discovered this site recently.. BOY DO I LIKE IT!!
People actually answer my posts....GAMEDEV Rules !!!!

0

Share this post


Link to post
Share on other sites
Thanks for checking out the game.

No, I don''t need "monster" frame rates. I was just pointing out that I do actually get decent framerates...even with all that blitting and *without* using DirectX. If you just looked at the screen shots, BTW, a quick caveat: Those are made at the 640x480 size to keep them small. It''s possible to run the game maximized at 1024x768 (and a number of players do...they like all the extra visible map).

So if you use DirectDraw and judicious use of video RAM, you should be able to achieve the results you want.

Today''s PCs can do a simply incredible amount of processing in what seems an impossibly short time. Take advantage of it. =)

Welcome to GameDev, BTW.


DavidRM
Samu Games
0

Share this post


Link to post
Share on other sites
In response to your first question, it is completely possible to get fast frame rates using multiple layers. Just design the maps where there is no overdraw. If a tile completely obscures another, then just don''t draw that obscured tile. There''s no coding secrets like pixel-by-pixel checking. Just regular blits will do.

Another thing - you realistically only need to draw one layer, and as you''re drawing it, scan to see if any tiles exist on layers above it. Flag that and when it comes to draw that layer, use a faster method since you already know which sections have, and don''t have, tiles to blit.

If you check out our old TLB demo at my page, it''s only 640x480x8, doesn''t use DirectDraw on tile drawing, and it has 8 layers at certain parts, and it flys.



Jim Adams
Game-Designer/Author
tcm@pobox.com
http://www.lightbefallen.com
http://basicelectronics.com
0

Share this post


Link to post
Share on other sites
Actually... You would have to draw all the layers one over another in the right order. You cant skip the base layer and draw an object over it for one reason. Obviosly your objects arent all blocks so you will need transparency. That means youll have to draw all the layers completely, you can''t have a chair with no floor below it. =)

-Bryan
0

Share this post


Link to post
Share on other sites
Maybe I didn''t make myself clear there - you only need to process a complete layer (the first), which usually has at least one tile per map section. During that first layer scan, you''d setup pointers to where the tiles are on the above layers, thus saving the need to scan every single layer looking for something to draw.

Hence, it would tremendously increase the speed at which you render multiple layers...




Jim Adams
Game-Designer/Author
tcm@pobox.com
http://www.lightbefallen.com
http://www.basicelectronics.com
0

Share this post


Link to post
Share on other sites