• Advertisement

Archived

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

Fast bitmap loading

This topic is 5996 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 ^_^. I wanted to load bitmaps fast on an already existing offscreen surface (with directdraw 7). It''s working now but it''s not really fast. Anyone knows a good way to do this? And is there a (big) speed difference between loading bmp/gif/jpeg/png etc.? Thanks ^_^

Share this post


Link to post
Share on other sites
Advertisement
While there always ways to do something a little faster loading
images tends to take time. Thats what every game is doing
while you are staring at a load screen. The best way to load
things will kinda depend on your current need. Talk abit more
about what you are doing and what you need. Sometimes its
posible to load parts of what you need and finnish after you''ve
started things running to give the illusion of a speedy load time
but that may not be possible in your case. Maby your loading
more than you need at the time. Like I said talk more about
what your doing and someone may have a good idea as to a better
aproach. Ultimatly your just moving data around and there may
be little more you can do that hasn''t already been done. You
job is to find the best order to move the data for your program.

Share this post


Link to post
Share on other sites
ok, I''ll explain some more ^_^.

I am sorta ''copying'' the graal online engine (but then offline ^_^) just as a practice (I''m practicing c++/directdraw). In graalonline you can have alot of people (that would be npc''s in an offline version) on the screen the same tile, all with different heads/bodies/swords/shields. Now I was wondering on how''d they do that

Share this post


Link to post
Share on other sites
File I/O no matter which format is going to be slow. Any file formats which use compression will take even longer to load (I.E Jpeg, and PNG). The only way you can "Speed things up" for the end user is to stream the data in while other things are going on for instance while your title screen is showing you could be slowly loading in your bitmap data with out their knowledge.

Share this post


Link to post
Share on other sites
I haven''t seen the game you are refering to but if I understand
the need correctly my guess is they are loading all the individual
pieces and using them to build a range of characters. Sort of
like using a few tiles to create varied maps, or building with legos.
Even it thats not what they did you could. It would be alot tricker animation to start with if you''ve havent done much yet.
There are probably a few ways to do this and I probably can only
give you an idea to start with but I''m sure someone else can
give you a great way of doing it. You might need standard way
points for each item type. Say shield always apear in this location.
Helmets always start here. That sort of thing. You may need
to tweek it alot to make sure things dont look disjointed but
I''m sure its more than posible. Seams like a solid idea for
creating skads of chars. Hell you could even randomly generate
new ones without haveing to make them yourself. Sega made
a game called cyborg justice. You could make up to like 200+
robots by picking a body, arms, and legs. And even during game
play could rip of parts of other robots an make yourself into
a new bot. Basicly what I''m talking about. You might see about
tring to get a look at it. It''s cheeeeep at any retro game store
or you may be able to find a gen. emulator and the rom on the net.
I did. Hope that gives you some direction.

Share this post


Link to post
Share on other sites
There is an alike topic - allready posted by Paradigm Shift 2000. Please pos your replies there, so we can get a discussion ongoing

-------------
E-)mil
http://eej.dk

- Just another crazy dane

Share this post


Link to post
Share on other sites
If I found the right post this is not the same topic. Thats
a tech post about how to code the loading of a bitmap onto
a DD surface. This a "How did they do that." Besides
Usako ask a question and it should get some responses.

Share this post


Link to post
Share on other sites
I can already draw people in my game, it''s just not very fast (if I load the bmp''s directly) and I wondered on how''d they do that ^_^.

Anyway, here''s a screenshot of the game:

http://www.graalclassic.com/site/screenshots/shot1001.gif

And in graal they use gifs and png''s for the pictures and it''s quite fast

Share this post


Link to post
Share on other sites
Loading a bitmap has nothing todo with drawing it.
And with that said, if drawing your bitmaps is to slow, then something very oddish is going on, if you reading this realize that you load the bitmap everytime you draw it then reread what i wrote first in this message.

Share this post


Link to post
Share on other sites
Hey that thing looks cool! This is the game you are trin''
to recreate right? anyway, DigitalDelusion is right. If you
are having trouble with displaying images durring runtime something
is horribly wrong. Like he said make sure you are not loading
as you go along. Preload everything you are going to need at
a moments notice. Unless you have a very slow machine you souldn''t
be noticing any slowdowns with bliting this early on. If you
havent already make sure you take the time to go through all
of the articles and resources here do so. If there is something
you dont get there are plenty of people to help you sort it out.
Right now it is sounding like you are rushing a bit. Tring to
do something that you dont have a complete grasp on yet. The basics
the load logic shoul look something like this.

1.figure out what images I will need for now. This level or whatever
2.Load these images from disk to DirectDraw surfaces.
3.Keep Them There! Dont release something until you know you
know have no more use for it.

U will do most of you loading and dumping of images before and
after the program starts. I hope this isn''t stuff you already
knew and I''ve just insulted your inteligence or anything but
I''m not sure right now where you are having the actual problem.
anyway good luck.

Share this post


Link to post
Share on other sites
^_^

The problem is not the drawing itself (I have the tile blitting engine and all the stuff like collision detection running and running fast here).

I only am wondering on how to load and draw hundreds of always changing little pictures (a few hundred heads, a few body''s, lotse different swords etc.). In that graalonline game you can have like (I think) 40 different people on the screen at once, all with different heads/swords/bodies etc. Now I want to know a good way to do that without getting slow (not the drawing of the people but the storing of all those images in memory).

...damn, I''m not very clear I think ^^

Share this post


Link to post
Share on other sites
Either create a surface for every head body sword etc... this will eat up tons of video mem because of alignement issues and will be a horrible beast to maintain. OR go with the tilebased approach, If you already have the tileengine running then this shouldnt be a big step, just picture the characters as beeing multilayerd tiles and draw them that way, if you have 40 ppl onscreen and they all need shoes body and head that will amount to about the same as 120 tiles your engine should be able to handle that without slowing down.

Share this post


Link to post
Share on other sites
Also it could be an idea to use some sort of smart container so that you don''t load every head there is, when only a couple are needed. The way you can do this is to have a gfx manager (prolly a class) using some kind of hashtable and you tell it that you want the number for head166.gif and it gives it to you or loads it assigns a number to it and gives it to you, when you want to draw you just either tell it to draw head number X somewhere on the screen, or you have it return a pointer to a surface containing the gfx and a rect to blit from, much as you would implement a tileset class, and Im guessing you already have one of this in one form or another

Share this post


Link to post
Share on other sites
I think I know what you''re asking... You want to know how to shift bitmaps into and out of memory as you need them, because loading all of the bitmaps at once would use lots of memory. I was thinking about a couple ways of doing this recently, but the problem with this approach, I think, is that constantly thrashing bitmaps will really slow the game down. So, is there any way do this and still have a game at a playable speed? I''ve been reading about bitmap managers which pre-load a certain number of bitmaps, and take a reference count of each bitmap on the screen each frame to see which bitmaps are used most often. The ones that are displayed least often get flushed and replaced with ones that are used most often so that the video-memory always holds a the most-used bitmaps and the system memory always holds the least-used bitmaps. Blits on the average will be faster because more blits are being done per frame from the video memory than from system memory. I don''t know if that helps or not, but it''s something to think about.

Paradigm Shift 2000

Share this post


Link to post
Share on other sites

  • Advertisement