Towards 1.13
#4
(01-09-2019, 06:45 AM)NiLSPACE Wrote: If I'm completely honest I was surprised cBlockArea wasn't used for it already. What were the reasons for not unifying them before?
Two reasons:
1. cBlockArea was created much later than cChunk, for different initial purposes (loading and saving prefabs)
2. Until now the chunk sections are exactly the same memory size, and we are using this to provide a special allocator just for the sections (cAllocationPool) that was meant to provide an out-of-memory and almost-out-of-memory handling.

(01-09-2019, 06:45 AM)NiLSPACE Wrote: I've been programming C# for years now which has the following convention: ClassName, MethodName, _fieldName, argumentName, localVariable
So we agree on ClassName and localVariable; partially on argumentName (by forcing an "a" prefix). Whether methods use first capital or not is not a big issue with me, but what I resent is the underscore. It is the most unfortunate character - its very low visibility makes it too easy to mix up with a space. I'll be adamant about having as little underscores as possible.

(01-09-2019, 06:45 AM)NiLSPACE Wrote:
xoft Wrote:... This could even be gradual - first implement only 32-bit numbers ...
Would it be possible to dynamically change the size?
That's the general idea - for each storage use only as few bits as possible. For performance reasons, we may want to limit to 4-, 8-, 16- and 32-bit numbers. There are special cases when we'll need to use more bits than actually needed - when merging two BAs.

(01-09-2019, 06:45 AM)NiLSPACE Wrote: I'm having trouble visualizing how block manipulation would happen. Would we return strings to specify a block type? What happens when two plugins register a type of the same name?
I was thinking something like this (in a *single* BlockArea):
/** Sets a single block using its full blockspec */
void setBlock(const Vector3i & aPos, const AString & aBlockName, const BlockState & aBlockState);

/** Sets a single block using an index to the palette (retrieved earlier by paletteIndex()). */
void setBlock(const Vector3i & aPos, UInt32 aPalleteIndex);

/** Returns the index into the palette that is used by the specified full blockspec.
Adds the blockspec to palette if not already there. */
UInt32 paletteIndex(const AString & aBlockName, const BlockState & aBlockState);

/** Returns the index into the palette that is used by the specified full blockspec.
Returns <undefined, false> if blockspec not in palette. */
std::pair<UInt32, bool> maybePaletteIndex(const AString & aBlockName, const BlockState & aBlockState);

/** Returns the index into the palette for the block at the specified pos. */
UInt32 blockPaletteIndex(const Vector3i & aPos);

/** Returns the full (copy of) blockspec of the block at the specified position. */
std::pair<AString, BlockState> block(const Vector3i & aPos);

/** Returns (an editable (?) blockspec represented by the specified palette index. */
std::pair<AString &, BlockState &> paletteEntry(UInt32 aPaletteIndex);
Reply
Thanks given by: NiLSPACE


