reading tile data problem

Blitz3D Forums/Blitz3D Programming/reading tile data problem

AvestheFox(Posted 2011) [#1]
Okay, so I have my tile based system set up in such a way that certain tile data is read from a file before its drawn to the map. The system works but the problem is that it takes six to seven seconds for it to finish reading the data and then render it to the screen. How can I make this any faster?

code below is from a map editor for my game. I have the program read the data from the data file and plug them into a dummy tileset which then in turn plugs the data into the real tileset. I know it sounds kind of redundant but why I have it like that is for experimental reasons. So never-mind it ;)I just want to make this system somehow faster.

Setup tiles function:


Read tile data function:



Graythe(Posted 2011) [#2]
Use ReadBytes to preload data to memorybank(s).


AvestheFox(Posted 2011) [#3]
the data is saved as integers though. can I still load it with readbytes? I'm still kinda new to the file reading bit so forgive me if that's a silly question :P


AvestheFox(Posted 2011) [#4]
nevermind, I think I've figured out this bank thingy. lol :P

i think...


Graythe(Posted 2011) [#5]
It will work :) Each integer value will occupy 4 bytes of memory.


AvestheFox(Posted 2011) [#6]
okay, here's what I have so far:



again, it works but it takes around 8 seconds to load and render. :P what am I doing wrong?


AvestheFox(Posted 2011) [#7]
never-mind, I got it fixed :)

I was calling the function from within a certain loop where it should not had been. It loads perfectly now!

thanks for the help Graythe!


Graythe(Posted 2011) [#8]
Glad it's doing what you want ;)