Storing prefab pieces
#3
That really depends on how we want to store the structures in the C++ source. I was thinking about this way (inspired by the XPM3 format, http://en.wikipedia.org/wiki/X_PixMap#XPM3 ):
static const cPrefab::sDef g_TestPrefabs[] =
{
	{
		8, 4, 8,  // SizeX = 8, SizeY = 4, SizeZ = 8
		"A:1:0;"  /* E_BLOCK_STONE */ \
		"B:0:0;"  /* E_BLOCK_AIR */ ,
		
		// Level 0:
		"AAAAAAAA" \
		"ABBBBBBA" \
		"ABBBBBBA" \
		"ABBBBBBA" \
		"ABBBBBBA" \
		"ABBBBBBA" \
		"ABBBBBBA" \
		"AAAAAAAA" \

		// Level 1:
		"AAAAAAAA" \
		"AAAAAAAA" \
		"AABBBBAA" \
		"AABBBBAA" \
		"AABBBBAA" \
		"AABBBBAA" \
		"AAAAAAAA" \
		"AAAAAAAA" \

		// Level 2:
		"BBBBBBBB" \
		"BAAAAAAB" \
		"BAAAAAAB" \
		"BAABBAAB" \
		"BAABBAAB" \
		"BAAAAAAB" \
		"BAAAAAAB" \
		"BBBBBBBB" \

		// Level 3:
		"BBBBBBBB" \
		"BBBBBBBB" \
		"BBAAAABB" \
		"BBAAAABB" \
		"BBAAAABB" \
		"BBAAAABB" \
		"BBBBBBBB" \
		"BBBBBBBB" \
	},
	// Another prefab here
};
This could be fully automated by an export plugin accompanying the Gallery plugin, and it is also somewhat human-readable, so it could be tweaked in-source if needed.

This format would require an additional RAM of about 1 byte per block stored, so a 10x20x10 structure would need ~2 KB. To give some perspective to that, most our houses in the Gallery are about 10 x 6 x 10 on average, consider some 20 different houses, that amounts to (20 * 10 * 6 * 10 = ) 120 KB extra RAM consumed (and diskspace as well, by the MCS executable). Multiply by some generous 5 village types, it's 600 KB, still acceptable.

Come think of it, we could do both - have some structures built in and later add the possibility for the generator to load structures externally.
Reply
Thanks given by:


Messages In This Thread
Storing prefab pieces - by xoft - 03-12-2014, 09:42 PM
RE: Storing prefab pieces - by NiLSPACE - 03-12-2014, 10:29 PM
RE: Storing prefab pieces - by xoft - 03-12-2014, 11:24 PM
RE: Storing prefab pieces - by NiLSPACE - 03-12-2014, 11:38 PM
RE: Storing prefab pieces - by tigerw - 03-13-2014, 03:49 AM
RE: Storing prefab pieces - by SamJBarney - 03-13-2014, 03:55 AM
RE: Storing prefab pieces - by tigerw - 03-13-2014, 05:25 AM
RE: Storing prefab pieces - by worktycho - 03-14-2014, 03:50 AM
RE: Storing prefab pieces - by SamJBarney - 03-14-2014, 06:53 AM
RE: Storing prefab pieces - by xoft - 03-14-2014, 07:39 AM
RE: Storing prefab pieces - by worktycho - 03-14-2014, 08:18 AM
RE: Storing prefab pieces - by xoft - 03-14-2014, 04:35 PM
RE: Storing prefab pieces - by worktycho - 03-14-2014, 09:37 PM
RE: Storing prefab pieces - by xoft - 03-14-2014, 09:42 PM
RE: Storing prefab pieces - by worktycho - 03-14-2014, 10:00 PM
RE: Storing prefab pieces - by xoft - 03-14-2014, 10:47 PM
RE: Storing prefab pieces - by worktycho - 03-14-2014, 10:52 PM



Users browsing this thread: 1 Guest(s)