MV3D - 3D rendering for RMMV with Babylon.js

I think the easy way for corpses is to cut their legs off. Otherwise I think they are exercising.
iI0LQt.png

I think the character is dead and it shouldn't be sliced. Face always come to me
I made the character seem dead. Yes it's dead Don't turn again.
iIhQav.png
hmm...
been trying to make QMovement compatibl with this one...
while I was able to make the controls turn properly, I'm having trouble with the whole collision check part. Not only it ignores the height/depth parts, it is also not moving on things like on top of roofs - something that does make sense, but not that it was shown in the demo it is useful I'd like to keep it...
I think I may have to rewrite it...
Edit fixed my problem by having a backup.
To everyone waiting for my compatibility patch between this plugin and QMovement... sorry, but I am giving up on it.
Not because it isn't working. All I still need to do is add height sensing to diagonal - normal 4 directions are not only sensing height properly, they are also changing the directions when you turn the camera as the plugin was supposed to do.
The real problem is...

Not sure if it is my pc or what, but this plugin by itself takes a sec, maybe two to start, but fps after that is pretty high, almost 60 all the time. QMovement by itself is the same. But put them together, and I did not get to 10 the whole time I was testing.
It is too annoying, and I am doing it on my own volution... so I am giving up. Not because it is hard to program, but because it isn't worthy to use.

I'm still going to make a controls-changing plugin and probably use what I got here for an 8-directions control plugin, but no, this compatibility patch is abandoned.

@Dread_Nyanak sorry for taking your topic's space...
@Waterguy

That is a shame as I was hoping to have a proper fix for it. I hope you take your time and make one in the foreseeable future, as it would be a good adition to mv3d plugin.

I am still hoping my other suggestions are going to be implented in the foreseeable future too.
@Waterguy

That is a shame as I was hoping to have a proper fix for it. I hope you take your time and make one in the foreseeable future, as it would be a good adition to mv3d plugin.

I am still hoping my other suggestions are going to be implented in the foreseeable future too.
not a matter of taking my time in this one, I think. sorry.

As I said, both by themselves work great for me, but together they go really slow here.

And I do not like the idea aiming to make games for those with better computers than me, so I really doubt I will work on it again.

