Arrays of TLists Storing Data for Tiles in Rpg ?
BlitzMax Forums/BlitzMax Programming/Arrays of TLists Storing Data for Tiles in Rpg ?
| ||
Ive been working on a rpg battle system for some time now while waiting for the 3dmodule but finally I am at point where the engine needs a visual touch for tweaking and timing. I have settled for a subdivision method for levels in a structure as follows Map>Continent>Country>Region>City>Area>Sector>Grid Im going to use linked lists in a array format so i can move ,remove ,create areas and add them to the list at any time during the game here is the test code Just wondering if anybody knows of a better way of doing this code or a faster method |
| ||
your main hangup is in the creation of the lists, if I do the following:Local Start:Int = MilliSecs() Area.create(27,100,2000) Print MilliSecs()-Startit takes about 6900ms to complete this step. adding flushmem inside the creation loop reduces this to 51ms Method Set_List_Array(_SX,_SY) Sector_List=Sector_List[.._SX] For X=0 To _SX-1 Sector_List:TList[x]=CreateList() For Y=0 To _SY-1 Local Newsect:Sector=Sector.create(Y) ListAddLast Sector_List[x],Newsect Next FlushMem '<!----- Add flushmem here Next End Method |
| ||
Thanks m8 that looks like it will do the trick :) |
| ||
Until auto flushmem in the next update. |