# 3DNes VR - 3D NES In Virtual Reality (Oculus Rift - HTC Vive - WindowMR)

Play Nes In Virtual Reality · By geod

# River City Ransom/Double Dragon Scripting help?

A topic by JJXB created Mar 06, 2018 Views: 257 Replies: 7
Viewing posts 1 to 4

what would the best way of doing something with the whole "location on the vertical of the screen is reflective of left to right"? I assume that it'd first be a check for if the character is going up or down on the Y axis then use that to change the Z offset on the fly sort of deal thus far.

but if i have the ground at a 90 degree x rotation, that doesn't fix the fact the character goes down on the screen. so unless i do on the fly Y offset correction too, it'll look weird. with the ground at 45 degrees my initial idea would work but not look as good. thoughts on it?

Firstly, have a look at Circle Circus or World Runner scripts. It solved partly the problem. Decide a reference altitude of the ground  groundY then adjust every shape offset with this value.

But the core issues is still here. With games like River City Ransom or Double Dragon or Ninja Turtle in which characters truly move in three dimensions (xz plain  + jumping) there is just no way to calculate those values from just 2d position x,y. In this case we need to know the nes ram address that stores the character's current altitude y. Only with that info we could finally calculate the other two value  x,z and truly reconstruct the 3d scene of the game.

(4 edits)

Here is the ram map of River City Ransom:

https://github.com/BillyWM/FCEUX-Lua-Script-Collection/blob/master/River%20City%...

We have the info we need here.

Player1

 00B9: How far player is above ground level 0 when on ground 31 height of jump 32 when on a ledge 63 height of jump from top of ledge

Suppose that (x0, y0) is the bottom left position(BL) of character on 2d space and (x1,y1,z1) is the position of BL of shape in 3d space.

The conversion formula will be:

x1 = x0

z1 = y0 - y1

I think you should have the basic IT background if you want to tack that game because it involves some scripting work here.

okay, coming back to it every now and then there's been one major issue with the scripting that i cannot get past: i can't seem to get ReadMem to even work. without quotes in the brackets, 00B9 is seen as a malformed number and with quotes inside the brackets, i get an error about trying to index a null value. I've tried appending ReadMem with both Script. and ScriptManager after having once again looking through the scripting manual itself. am i doing something wrong or have i just stumbled upon a bug?

Hi,   we should convert it to decimal  i believe.

(1 edit)

what eventually got it reading anything at all was to enter Script:ReadMem(B9). but now i'm running into the issues of:

1. setting z1 not having any effect on object position at all.

2. the fact that when y1 is set to read from B9, it keeps spitting out numbers that are inconsistent with the information in the linked FCEUX lua repo (constantly changes between higher values than it should and zero even when the player is standing. gonna investigate more in FCEUX myself just to see if there's something i'm missing though. because applying the value from B9 to the shape.Offset.Z of the player sprite, it flickers between way out into the field and back to where it was.

Edit: okay, i solved most of that. the trouble is now i can't rely on memory addresses because if i want it to apply to enemies there's too many memory addresses i'd have to look up per the fact that there's multiple enemies. and also items. i'll post my current 3dn in the WIP section but unless you can get certain states without memory address reliance, i think i'm probably gonna only poke at it every so often.

Completely agreed! Multiples enemies moving in 3D space are in fact the real issue here ... Right now i don't have any solution for it myself :)

duly noted. got it put down in a seperate file along with relevant sections of the ram map (i gathered the Y position in NES memory in itself would also be useful so i noted that with the how far player is above ground level address) and your advice. for the moment i'll be looking at other projects scripting wise though.