![]() |
Optimize MAX_ Looping - Printable Version +- Mirage Source (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49) +---- Thread: Optimize MAX_ Looping (/showthread.php?tid=504) |
Optimize MAX_ Looping - William - 20-12-2006 Tutorial is not yet Finished By: William Difficulty: 2/5 Introduction This will make the looping smaller for all of your MAX_ (ex. MAX_MAPS, MAX_ITEMS...). So instead of looping from 1 to 1000, maybe you only have 50edited maps, then it will loop from 1 to 50 instead. Of course, if you are making your own game using a source, you can simply choose your own MAX value, and you can probably do that for a engine too. But anyway, I'll make this tutorial for all of you anyway. This is recommended for engines, since the users of the engine doesn't really consider the MAX and often has it on 1000. Which means 1000 loops for probably around 30maps for example. Server Side First of all, open frmServer and go into Private Sub Form_load() At the bottom of that sub, add: Code: Call SetHighMaxMap Code: Public Sub SetHighMaxMap() Code: Sub SaveMaps() Under Construction - Bradyok - 15-01-2007 In most games i've seen, if they have say 1000 maps, and only use 50 of them, they still usually put a map at #1000, thus rendering this useless. Reguardless, this is a still a good tutorial. - Obsidian - 15-01-2007 Just to point out, you don't have to use Get, , HighMap(i) You can just keep using your normal Map(i), so you don't have to point another variable at the maprec... Same with the tile part. It may also be better... to do this by the 'Revision' variable from the maprec. When maps are cleared... it is automatically set to 0. It doesn't increase unless someone edits the map... - William - 16-01-2007 NOt going to complete the tutorial, you get a hint from whats there now. ANd this sisnt really a good way. - Matt - 16-01-2007 If it isn't a good method, then why keep the tut at all? - Spodi - 16-01-2007 Since it is bad practice in the first place to just jump numbers like that, and good coding/designing practice goes hand-in-hand with fast code? :wink: - William - 16-01-2007 Advocate Wrote:If it isn't a good method, then why keep the tut at all?It's like high_index, it decreases the numbers of loops. But still it doesn't help much. Spodi Wrote:Since it is bad practice in the first place to just jump numbers like that, and good coding/designing practice goes hand-in-hand with fast code? :wink:Dont understand what you mean ![]() - Spodi - 16-01-2007 Well what I mean is that you can't write well optimizations if the code is used poorly. For example, there is absolutely no point in skipping around the index of maps and leaving indexes open. Yeah you may want to sort your maps, but do that somewhere else - keep a document of the index, map name and description or whatever, since leaving 100 indexes open between maps "because you might use it later" is just dumb. William has the right idea on using the high index instead of the max index. This also prevents you from even having to specify a max maps value, since the high index does it for you. - William - 16-01-2007 Spodi Wrote:Well what I mean is that you can't write well optimizations if the code is used poorly. For example, there is absolutely no point in skipping around the index of maps and leaving indexes open. Yeah you may want to sort your maps, but do that somewhere else - keep a document of the index, map name and description or whatever, since leaving 100 indexes open between maps "because you might use it later" is just dumb. William has the right idea on using the high index instead of the max index. This also prevents you from even having to specify a max maps value, since the high index does it for you.Yes, very true. I would not add this to a game, since you have full control over the MAX_, instead it could be added for a engine, since the users are lazy when it comes to decide the max values. |