# Voxel-Style Pseudo 3D Script 2.0

Pokémon Essentials Version
This is a script that renders Voxel-Style 'Models' inside RPG Maker XP. It uses stacked sprites to create the illusion of 3D. It has no perspective, no lighting, and no collision, but everyone on the Discord seemed to like it when I showed it off in my Pokémon x Starbound project.

Please don't attempt to use this script if you have no programming knowledge.

Introduction
This script is based off a technique I've seen mainly in the GameMaker Studio community, which you can see in this tutorial for GameMaker Studio, this game made in GameMaker Studio and this video by Heartbeast for GameMaker Studio. I recently had the urge to port it over to RPG Maker XP, despite the fact that it would probably render any game unplayable. Surprisingly enough, it didn't, and I was able to still hit that 40FPS mark, even when rendering multiple 'models' at once.

Screenshots
These were achieved in standard RGSS, inside RPG Maker XP

This was achieved using mkxp, an open source, faster implementation of RGSS. The script remains the same, however.

Bonus video showing smooth rotation and movement of models.

Installation
To install, simply make a new script section above Main, paste the included script into it, then create a new folder inside 'Graphics' called '3D'. This is where you will store all of your model sheets.

While not completely incompatible with vanilla XP projects, there are a few Essentials methods used in the script. Fixed in v1.1

Model Creation
This can be really hard if you go about it in the wrong way, due to the way models are rendered in this system. A 'model' is actually just a sheet of sprites that are stacked on top of each other. You could just draw each frame by hand, but that's time-consuming. Instead, I'd use MagicaVoxel, a free Voxel editor. This allows you to actually see what your model will look like. Please make sure your model's width and depth are equal! The system will not work if you don't.

Now, you can't just throw a .vox file into your game, since that's not how the system works. Instead, you have to use this tool to convert your .vox files to a spritesheet. To do this, place the vox2png.exe file into the same directory as your .vox model and open a command prompt in that directory. Once you have one open, type 'vox2png [name of input model] [name of output png]' into it. Now copy the image into 'Graphics/3D' in your XP project (create a 3D folder if you haven't already). Make sure the output file is a PNG file - the system will not work otherwise.

Usage Instructions
Using this script is similar to using plain old sprites, with a few differences.

When making a new model object, the class name is Sprite3D. It takes one argument - a viewport.

To set the spritesheet used to generate the model, use [sprite3D instance].model= Bitmap3D.new("path/to/bitmap")

Most issues that were present with the old system are gone, except performance obviously, I can't fix that without some external help (e.g. a DLL that does all this for you), so remember, unless you like low framerates, do not use models larger than 48 frames. I can tell you from experience that it is a horrible idea.

If you find any bugs, don't hesitate to tell me. Not that anyone will use this.
Credits
moppin and nemk - NIUM, the game which this effect is most famous for
Heartbeast - 'GameMaker Studio 2 - 3D Racecar - Sprite Stacking' Tutorial video
like, a hundred bears - 2d 3d in gamemaker studio
ephtracy - MagicaVoxel
Stijn Brouwer - vox2png
Author
sukoshijon
807
Views
807
First release
Last update
Rating
0 ratings