12-10-2006, 12:52 PM
That code does not work. It will blit it wrong. Here is the source with it installed. Feel free to try it out. You wont notice a different with the new system. Only a small speed difference.
http://www.key2heaven.net/MSEOptimizeGFXOutput.rar
Investigation To Prove the Optimization
Okay, so imagine this: MAX_MAPX * MAX_MAPY
In the unedited version of MSE, the MAX_MAPX = 15 and the MAX_MAPY = 11.
11*15=165 That value shows us how many tiles that are being blit out all the time from bltTile.
165+165=330 That is the value for both (bltTile and bltFringe) of them. And this happens all the time the GameLoop runs.
So I think that value is pretty high. So we will compare 330 with the new value:
First we have: ' Blit Tile to cover text
That is 1*MAX_MAPX = 15.
After that we have:
The largest range on that code is -2 to 2 which is 4 and we have two loops which makes it 4*4=16.
So far, we have 15+16=31. Thats still below 330.
After that we have the same loop 4 times. Which makes it 16*4=64
Now we have 64+31= 95. Still a lot less than 330.
And for the final, we have one more of that loop. That makes it 95+16= 111.
So the difference is 330-111=219 in difference. Thats pretty much, isn't it?
So, now we need to take into account that the code is a little bit longer, and this might slow it down a tiny bit. So lets say it slows it down with 69.
That still gives us a difference of 150. Which is a very good result.
And the more layers you have of mask and fringe the more it will help. And also for a bigger map, it will help even more!
http://www.key2heaven.net/MSEOptimizeGFXOutput.rar
Investigation To Prove the Optimization
Okay, so imagine this: MAX_MAPX * MAX_MAPY
In the unedited version of MSE, the MAX_MAPX = 15 and the MAX_MAPY = 11.
11*15=165 That value shows us how many tiles that are being blit out all the time from bltTile.
165+165=330 That is the value for both (bltTile and bltFringe) of them. And this happens all the time the GameLoop runs.
So I think that value is pretty high. So we will compare 330 with the new value:
First we have: ' Blit Tile to cover text
That is 1*MAX_MAPX = 15.
After that we have:
Code:
For y = GetPlayerY(MyIndex) - yChange1 To GetPlayerY(MyIndex) + yChange2
For x = GetPlayerX(MyIndex) - xChange1 To GetPlayerX(MyIndex) + xChange2
Call BltTile(x, y)
Next x
Next y
So far, we have 15+16=31. Thats still below 330.
After that we have the same loop 4 times. Which makes it 16*4=64
Now we have 64+31= 95. Still a lot less than 330.
And for the final, we have one more of that loop. That makes it 95+16= 111.
So the difference is 330-111=219 in difference. Thats pretty much, isn't it?
So, now we need to take into account that the code is a little bit longer, and this might slow it down a tiny bit. So lets say it slows it down with 69.
That still gives us a difference of 150. Which is a very good result.

And the more layers you have of mask and fringe the more it will help. And also for a bigger map, it will help even more!