Messages In This Thread
Towards 1.13 - by xoft - 01-08-2019, 01:04 AM
RE: Towards 1.13 - by xoft - 01-09-2019, 03:06 AM
RE: Towards 1.13 - by NiLSPACE - 01-09-2019, 06:45 AM
RE: Towards 1.13 - by xoft - 01-09-2019, 09:55 PM
RE: Towards 1.13 - by xoft - 01-09-2019, 09:58 PM
RE: Towards 1.13 - by NiLSPACE - 01-09-2019, 10:28 PM
RE: Towards 1.13 - by xoft - 01-11-2019, 05:57 AM
RE: Towards 1.13 - by ShadowCone - 01-11-2019, 03:52 AM
RE: Towards 1.13 - by NiLSPACE - 01-11-2019, 06:03 AM
RE: Towards 1.13 - by ShadowCone - 01-12-2019, 12:28 AM
RE: Towards 1.13 - by xoft - 01-16-2019, 01:10 AM
RE: Towards 1.13 - by xoft - 01-22-2019, 09:14 AM
RE: Towards 1.13 - by NiLSPACE - 01-22-2019, 06:56 PM
RE: Towards 1.13 - by xoft - 01-22-2019, 07:34 PM
RE: Towards 1.13 - by NiLSPACE - 01-22-2019, 08:57 PM
RE: Towards 1.13 - by NiLSPACE - 01-23-2019, 04:58 AM
RE: Towards 1.13 - by xoft - 01-23-2019, 05:32 AM
RE: Towards 1.13 - by xoft - 01-23-2019, 06:04 AM
RE: Towards 1.13 - by peterbell10 - 01-23-2019, 09:49 AM
RE: Towards 1.13 - by xoft - 01-24-2019, 12:00 AM
RE: Towards 1.13 - by xoft - 01-24-2019, 12:07 AM
RE: Towards 1.13 - by peterbell10 - 01-24-2019, 02:35 AM
RE: Towards 1.13 - by peterbell10 - 01-24-2019, 02:59 AM
RE: Towards 1.13 - by xoft - 01-24-2019, 08:02 AM
RE: Towards 1.13 - by xoft - 01-24-2019, 07:41 PM
RE: Towards 1.13 - by tigerw - 01-25-2019, 02:25 AM
RE: Towards 1.13 - by NiLSPACE - 01-25-2019, 04:41 AM
RE: Towards 1.13 - by xoft - 01-25-2019, 05:08 AM
RE: Towards 1.13 - by NiLSPACE - 01-25-2019, 04:31 PM
RE: Towards 1.13 - by xoft - 01-25-2019, 05:19 AM
RE: Towards 1.13 - by tigerw - 01-25-2019, 06:16 AM
RE: Towards 1.13 - by xoft - 01-25-2019, 07:49 PM
RE: Towards 1.13 - by tigerw - 01-25-2019, 09:44 PM
RE: Towards 1.13 - by tigerw - 01-25-2019, 10:40 PM
RE: Towards 1.13 - by xoft - 01-26-2019, 12:58 AM
RE: Towards 1.13 - by tigerw - 01-26-2019, 09:11 PM
RE: Towards 1.13 - by xoft - 01-27-2019, 03:40 AM
RE: Towards 1.13 - by Aberts10 - 05-28-2019, 09:31 AM
RE: Towards 1.13 - by xoft - 05-30-2019, 12:11 AM
RE: Towards 1.13 - by xoft - 08-04-2019, 07:56 AM
RE: Towards 1.13 - by Seadragon91 - 08-04-2019, 07:22 PM
RE: Towards 1.13 - by xoft - 08-04-2019, 11:34 PM
RE: Towards 1.13 - by xoft - 08-05-2019, 07:20 PM
RE: Towards 1.13 - by xoft - 08-06-2019, 07:50 PM
RE: Towards 1.13 - by xoft - 08-29-2019, 12:02 AM
RE: Towards 1.13 - by xoft - 08-30-2019, 10:21 PM
RE: Towards 1.13 - by xoft - 08-31-2019, 02:35 AM
RE: Towards 1.13 - by NiLSPACE - 09-01-2019, 03:04 AM
RE: Towards 1.13 - by xoft - 09-01-2019, 07:13 AM
RE: Towards 1.13 - by NiLSPACE - 09-02-2019, 03:51 AM
RE: Towards 1.13 - by NiLSPACE - 09-05-2019, 12:25 AM
RE: Towards 1.13 - by xoft - 09-05-2019, 06:04 AM
RE: Towards 1.13 - by xoft - 09-05-2019, 06:05 AM
RE: Towards 1.13 - by xoft - 09-10-2019, 05:57 AM
RE: Towards 1.13 - by xoft - 09-27-2019, 07:50 PM
RE: Towards 1.13 - by xoft - 10-17-2019, 06:23 AM
RE: Towards 1.13 - by xoft - 12-28-2019, 08:45 AM



Users browsing this thread: 2 Guest(s)