Not surprising, really. mv3d may have been optimized a lot, I think the word is "kudos"? for Dread_Nyanak, but it is still using 3d in javascript and thus not surprising it takes a bit from the pc - especially since I also use the dynamic shadows. And QMovement due to having pixel collision checks is not exactly light either (also some things it doesn't have working properly, like vehicles, followers and mouse movements, even thoughQPathfinding fixes the mouse one the followers is literaly said to be just put there incomplete with no plans of bugfixing, and there is nothing there about vehicles)

While I am sorry for those I disappointed, I myself had ideas about how to use them together, I really have no plans of trying again.
I think it's hard to check. Regardless, when facing the camera to the left or to the right, then I can't move on correctly. I think it might be possible to know that the character is facing with the Q button or the E button, so I can switch where it should be.
I try to create a fixed condition. To determine It should be headed to Upper Right.
Do you know how I can know where I point the Q and E camera? Where will I be, but the plugs look like? Will be a rotating scene, so I think it is too difficult and really messy
We can't know if I have to delve into it. I'm probably sleepy and stop saying goodbye. Yes, it's very difficult.
When the scene began to rotate I can no longer figure out how to walk the right way
In the example below I was able to determine the same direction but could not know anymore. When the scene began to rotate
goodbye and it There is still an error. Sometimes it goes strange.
But I think normal is already good
Surprisingly, you may try this.
A beautiful plugin sometimes has to sacrifice something.



RWtAxz.png
This looks super cool. Tell me, how would I be able to set up the camera (and other settings?) to achive something that looks like your dungeon crawling example in the screenshots? I couldn't find a camera parameter...


[EDIT; I've been testing this plugin out for about an hour and while it's really cool and works to some extent right away in a plug-n-play manner, there's also some flaws. The biggest "problem" right now being the documentation. It's not very easy to understand and I wish it would be rewritten to be less confusing.

There seems to be a lot of parameters and options but I'm unsure what half of them does. Two parameters seems to indicate some kind of minimap... not sure what that is though since I've not seen any minimap anywhere. Maybe it's something else than what I think it is, maybe not. I have no idea.

And that's the problem. I admit I'm not a programmer or very good at math, but I imagine there's a lot of people who aren't. And while I'm sure I could get into this plugin if I spend a couple of days trial-and-erroring my way forward it's a very frustrating process.

I'm still wondering how to achive the 1st person dungeon look btw. It doesn't seem like something I can just set in a parameter (maybe it should be?), so I guess it's something that would have to be achived by starting a map with an auto-run command and then executing a plugin command (not sure which one) and then deleting said event.

As things are right now. I'm both impressed and frustrated by this plugin. There's so much opportunity, but it all confuses me so much.]


----

[EDIT 2: Right after I made my first edit I downloaded and took a peak at the demo project. That was 1000 times more helpful than the documentation and I can see that there's a plugin command for the 1st person perspective in some of the maps. So I guess I solved that one. But I'd still want the helpfile/documentation to be more clear as well. I'd offer to help write it but... I don't understand it myself so I'm afraid I can't. But, really cool plugin. The demo project is very nice.]
@palatkorn the movement... just ignore the 3d when putting the move routes. Pretend it is the default map.
They are still the same as before the 3d was applied, they just look different because of the camera angle.
The change is not on the event/player going up or down or to the side, the change is that the camera changes your *input*. That means that if the camera angle is inverted then pressing the up button the game will act as if you had pressed down, but internally it will still be down even if in the 3d it will look like up.
I admit I had the same problem when I was first looking at the plugin before noticing this, but now that I do get it...

@Parallax Panda I don't think those things are so much about programming... since I am a programmer and get lost easily in graphics stuff too.
That doesn't seem to be minimap, but "mipmap". notice a p instead of a ni. I...have no idea what that means, really. Render distance is how far from the camera is pre-drawn. Antialiasing is for making things blurry when zooming in and out instead of just making big squares or hiding some. Lights per mesh I think it is because there used to only be able to have 4 light sources in a map... and that's all I know of Options Setting and Graphics... and Map Settings...
Fog is not an actual fog, it is the color to hide things when they are too far away.
Control Pitch with keyboard is moving the camera up and down, rotate camera is turning it left and right, straffing is walking sideways in first person, and stair thresold is how hight a terrain has to be before it is considered too high to just walk up.
Wall and Table Height are the default height wall/ceiling tiles get when put on the map, and table is the same with the counter tiles. Fringe Height is the default height of tiles set as star. Ceiling height is for maps you put a ceiling on, mainly for first person maps. Layering Distance is for when you put two tiles in the same grid position, so they are one just a bit over the other. Animation speed is for water, waterfall...
Regions and Terrain Tags is for putting a code that will affect all tiles under that terrain tag or region. As you can see for the example ones with the plugin,
Character, Object, Tile Event Settings are the default setting for those events (but you can change them with notetags)... I think Character is for normal character sprites, Objects is for sprites with a ! in the name and Tile is for those from the tileset... but cannot say for sure. Boat Ship and Airship are the settings for when using the vehicles, they have the Settings that is the same as the events one, Big that is for when they are double the usual tile size, and the airship has elevation, how high it flies from the ground, and land on bush tiles to block you... well, landing on tiles with the bush effect. Event "above character" height is just as it says, the height for an event set to show above character, just like a tile with star passability's fringe.
And that is all the settings I can guess.

About using first person view, she said here once all you need is to set the camera's height to 0, but pitch to 90 I think is pretty important too. height is the camera's height from the ground, and yaw is the direction you are facing.
@Parallax Panda and @Waterguy
When the scene began to rotate I can no longer figure out how to walk the right way
In the example below I was able to determine the same direction but could not know anymore. When the scene began to rotate
goodbye and it There is still an error. Sometimes it goes strange.
But I think normal is already good
Surprisingly, you may try this.

The change is not on the event/player going up or down or to the side, the change is that the camera changes your *input*. That means that if the camera angle is inverted then pressing the up button the game will act as if you had pressed down, but internally it will still be down even if in the 3d it will look like up.
I admit I had the same problem when I was first looking at the plugin before noticing this, but now that I do get it...

This was the problem we wanted to have a fix for, as it would have been great addition to the plugin.
To make the camere recognise your movement, and while rotating camera, adjust accordingly would been really great.

There has never been better support plugins then quasi's plugins for the entire duration of mv's existance and having them work with this great plugin would be perfect.

I also noticed you made an example with reverse movement when camera changes, might be something to do when mv recognise that camera rotated.
@safermike really? that was the simplest thing in this, my main problem was the whole "recognizing height differences" thing that was kicking my ass. I mean, I made it work in 4 directions properly already, but on diagonals...

Ok, to use my version of the code you'll need these functions, that are already on my mv3d-QSprite compatibility plugin by the way, they are one to turn the directions depending on the camera angle, the main one you'll use, but also two that first one uses, one get the direction and turn it into angles, then one to get an angle and turn into direction:
JavaScript:
mv3d.transform8DirectionYaw=function(dir,yaw=this.blendCameraYaw.currentValue(),reverse=false){
    if(dir==0){ return 0; }
    dir = this.numpadToAngle(dir);
    const c = yaw;
    if(reverse){
        dir=(dir-c).mod(360);
    }else{
        dir=(dir+c).mod(360);
    }
    return this.angleToNumpad(dir);
}

mv3d.numpadToAngle=function(numpad){
    var angle = 0;
    switch (numpad) {
        case 7: angle++;
        case 4: angle++;
        case 1: angle++;
        case 2: angle++;
        case 3: angle++;
        case 6: angle++;
        case 9: angle++;
        default: break;
    }
    return angle*45;
}
mv3d.angleToNumpad=function(angle){
    var numpad = 8;
    angle = Math.round(angle/45);
    switch (angle) {
        case 1:
            numpad = 9;
            break;
        case 2:
            numpad = 6;
            break;
        case 3:
            numpad = 3;
            break;
        case 4:
            numpad = 2;
            break;
        case 5:
            numpad = 1;
            break;
        case 6:
            numpad = 4;
            break;
        case 7:
            numpad = 7;
            break;
        default: break;
    }
    return numpad;
}
I know, the second and last ones may be overly-complicated... they work fine though.

These ones are to actually change the controls on QMovement, they overwrite the old ones it uses for that:
JavaScript:
Game_Player.prototype.moveInputHorizontal = function(dir) {
  if (mv3d.isDisabled()) this.moveStraight(dir);
  else {
    if (QMovement.diagonal) {
      dir = mv3d.transform8DirectionYaw(dir,mv3d.blendCameraYaw.currentValue(),true);
      if ([1, 3, 7, 9].contains(dir)) {
        var diag = {
          1: [4, 2], 3: [6, 2],
          7: [4, 8], 9: [6, 8]
        }
        this.moveDiagonally(diag[dir][0], diag[dir][1]);
      } else this.moveStraight(dir);
    } else {
      this.moveStraight(mv3d.transformDirectionYaw(dir,mv3d.blendCameraYaw.currentValue(),true));
    }
  }
};
    
Game_Player.prototype.moveInputVertical = function(dir) {
  if (mv3d.isDisabled()) this.moveStraight(dir);
  else {
    if (QMovement.diagonal) {
      dir = mv3d.transform8DirectionYaw(dir,mv3d.blendCameraYaw.currentValue(),true);
      if ([1, 3, 7, 9].contains(dir)) {
        var diag = {
          1: [4, 2], 3: [6, 2],
          7: [4, 8], 9: [6, 8]
        }
        this.moveDiagonally(diag[dir][0], diag[dir][1]);
      } else this.moveStraight(dir);
    } else {
      this.moveStraight(mv3d.transformDirectionYaw(dir,mv3d.blendCameraYaw.currentValue(),true));
    }
  }
};
  
Game_Player.prototype.moveInputDiagonal = function(dir) {
  var diag = {
    1: [4, 2], 3: [6, 2],
    7: [4, 8], 9: [6, 8]
  }
  if (mv3d.isDisabled()) this.moveDiagonally(diag[dir][0], diag[dir][1]);
  else {
    dir = mv3d.transform8DirectionYaw(dir,mv3d.blendCameraYaw.currentValue(),true);
    if ([1, 3, 7, 9].contains(dir)) this.moveDiagonally(diag[dir][0], diag[dir][1]);
    else this.moveStraight(dir);
  }
};

Game_Player.prototype.moveWithAnalog = function() {
  var horz = Input._dirAxesA.x;
  var vert = Input._dirAxesA.y;
  if (horz === 0 && vert === 0) return;
  var radian = Math.atan2(vert, horz);
  radian += radian < 0 ? Math.PI * 2 : 0;
  if (!mv3d.isDisabled()) radian = (radian + (mv3d.blendCameraYaw.currentValue()*Math.PI/180)).mod(Math.PI*2);
  this.moveRadian(radian);
};

If that is really all you want, this is really all you need. save it as a name.js file and put it under both plugins on the plugin manager.
@palatkorn I think you're asking how to know the camera's current rotation? This script will get that value for you.
mv3d.blendCameraYaw.currentValue()
And if you want the value normalized between 0 and 360
mv3d.blendCameraYaw.currentValue().mod(360)
Then you can run a conditional branch based on that value if you need to.

@Parallax Panda
To enter 1st person mode you just need to set the camera distance to zero with a plugin command.
mv3d camera dist 0 1
The zero is the value we're setting the distance to, and the one is the number of seconds for the transition.

I'm not really good at writing an easy to understand help file, but it does still need work. Next time I rework the help file I also want to add some examples for script calls.
Yes, I like you. Now I can set directions. It's great.


@palatkorn I think you're asking how to know the camera's current rotation? This script will get that value for you.
mv3d.blendCameraYaw.currentValue()
And if you want the value normalized between 0 and 360
mv3d.blendCameraYaw.currentValue().mod(360)
Then you can run a conditional branch based on that value if you need to.

@Parallax Panda
To enter 1st person mode you just need to set the camera distance to zero with a plugin command.
mv3d camera dist 0 1
The zero is the value we're setting the distance to, and the one is the number of seconds for the transition.

I'm not really good at writing an easy to understand help file, but it does still need work. Next time I rework the help file I also want to add some examples for script calls.
That doesn't seem to be minimap, but "mipmap". notice a p instead of a ni. I...have no idea what that means, really.
Mipmaps are smaller versions of textures that can be automatically generated. Basically, the farther the camera gets from something, the lower resolution a texture will become, and anything below the original resolution of the texture is called a mipmap.

I don't know how it relates to this plugin because I haven't really used it yet, but I saw the opportunity to answer a question and I took it!
Mipmaps are smaller versions of textures that can be automatically generated. Basically, the farther the camera gets from something, the lower resolution a texture will become, and anything below the original resolution of the texture is called a mipmap.

I don't know how it relates to this plugin because I haven't really used it yet, but I saw the opportunity to answer a question and I took it!
I see!
This is a plugin to kinda turn mv 3d, thus the name mv3d, so I can see how things too far away would become smaller than the original size and thus would use a mipmap as you said...
...but now I am curious on what would happen if I turn it off...
@Waterguy & @Dread_Nyanak
Thanks for that explanation. Some stuff like "camera pitch" I didn't know about, some of the terms explained in more layman's terms might've been a good thing to add to the help file eventually.

Also, thanks for explaining the whole 1st person camera angle for me. Is it possible to (in 1st person view) have the camera look slightly up or down? Like for example. You walk onto a tile and some story aspect triggers an auto event that makes you look up at something while some text is displayed. Then you look back down again. Is all I have to do to change the camera pitch temporary maybe?

@Prescott
I knew it must have had some other meaning. Although I had no idea what. I imagine that more than a few people will be confused by that plugin parameter though. It probably should have some clarifying description inside.
I think you're referring to the zoom this character of one event, which I use this simple technique to handle.

Set up the camera and then move yourself to the event spot. Back to the original

When returning, you should set the camera again so that it doesn't Looking too close


RdoPan.png


@Waterguy & @Dread_Nyanak
Thanks for that explanation. Some stuff like "camera pitch" I didn't know about, some of the terms explained in more layman's terms might've been a good thing to add to the help file eventually.

Also, thanks for explaining the whole 1st person camera angle for me. Is it possible to (in 1st person view) have the camera look slightly up or down? Like for example. You walk onto a tile and some story aspect triggers an auto event that makes you look up at something while some text is displayed. Then you look back down again. Is all I have to do to change the camera pitch temporary maybe?

@Prescott
I knew it must have had some other meaning. Although I had no idea what. I imagine that more than a few people will be confused by that plugin parameter though. It probably should have some clarifying description inside.
Another basic thing about this plugin that I'd like to understand is how to properly set up the tileset. I understand that you have to put these tags in the notebox end place all plugin relevant information inside;

<mv3d>

</mv3d>

But I'm not entirely sure how to write the content that's supposed to go inside. Can someone explain it to me using this example screenshot here? Let's say I want to properly set up this green "mesh" like alien auto-tile to work in a 1st person perspective dungeon. I'd want the wall parts to be the wall and the top part to be the top (and I guess, bottom). How would I need to write that?
I get that I probably need to put down the x and y but is it the x and y inside the "select an image" window that I opened in the screenshot or is it the x and y in the database where each auto-tile is presented as just 1 tile? I'm a bit confused.
VAvPaBo.png

Bonus questions: I'd also like to understand how to set up slopes and water.

Thanks to anyone who can explain it to me. 👋

@palatkorn
I'm not sure if that's what I meant, because I'm not really looking to zoom in or out of anything. More the "effect" of the invisible 1st person hero(s) looking slightly up (at the roof) or down (at the floor). But maybe you're right and it's exactly what I'm asking for. I'd have to test it out to know for sure, but it's pretty late so I can't do it today. I will though (tomorrow, I hope).

I do appreciate the help a lot.
Also, thanks for explaining the whole 1st person camera angle for me. Is it possible to (in 1st person view) have the camera look slightly up or down? Like for example. You walk onto a tile and some story aspect triggers an auto event that makes you look up at something while some text is displayed. Then you look back down again. Is all I have to do to change the camera pitch temporary maybe?
Yup, just change the pitch to look up and then set it back down later.

And about the tileset... ok, it is a bit confusing...
first, you put the tileset you want to change, through the x and y as in the tileset screen. Your example is on A4, and on the editor is on the fifth column of the A4 image's tiles... well, it starts from 0 so it is 4, and... there are two different tiles there, the ceiling and the wall, by default the ceiling has the wall as its side and will rise the already-set "wall" height, but you can set it as a different one, and the wall has itself as the ceiling too. The ceiling is in the fifth row and the wall is on the sixth, so numbers 4 and 5.
So to set them you'll set "A4,4,4" and "A4,4,5". For an example, I'll explain about A4,4,4 for not.
So, they can be separated as top, the piece on top, side, the piece on walls and the like, bottom, for when it is floating and the like so it can be sen from bellow, and inside, for when it has a depth. As a depth, something on height 1 would count as something a bit lower and the sides of the border would show the inside tile instead - in the demo, you have it set for water and for the black pit tile.
to set a tile for either position you can have two options: you can use the same way you set the tile you are setting, in this example A4,4,4 for the top, or you can go to the image itself and get a piece of it using the image positions, it would then be image,starting x, starting y, width to take and height to take. For example, in the demo water is set on the top as top(A1,24,72,48,48), meaning on the A1 image that water takes a piece on the image on pixels 24,72 and the image is 48x48. It is confusing for now, but gets easier with some experimenting. For now, let's use the whole tile as top, and the wall as side, meaning we have "A4,4,4:top(A4,4,4),side(A4,4,5)"

Now, for slopes... I only know you set that tile, or region, to have "slope(1)". No idea why the 1 is needed, or what happens if you use a different number. @Dread_Nyanak I admit I wanted to ask about this earlier but forgot... are slopes limited to that number as tiles of height or something?
Same for animation, really. I mean we have it automatic on the A1 tiles, water has it set as 1,0 and waterfalls as 0,1 if I remember right, an 1 on the first means threetiles of animation horizontally like typical water and 1 in the second means three tiles vertically like waterfall, and in the demo thereis a tile set with both just to show what happens when both are used. Does it also has to be only either 0 or 1 there?
@Waterguy the extra number on slope(1) let you chose the degrees on the slope, if you use slope(1) would be 45 degrees, with slope(0.5) are 22.5 degrees , the height would let you chose the z position while the slope(#) let you chose the slopes degrees on that 48x48 square

@Dread_Nyanak i been using the slopes a lot, but been thinking would be better to add a parameter to force the direction on a slope, i know you can chose it with the pasability direction, but when you wanna do a 2 tiles thick stairs, starts to work...kinda funny...depending on what kind of blocks are around, would be good to add an extra configuration, kinda like slope( 1, left) just in case you really want to put the stair in one direction but dont change the pasability direction on the tile ^^

Original thread: https://forums.rpgmakerweb.com/threads/mv3d-3d-rendering-for-rmmv-with-babylon-js.114971/