Chaos Project

Game Development => Sea of Code => Topic started by: Ryex on January 14, 2011, 03:34:58 am

Title: Efficient data manipulation
Post by: Ryex on January 14, 2011, 03:34:58 am
lets say I have a grid of numbers the grid is the size of a map and each number identifies a tile id to make the map
now lets assume that I have another grid that represents a brush with the same type of data layout this brush grid dose not have to be the same size as the map grid

I want to transfer the data in the brush grid to the map grid with a given x, y offset

if a way to do this other than iterating through the brush grid and setting the points one by one?

also

rmxp data for the maps is layed out in a single array
where the data at index (x + self.xsize * (y + self.ysize * z))
the sizes refers to the max size of the map

is this a efficient way to lay out the data if I'm going to be modifying it?

basically I'm asking all this because I want to lay out the tiles to be added to the map before they are commited to the map data instead o
Title: Re: Efficient data manipulation
Post by: Blizzard on January 14, 2011, 03:42:35 am
Nope and nope. You can alternatively use a multidimensional array (instead of a one-dimensional array), but you will have to set the data one by one.
Title: Re: Efficient data manipulation
Post by: Ryex on January 14, 2011, 04:36:37 am
ah darn. I was hoping that might be some sort of matrix like operation to do it. no matter iteration will work just fine.
Title: Re: Efficient data manipulation
Post by: Blizzard on January 14, 2011, 05:48:24 am
Even if you used some sort of matrix operation, your CPU will still treat it as a sequence of normal operations.