This is the official repository for the cyubeVR VoxelAPI, an easy way to programmatically interact with the voxel world in cyubeVR, requiring very little setup from you. This requires no knowledge of UE4 or any other game engine.

You only need some to know very basic programming to use this. So if you have ever done any programming in your life, you will be able to understand it. The programming language used is C++, but you do not need any C++ knowledge for this – if you have used any C/C#/Python/Java/Javascript/PHP/Go/Swift, that will suffice.

(maybe put a few nice GIFs here of what can be done with this)

The way the cyubeVR VoxelAPI works is that there are several Event_ functions automatically called by the game for any loaded VoxelAPI mod. You put in your own code in one (or multiple) of those Event_ functions, and you are able to call functions interacting with the game, like SetBlock or GetBlock.

These are the Event_ functions currently available to be used:

Event_BlockPlaced(CoordinateInBlocks At, UniqueID CustomBlockID);

Event_BlockDestroyed(CoordinateInBlocks At, UniqueID CustomBlockID);

Event_BlockHitByTool(CoordinateInBlocks At, UniqueID CustomBlockID, std::wstring ToolName);

Event_Tick();

These are the functions currently available for you to call to interact with the game:

void Log(const std::wstring& String);

BlockInfo GetBlock(CoordinateInBlocks At);

bool SetBlock(CoordinateInBlocks At, EBlockType NativeType);

bool SetBlock(CoordinateInBlocks At, UniqueID CustomBlockID);

bool SetBlock(CoordinateInBlocks At, BlockInfo BlockType);

void SpawnHintText(CoordinateInCentimeters At, const std::wstring& Text, float DurationInSeconds, float SizeMultiplier = 1, float SizeMultiplierVertical = 1);

CoordinateInCentimeters GetPlayerLocation();

void SetPlayerLocation(CoordinateInCentimeters To);

And these are some convenience functions currently available to be called:

template<uint64_t TrueOneInN> bool GetRandomBool();

std::vector<CoordinateInBlocks> GetAllCoordinatesInBox(CoordinateInBlocks At, CoordinateInBlocks BoxExtent;

std::vector<CoordinateInBlocks> GetAllCoordinatesInRadius(CoordinateInBlocks At, int32_t Radius);

More functions to interact with the game can be added at request, so if there is something you would like to have access to that is not yet available, feel free to request it in the #Modding channel in the official cyubeVR Discord or open an issue here on this repository.

Of course, you also have access to the whole C/C++ standard library and any other C/C++ library you might want to include in your code.

How to start using this:

Step 1: Click the “Download ZIP” download button here in GitHub

TutorialDownload

Step 2: Extract the downloaded ZIP somewhere

Step 3:

In the extracted folder, go into the folder ProjectFolder. Then double click the Code.sln file.

For this, you do need to have Visual Studio 2022 installed. It’s a free software. If you have not yet installed, simply CLICK HERE and download and install it.

If you have it correctly installed, double-clicking the Code.sln will show you this screen:

TutorialVSScreen

Step 4: Open the two relevant files

There are two source files you need to edit and look at. They are called Mod.cpp and GameAPI.h. You can open them like this:

TutorialOpenFiles

Step 5: Write your code in the Mod.cpp

This was all that was required to set this up. The only file you ever have to edit is the Mod.cpp file. The GameAPI.h is useful as a read-only file to see which functions you can call to interact with the game.

The Mod.cpp file contains some variables and functions. You don’t need to add any new variables or functions to the file – simply put in the correct UniqueID into the variable at the top, and then write some code in one (or multiple) of the existing Event_ functions.

For example, let’s say you want to create a custom block that spawns a hint text when it is placed. First, create the custom block using the normal procedure for creating custom blocks for cyubeVR. Then fill in the ThisModUniqueIDs variable at the top of Mod.cpp with the UniqueID of your block. If your block has the UniqueID 82323470, it has to look like this:

UniqueID ThisModUniqueIDs[] = { 82323470 }; // All the UniqueIDs this mod manages. Functions like Event_BlockPlaced are only called for blocks of IDs mentioned here. 

Then look for the Event_BlockPlaced function in the Mod.cpp, and put in the code for spawning the hint text:

// Run every time a block is placed
void Event_BlockPlaced(CoordinateInBlocks At, UniqueID CustomBlockID)
{
	SpawnHintText(At + CoordinateInBlocks(0, 0, 1), L"I am a block and I was placed!", 5);
}

This will spawn a hint text saying “I am a block and I was placed!” above the block that was just placed, and the hint text will stay for 5 seconds.

Step 6: Get it into the game

To get your custom code into the the game, just press F7 while you are in Visual Studio. This will generate a new file in the ProjectFolder. That new file is called Code.dll. It contains the compiled code you just wrote!

Then go into the [GameInstallDirectory]/cyubeVR/Mods/APIMods folder and create a new folder there, called MyGreatMod__V1. You can call that folder anything you want, just make sure the name has __V1 at the end.

Inside of that newly created folder, paste in your Code.dll file. That’s all!

With the example from above, whenever the custom block with the UniqueID 82323470 is placed, it will now look like this in the game:

TutorialResult

GitHub

View Github