How to Make a FlyCam from Scratch - Part 2: Creating a Lua FlyCam Script

Поділитися
Вставка
  • Опубліковано 11 вер 2024
  • Become a Game Hacking Master at GuidedHacking: guidedhacking.... ► SUBSCRIBE: goo.gl/tkkXvf
    -► PATREON: / dsasmblr
    ► TWITCH: / sn34kymofo
    In this video, we continue with the creation of our flycam in the game Dragon Quest XI. We'll be creating a Lua script which will watch our keyboard key-presses and do things with the camera's coordinate (XYZ) and rotation (pitch and yaw) values accordingly!
    Here is a link to where you can nab the final script:
    Dragon Quest XI FlyCam Script: github.com/dsa...
    Thanks for watching! =)
    #FlyCam #Lua #DragonQuestXI

КОМЕНТАРІ • 22

  • @StephenChapman
    @StephenChapman  5 років тому +1

    In this video, we continue with the creation of our flycam in the game Dragon Quest XI. We'll be creating a Lua script which will watch our keyboard key-presses and do things with the camera's coordinate (XYZ) and rotation (pitch and yaw) values accordingly!

    • @HdHereidme
      @HdHereidme 4 роки тому

      the cheat engine keeps giving errors when i try save this script, first of all it says "($lua) this instruction cannot be compiled" then i googled and changed it to "{$lua}" and i get even more errors, sometimes i get so bad errors that it tries to execute it and the whole window box just gets stuck so i have to force kill ce, how am i suppose to assign to cheat table this lua script?!

    • @HdHereidme
      @HdHereidme 4 роки тому

      well i guess it didn't work as i thought when trying to run it, my problem could also be that the values are 4 bytes for positions and not floats and if so what would i put in the script? pitch has big value: 4294966233 as decimal (4 bytes) and Y position also has: 4294965729 as decimal (4 bytes) and when i run the code i get: Error:[string "local syntaxcheck,memrec=...
      ..."]:18: bad argument #1 to 'sin' (number expected, got nil)

    • @HdHereidme
      @HdHereidme 4 роки тому

      its so weird that it shows the values as NaN in cheat engine when i change type to float but when i check the disassembler view it shows in the comments the correct value for the Y position and pitch (-1247)

  • @JackAdams0
    @JackAdams0 2 роки тому +3

    this has helped me create so many Fly hacks, thank you for this stephen chapman!

  • @Renamoose
    @Renamoose 5 років тому +1

    2 parts in one day 😮
    I'm 30 minutes into part 1, thanks for uploading these videos! I've been working on a community project with Guided Hacking on LOTRO and I've been stuck on my own flycam for months just slowly finding values. I laughed the first time I found the float for FOV because everything on screen got mega thicc.
    Hopefully this series is a game changer for other modders to make their own flycams, of all the hacks you see for videogames flycam doesn't get as much love. You the man SC 👊

    • @StephenChapman
      @StephenChapman  5 років тому +1

      I hope it helps! I've got one more video coming shortly, then a bunch of others planned. I honestly haven't even scratched the surface of everything I'm going to get into, lol. This is such an incredibly vast topic, I'm going to be doing content on all this for quite sometime. So prepare to keep on learning stuff, basically, lol. =)

  • @ChrisDuhBestest
    @ChrisDuhBestest 4 роки тому +1

    Hey thank you for taking the time to make this! I really do appreciate you for your channel!

  • @NSAKEY
    @NSAKEY 2 роки тому +1

    Nice tutorial. You should also create one for assembly. Cheers.

  • @velocityra
    @velocityra 4 роки тому +1

    Cool video! Here's some corrections/improvements to the camera movement code.
    It fixes W/S which were buggy in your implementation and simplifies the logic (no need for separate `if`s for WASD combinations).
    Might need to tweak siny, etc to add/subract rad(90). I tested this on another game (Sly 2 on the PCSX2 emulator).
    I also added camera rotation, but not included here in the interest of brevity. It's straightforward to do anyway.
    --Forward
    if isKeyPressed(VK_W) then
    camx = camx - siny * cosp * speed
    camy = camy + cosy * cosp * speed
    camz = camz - sinp * speed
    end
    --Left
    if isKeyPressed(VK_A) then
    camx = camx - cosy * speed
    camy = camy - siny * speed
    end
    --Back
    if isKeyPressed(VK_S) then
    camx = camx + siny * cosp * speed
    camy = camy - cosy * cosp * speed
    camz = camz + sinp * speed
    end
    --Right
    if isKeyPressed(VK_D) then
    camx = camx + cosy * speed
    camy = camy + siny * speed
    end
    writeFloat(camx_addr, camx)
    writeFloat(camy_addr, camy)
    writeFloat(camz_addr, camz)

    • @StephenChapman
      @StephenChapman  4 роки тому +2

      Yeah, this is a very old script template I used for this video from back when I was first learning how to do this stuff.
      When I use Lua for camera hacks these days (which is increasingly less), I drastically cut down on reads and writes by packing/unpacking values via tables. And for sine/cosine/etc., I find where the game natively calculates those values and either reference the addresses if they're static, or hook the subroutine and pilfer data accordingly.
      But what I really like to do now is eliminate the race conditions completely that cause screen tearing and other glitches. I do that by hooking into subroutines completely for doing all my calculations, reads, writes, etc.
      Basically, using native threads of execution instead of creating a new one to do all this extra stuff.
      A nice side effect is, since many games these days typically have multiple cameras contributing to the overall composite, as well as other objects depending on a primary value (i.e. lighting, sound, etc.), I end up with significantly less-broken cameras that maintain clipping planes, DOF, etc. no matter where you take them.
      It's definitely extra work, but worth it! This is all stuff I plan to cover in future videos. =)

    • @velocityra
      @velocityra 4 роки тому

      ​@@StephenChapman Interesting, would be cool to see that elaborated on in a video :) I imagine the details/reversing is pretty game specific but then again it kind of all is.
      For the game I tried, lua + the timer worked well enough, so I didn't try to be fancier about it.
      For PS2/pcsx2 doing more 'internal' stuff as opposed to 'external' like the aforementioned lua method might be harder since you're kind of restricted. The code you're patching is JITted and can even change locations if the JIT block gets invalidated at runtime (or whatever).
      Of course it's also dynamically allocated, but I guess there are ways to get around this by pattern matching. ...But then again what if it happens after you patch (happened to me a few times). A limited solution, which is what I used for my current Sly 2 FreeCam, was to patch the original MIPS code via PCSX2's patching system (.pnach files).
      But hooking the recompiled code? Not sure if that would work reliably.
      Anyway, I'm rambling ha. Was my first time doing this and your vid definitely helped get me up to speed.
      Thanks for replying. :)

  • @JackAdams0
    @JackAdams0 2 роки тому +2

    i think the lua timer is buggy. sometimes it doesn't disable properly. i would find myself going faster than my multiplier actually is. the speed doubles or triples sometimes while i'm activating or deactivating the script. Also would love to see the same tutorial in assembly

  • @llKaiserx0ll
    @llKaiserx0ll 5 років тому +1

    Your videos are amazing, thank you so much for them!

  • @alihlko
    @alihlko Рік тому

    First of all THANK YOU MY BRO...
    i understood every single thing here... but my problem is that i'm new and noob for Math and (sin,cos) stuff
    what i was trying is making a Flycam for Assassins Creed 1. Well, i already did the hack but keys are not directly oriented to where the mouse is pointing, but rather they control the camera movement in a certain direction regardless of the current camera orientation.
    For example, pressing the "Y" key moves the camera forward, regardless of whether the camera is currently facing north, south, east, or west. The same applies to the other keys defined in the script.
    any help is appriciated.

  • @tritank5375
    @tritank5375 2 роки тому

    Great videos! I'm learning so much however when I try to add my script to the cheat table it throws an access violation. I've tried searching for answers, even restarting/reinstalling cheat engine, recreating the script and it keeps throwing this error. Anyone know what I'm doing wrong?

  • @NotJustSomeGuy
    @NotJustSomeGuy 5 років тому +1

    Just a heads up that in your CT for this game on Github you have "<" at line 286 instead of a "

    • @StephenChapman
      @StephenChapman  5 років тому

      I think CE parses that as a less-than sign when you open the CT. If not, then something funky happened with uploading it to GitHub as that's not something I did at all. Does the script not load after you download the raw file?

    • @NotJustSomeGuy
      @NotJustSomeGuy 5 років тому

      I just copied the script to modify for a different game, i'm not sure if opening it directly as a CT works or not. Copying it into a new script does give an error though.

    • @StephenChapman
      @StephenChapman  4 роки тому

      Yep. It's because any < or > chars are represented as < and > if they are supposed to actually be greater than or less than. Since that's a whole CT you copied from, which is actually an XML file, it's filled with tags that use , which CE interprets for its own use. So, if a script within a CT has a < or >, then they will actually be stored in the format that XML interprets as < and > when loaded. It also means that if you try to copy like you did, there are chances you'll run into exactly what you you've run into. :)

  • @surajsinghsoundengineer925
    @surajsinghsoundengineer925 5 років тому

    Party hard 2 pls make a video for this game.

  • @mattfx
    @mattfx 8 місяців тому

    Merci !