Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Please Help! (I have no clue what the problem is) - DBC

Author
Message
UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 4th Oct 2005 21:23 Edited at: 9th Oct 2005 20:33
I don't know why, but whenever I run this code with DBC it only shows the image I loaded and freezes.

I'm trying to load a map and use the pixels in it to make an array for the map of the game, but it isn't working. Please Help!

Green Bunnies rule!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 4th Oct 2005 22:06
Put some PRINT commands in your loop to see how fast it's going. You might soon realise it's just taking a while to do what you're asking of it.

A SELECT would be more efficient than 7 IFs

UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 4th Oct 2005 23:43 Edited at: 9th Oct 2005 20:34
Yea, it is going slowly, only 3 cycles per second! What should I do?

And 5 on sync rate 0!

Green Bunnies rule!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 5th Oct 2005 01:08 Edited at: 5th Oct 2005 01:10
When you say 'cycles', do you mean frames per second (fps)?

I ask because I wondered how you knew as there's no printing to the screen of the fps. I assume that this is only a small section of a bigger program...

Quote: "it only shows the image I loaded and freezes"


Are you sure that it freezes? How long did you give it, because the POINT function is one of the slowest in DB and takes an age to do. I answered a post the other day for someone with a very similar problem and supplied some code to do it a different way.

I would have suggested using Sync, but you say you've tried that.

When it freezes, what happens when you press the Esc key?

If the CLI appears, try typing Print Y and Print X. If they print values, you can at least see how far through the loop it's getting.

My initial instinct is that it's probably working through the loops, but very slowly.

Also, you could try putting Set Display Mode 800,600,16 at the start of the program. Is the screen mode you are using big enough for the image you are loading?

Also, put the Sync On back into the snippet with Sync Rate 0 like you tried before and put a Sync on the line immediately after Next Y.

Finally, you could try replacing the mapsize(level) in both For lines to 64 to see if that's what's causing the problem.

Try all of them and let us know how you get on.

TDK_Man

UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 5th Oct 2005 14:57 Edited at: 9th Oct 2005 20:34
-I am using cycle for every time it goes around the For-next loop. Before, I thought it was frozen because it wasen't doing anything, but when I put a print command in the for-next loop, I found out that it wasen't frozen, it was just going really slowly. I made it print x, and y in the loop and it was only printing 3 times per second. That's what I meant by cycles.
-Since it is not frozen, it quits when I press esc.
-Yes, the display mode is big enough. The map picture is only 64*64 pixels.
-I will try adding sync after next y after I get home.

Is there a way to load the map without using point since it is slow?

I will try some of the suggestions when I get home.

Green Bunnies rule!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 5th Oct 2005 15:16
If you have DB enhanced (1.13), it would be quicker to put the image in a memblock, and query it that way. Look in the last newsletter for information on how to read image memblocks.

TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 5th Oct 2005 16:15
If you don't have the enhanced version of DBC, or are not familiar with memblocks, the code at the end of the following post does pretty much what you are after.

http://forum.thegamecreators.com/?m=forum_view&t=60983&b=10

I've not tried the memblock way with DBC, so I don't know if it's faster than the method I use, but compared with the load/display/point method either will be incredibly fast!

TDK_Man

UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 5th Oct 2005 22:45 Edited at: 9th Oct 2005 20:34
Ok, I have no clue what a memblock is, so I will use the code that loads it directly from the bitmap until I feel like figuring out the memblock thing.

Thanks.

I have not tried it yet because I am sick and I am not allowed to use the computer for very long. I will post what happens when I can.

Green Bunnies rule!
UFOs other account lol
19
Years of Service
User Offline
Joined: 3rd Jun 2005
Location: Somewhere :)
Posted: 9th Oct 2005 01:36 Edited at: 9th Oct 2005 20:34
Yay! It works! No more help needed.

Thanks

Green Bunnies rule!

Login to post a reply

Server time is: 2024-11-27 16:41:24
Your offset time is: 2024-11-27 16:41:24