Thread: advantages of tile-based engine...

  1. #16
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    ff, I'll show you how to do more than that

    All you have to do is gently...lol...jk

    Ok, I do use photoshop, and all I use is a couple filters here and there. I, also, try to seperate parts of the image to emboss parts of the picture bc thats how you do it in PS...here is an example of a beach. Tell me what you think of this one. I can make tiles pretty good, imo, and I'm willing to give out basically any tile to anyone who wants them...just ask (ewwww I'm a tile slut...I feel used)

  2. #17
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    Sry for posting so many pictures, but here is a tile of some lush looking grass. I'd have to say that the jpg versions are really making these pics look non-good as opposed to them looking better in bmp format. Ok, have a look see.

  3. #18
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Also, instead of making graphics for when dave is facing left or right, all you do is make the graphics for when dave is facing one direction. Then in your code you flip the character by using draw_sprite_h_flip when you need the character to face the opposite direction. For example, have dave face right in all the graphics then use draw_sprite_h_flip when dave needs to face left. This is much more efficient, imo.

    I disagree. Since memory is no longer a major constraint in computers, having a paint program flip the image for you and include the new image with your master image(s) bank is better. It is much faster to blit an image as is than to flip it "on the fly"

    Also there are some inherent problems in the tiles. The ocean tile is not symmetrical meaning that if you tile it you will most certainly see where each tile begins and ends. I've not checked the other tiles.

  4. #19
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    Bubba, I only say to flip it instead of a regular blit is because many times it's better to have a smaller file size for your program. Having a larger file size may detract people from downloading your program, and using a flip isn't much of a fps loss, either. Then again with Allegro you can use the Grabber, so file size typically isn't much of a concern when it comes to the graphics. I think you may be right on this one, but I guess it may just come down to a matter of taste.

  5. #20
    Registered User Ace Bowers's Avatar
    Join Date
    Jul 2003
    Posts
    23
    I had Allegro and I have no idea what the grabber does, could someone explain (if they're bored because it doesn't really matter any more), also a lot of people have high band width now so download sizes aren't as much of a problem. Last but not least, how can you like change several bitmaps into a single file with the extension of your choice. I've seen a lot of comercial games do this and I always wondered how they did it. Just wondering. Thanks.
    "I have read about a hill in a book, so the hill must exist." -a Christian quote
    "I have not seen this hill, so it must not exist." -an Athiest quote
    "Well, I've heard of this hill, so lets bomb it." -a George Bush quote

  6. #21
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    With the grabber it reads in a file (i.e. bmp) of your choice and however many files you wish to read in. Then after you are done with that you save it all, and Grabber compresses all of the data of the files into one single dat file. It enables you to not have to have so many large files instead you have one small size file. You can read the info that comes along with it if you need to know more.

    My guess on changing the file extensions on file is to create a program that can save it as that file extension. For example, create a program that can read-in a bmp file. Then take all the data of that bmp and save it to another file with a different extension such as pmb. It's not a very complicated process from my understanding.

  7. #22
    Registered User Ace Bowers's Avatar
    Join Date
    Jul 2003
    Posts
    23
    So you can actually use a grabber file to compress them into a dat, but how do you open them. Like normal, or do you need anoth specialized program for that?
    "I have read about a hill in a book, so the hill must exist." -a Christian quote
    "I have not seen this hill, so it must not exist." -an Athiest quote
    "Well, I've heard of this hill, so lets bomb it." -a George Bush quote

  8. #23
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    You create your own file structure and write a 'grabber' to extract info from it.

    For a tile engine you will have several (perhaps hundreds)bitmaps of tiles. It would not be smart to store these individually so you could do something like.

    struct TileHeader
    {
    unsigned int TileID;
    unsigned char *ImageData;
    unsigned int size;
    TileHeader *Next;
    TileHeader *Prev;
    };

    struct TileMap
    {
    TileHeader *TileHeaders;
    int numtiles;
    ...
    };

    Write the TileMap struct to disk which indicates how many tiles are in the map and tracks each of them.

    Then each Tile is written to disk complete with its imagedata. Then when you have reached Tile.size - repeat the process - write the next TileHeader to disk and so on.

    There are better structures but its just an idea to get you started.

  9. #24
    Registered User Ace Bowers's Avatar
    Join Date
    Jul 2003
    Posts
    23
    Thanks, it'll take me a while to figure that out completely, but I think I have the general idea. Now instead of having 100's of bitmaps, I'll end up with 20 .dat files.
    "I have read about a hill in a book, so the hill must exist." -a Christian quote
    "I have not seen this hill, so it must not exist." -an Athiest quote
    "Well, I've heard of this hill, so lets bomb it." -a George Bush quote

  10. #25
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Yes, but again I don't recommend the above structure. Map files really just need to be arrays of numbers which represent which tiles go where. The master image file should have all of the bitmaps for the entire game in one file. The file should be marked as read only - even though this is easy to thwart. Each number in the map would correspond to a certain TileID which would indicate which bitmap goes where. Then at run-time you could re-compile this data into several maps in memory. This is as simple as inserting new bitmaps into the master list or TileMap structure. This can all be done during the load phase. The reason you want to load maps like this is because constantly looking up array indices to find which tile needs to be drawn is slower than simply iterating through a linked list of tiles. The ideal drawing scheme would be to link the tiles from back to front to aid in drawing.

    There are hundreds of other methods and hundreds more you could come up with.

  11. #26
    Registered User Ace Bowers's Avatar
    Join Date
    Jul 2003
    Posts
    23
    Cool, thanks. This isn't really that useful to me now, as I am still learning and have not started my project, but when I get there I'll at least know where to start.
    "I have read about a hill in a book, so the hill must exist." -a Christian quote
    "I have not seen this hill, so it must not exist." -an Athiest quote
    "Well, I've heard of this hill, so lets bomb it." -a George Bush quote

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need testers for editor
    By VirtualAce in forum Game Programming
    Replies: 43
    Last Post: 07-10-2006, 08:00 AM
  2. tile engine view area
    By Punksocko in forum Game Programming
    Replies: 15
    Last Post: 10-26-2005, 10:53 PM
  3. DirectX engine nearing completion
    By VirtualAce in forum Game Programming
    Replies: 2
    Last Post: 01-12-2004, 05:07 PM
  4. Tile Engine Scripting Idea. Suggestions?
    By napkin111 in forum Game Programming
    Replies: 8
    Last Post: 07-28-2003, 02:01 PM
  5. Need lots of help with tile engine
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 06-12-2002, 01:54 AM