Cuberite Forum
Android tests - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: Android tests (/thread-530.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24


RE: Android tests - FakeTruth - 11-12-2012

int Sections = a_NBT.FindChildByName(Level, "Sections");
returns -1 in cWSSAnvil::LoadChunkFromNBT that's what's causing the chunks to be regenerated. I have no idea why it returns -1 though...

I used NBTExplorer to check the anvil files created by Android, and it seems there are no "Sections" in there :/ wtf


RE: Android tests - xoft - 11-12-2012

No idea about that. Can the Anvil files be parsed normally at all, or are they mis-formed?
If they parse, why arent Sections there? Aren't they being written? Maybe some endianness problem?


RE: Android tests - FakeTruth - 11-17-2012

Curious, I added a buttload of extra values to be added to each chunk.
	a_Writer.AddString("TestString", "o hai I\'m string");
	a_Writer.AddDouble("TestDouble", 1.23);
	a_Writer.AddFloat("TestFloat", 1.23f);
	a_Writer.AddInt("TestInt", 2);
	a_Writer.AddLong("TestLong", 1234);
	a_Writer.AddShort("TestShort", 1234);
	a_Writer.AddByte("TestByte", 34);

When I add this piece of code BEFORE the Sections list it is added it shows up in the file, but if I add it AFTERwards it is nowhere to be found. It seems the Sections list breaks something...


RE: Android tests - xoft - 11-17-2012

Try adding an IntArray before the Section. I'm suspecting a breakage there.


RE: Android tests - FakeTruth - 11-17-2012

Actually it seems to screw up after the Biome data

	a_Writer.BeginCompound("Level");
	a_Writer.AddInt("xPos", a_Chunk.m_ChunkX);
	a_Writer.AddInt("zPos", a_Chunk.m_ChunkZ);
	cNBTChunkSerializer Serializer(a_Writer);
	if (!m_World->GetChunkData(a_Chunk.m_ChunkX, a_Chunk.m_ChunkY, a_Chunk.m_ChunkZ, Serializer))
	{
		return false;
	}
	Serializer.Finish();  // Close NBT tags

	a_Writer.AddString("TestString1", "o hai I\'m string");
	a_Writer.AddDouble("TestDouble1", 1.23);
	a_Writer.AddFloat("TestFloat1", 1.23f);
	a_Writer.AddInt("TestInt1", 2);
	a_Writer.AddLong("TestLong1", 1234);
	a_Writer.AddShort("TestShort1", 1234);
	a_Writer.AddByte("TestByte1", 34);

	// Save biomes, both MCS (IntArray) and MC-vanilla (ByteArray):
	if (Serializer.m_BiomesAreValid)
	{
		a_Writer.AddByteArray("Biomes",    (const char *)(Serializer.m_VanillaBiomes), ARRAYCOUNT(Serializer.m_VanillaBiomes));
		a_Writer.AddIntArray ("MCSBiomes", (const int *)(Serializer.m_Biomes),         ARRAYCOUNT(Serializer.m_Biomes));
	}

	a_Writer.AddString("TestString2", "o hai I\'m string");
	a_Writer.AddDouble("TestDouble2", 1.23);
	a_Writer.AddFloat("TestFloat2", 1.23f);
	a_Writer.AddInt("TestInt2", 2);
	a_Writer.AddLong("TestLong2", 1234);
	a_Writer.AddShort("TestShort2", 1234);
	a_Writer.AddByte("TestByte2", 34);

	a_Writer.AddIntArray("TestIntArray", (const int *)Serializer.m_Biomes, 2);
	// Save blockdata:
	a_Writer.BeginList("Sections", TAG_Compound);
	int SliceSizeBlock  = cChunkDef::Width * cChunkDef::Width * 16;
	int SliceSizeNibble = SliceSizeBlock / 2;
	const char * BlockTypes    = (const char *)(Serializer.m_BlockTypes);
	const char * BlockMetas    = (const char *)(Serializer.m_BlockMetas);
	const char * BlockLight    = (const char *)(Serializer.m_BlockLight);
	const char * BlockSkyLight = (const char *)(Serializer.m_BlockSkyLight);
	a_Writer.AddIntArray("TestIntArray2", (const int *)Serializer.m_Biomes, 2);
	for (int Y = 0; Y < 16; Y++)
	{
		a_Writer.BeginCompound("");
		a_Writer.AddByteArray("Blocks",     BlockTypes    + Y * SliceSizeBlock,  SliceSizeBlock);
		a_Writer.AddByteArray("Data",       BlockMetas    + Y * SliceSizeNibble, SliceSizeNibble);
		a_Writer.AddByteArray("SkyLight",   BlockSkyLight + Y * SliceSizeNibble, SliceSizeNibble);
		a_Writer.AddByteArray("BlockLight", BlockLight    + Y * SliceSizeNibble, SliceSizeNibble);
		a_Writer.AddByte("Y", (unsigned char)Y);
		a_Writer.EndCompound();
	}
	a_Writer.EndList();  // "Sections"

	a_Writer.AddIntArray("TestIntArray3", (const int *)Serializer.m_Biomes, 2);

	a_Writer.AddString("TestString3", "o hai I\'m string");
	a_Writer.AddDouble("TestDouble3", 1.23);
	a_Writer.AddFloat("TestFloat3", 1.23f);
	a_Writer.AddInt("TestInt3", 2);
	a_Writer.AddLong("TestLong3", 1234);
	a_Writer.AddShort("TestShort3", 1234);
	a_Writer.AddByte("TestByte3", 34);

	// Store the information that the lighting is valid. 
	// For compatibility reason, the default is "invalid" (missing) - this means older data is re-lighted upon loading.
	if (Serializer.IsLightValid())
	{
		a_Writer.AddByte("MCSIsLightValid", 1);
	}
	
	a_Writer.EndCompound();  // "Level"

Gives this:
[Image: ruxiyc.png]


RE: Android tests - xoft - 11-17-2012

The last thing that is written seems to be an IntArray - as I predicted Wink
Wasn't cFastNBTWriter::AddIntArray() the function that was failing? It might still be failing, but now in a different sense Wink
Ah, of course!

Code:
#if defined(ANDROID_NDK)
    // THIS NEEDS TO GO AWAY: m_Result.append(a_NumElements * 4, (char)0);
    for (size_t i = 0; i < a_NumElements; i++)
    {
        int Element = htonl(a_Value[i]);
        m_Result.append((const char *)&Element, 4);
    }
#else
    int * Elements = (int *)(m_Result.data() + m_Result.size());
    m_Result.append(a_NumElements * 4, (char)0);
    for (size_t i = 0; i < a_NumElements; i++)
    {
        Elements[i] = htonl(a_Value[i]);
    }
#endif

The non-android code works by appending zero bytes first, then overwriting them with real values; Android cannot overwrite, so it's appending the values one by one - therefore it must not have the zero-appending code


RE: Android tests - FakeTruth - 11-17-2012

Oh wow, I'm an idiot, thanks


RE: Android tests - FakeTruth - 11-17-2012

Alright, here's the latest version of MCServer for Android http://code.google.com/p/mc-server/downloads/list?can=3&q=OpSys%3DAndroid+&colspec=Filename+Summary+Uploaded+ReleaseDate+Size+DownloadCount


RE: Android tests - NiLSPACE - 11-17-2012

what is the fastest world.ini for android? i now have the default for android and i get 0.59 ch/s
its now like this:
Code:
[Generator]
BiomeGen=
DistortedVoronoiCellSize=96
DistortedVoronoiBiomes=
BiomeGenCacheSize=64
HeightGen=
HeightGenCacheSize=64
CompositionGen=
BiomalSeaLevel=62
Structures=Trees,MarbleCaves,OreNests
Finishers=SprinkleFoliage,Ice,Snow,Lilypads,BottomLava,DeadBushes,PreSimulator
BottomLavaLevel=10
and maybe could you add a function in the web configurator that allows you to change someone's rank. its very difficoult now to make yourself admin on android.
but i think MC-Server is now good enough to be uploaded to the play store. (if you want becouse it cost money Sad)


RE: Android tests - FakeTruth - 11-17-2012

(11-17-2012, 08:51 AM)STR_Warrior Wrote: what is the fastest world.ini for android? i now have the default for android and i get 0.59 ch/s
its now like this:
Code:
[Generator]
BiomeGen=
DistortedVoronoiCellSize=96
DistortedVoronoiBiomes=
BiomeGenCacheSize=64
HeightGen=
HeightGenCacheSize=64
CompositionGen=
BiomalSeaLevel=62
Structures=Trees,MarbleCaves,OreNests
Finishers=SprinkleFoliage,Ice,Snow,Lilypads,BottomLava,DeadBushes,PreSimulator
BottomLavaLevel=10
Oh right, remove MarbleCaves and replace it with the worm nest caves. That should make it at least twice as fast I think.

(11-17-2012, 08:51 AM)STR_Warrior Wrote: and maybe could you add a function in the web configurator that allows you to change someone's rank. its very difficoult now to make yourself admin on android.
True, I still need to do that.

(11-17-2012, 08:51 AM)STR_Warrior Wrote: but i think MC-Server is now good enough to be uploaded to the play store. (if you want becouse it cost money Sad)
Well dunno, I first want to thoroughly test this before I put it on the market (if I ever put it on the market) to make sure it doesn't harm the phone. Many people may be unaware of the amount of storage MCServer can consume on their SD card and they may not know how to delete MCServer properly to free that space up again.
Putting MCServer on the market is free for me.