Jump to content
  • Advertisement


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


my 2D graphics engine - am I doing this fundimentally wrong?

This topic is 5725 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, Sorry if this is somewhat vague.. This is my first graphical game, a 2D RPG that you can play online (NOT massive multiplayer blah blah): Screenshot Currently, all the graphics you see on the pic are stored in a giant linked-list which sorts them by Z-plane order (sprites are also sub-sorted by Y position if they are on the same plane). Each game cycle I just iterate through the list and draw everything that falls within view of where the character is standing. I get about 160+ fps on my system, 1400mhz/512ram/Radeon, but obviously this drops way down to 30 or less on lower end systems.. Is this fine or should I be checking to see if only parts of the screen should be updated - IE not blitting the menus unless they change, etc? Any suggestions would be very appreciated! Ty Edit: I R not good at links! [edited by - tls284 on October 21, 2002 8:53:09 PM] [edited by - tls284 on October 21, 2002 8:53:33 PM]

Share this post

Link to post
Share on other sites
Well, it depends. How big is your world? And do you load EVERYTHING and iterate through that list or do you separate things into what could be considered different ''levels''? A room in a building could be considered a level. Same with the outdoors.

If you separate the game so that there are different portals between the levels and don''t load every single one, that would be one solution. Another would be to use a two dimensional array that keeps track of the map coordinates with the array locations. Then, use a shifting point to determine what should be drawn and what should not be. It''s possible that your algorithm to blit isn''t as efficient as it could be.

ex: int map[1000][1000];
int upperLeftX,upperLeftY;

int x = upperLeftX;
for( x;x < upperLeftX +20;x++)


you get the idea. That would blit the topmost row of tiles. Just write a loop to do the same thing for the next row. Your map keeps track of what goes where. Your loop decides what gets blitted. You could use a list just as easily. I don''t think I''d use a single long list though.

Heh... you could use a list of lists to dynamically resize it.

Looking for an honest video game publisher? Visit www.gamethoughts.com

Share this post

Link to post
Share on other sites
I'd love to see some replies in this thead as well (thanks mtaber). I had done the same thing that tls284 did in a previous 2D engine I made. I planned on looking at the problem of sorting sprites in a tilebased engine again when I started my next project. Is there a better way to sort everything so that it can be drawn in the proper order?

edit - damn typos


[edited by - Big Sassy on October 22, 2002 1:24:12 AM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!