Splatoon 2 + Titan two

GPC2 script programming for Titan Two. Code examples, questions, requests.

Re: Splatoon 2 + Titan two

Postby osbor » Sat Apr 07, 2018 5:59 pm

oh shoot that's right, i keep forgetting that the switch has video recording now
User avatar
osbor
Master Sergeant
Master Sergeant
 
Posts: 41
Joined: Sun Oct 08, 2017 12:19 am

Re: Splatoon 2 + Titan two

Postby sky418 » Mon Apr 09, 2018 9:01 am

Can't do video, seems like I have block (-) in G13 config to myself :innocent_smile_1: , later i'll rebuild.
Try this 'mxyc' instead written in script.
Code: Select all
 
const uint8 mxyc[] = {
            0xFF, 0x05, 0x00, 0x00, 0xFF, 0x00, 0x1E, 0x14, 0xC2, 0x14, 0xC2, 0x00,
            0x60, 0x00, 0x00, 0x01, 0x15, 0x03, 0x05, 0x05, 0x80, 0x08, 0x6C, 0x0B,
            0xB8, 0x0F, 0x59, 0x13, 0x48, 0x17, 0x7F, 0x1B, 0xF9, 0x20, 0xB1, 0x25,
            0xA5, 0x2A, 0xD2, 0x30, 0x35, 0x35, 0xCB, 0x3B, 0x94, 0x41, 0x8C, 0x47,
            0xB4, 0x4E, 0x08, 0x54, 0x88, 0x5B, 0x33
    };
User avatar
sky418
Command Sergeant Major
Command Sergeant Major
 
Posts: 124
Joined: Fri Nov 25, 2016 4:28 am

Re: Splatoon 2 + Titan two

Postby osbor » Tue Apr 10, 2018 2:41 am

those values are...problematic, the x axis feels extremely sluggish now at slow speeds and the acceleration ramps up dramatically.

just to confirm, what mouse DPI and ingame sens are you developing with? i want to match that
User avatar
osbor
Master Sergeant
Master Sergeant
 
Posts: 41
Joined: Sun Oct 08, 2017 12:19 am

Re: Splatoon 2 + Titan two

Postby sky418 » Tue Apr 10, 2018 5:17 am

In game - Tv Mode - Sensitivity 2 - 2.5 (now) but when it was default nothing real change.
Mouse Logitech G - 502 (8000 DPI)
T2 Device Configuration - 8000 DPI
Curve
1.png
My Curve
1.png (36.37 KiB) Viewed 6824 times

I think you needed something like that
2.png
I think you needed something like that
2.png (36.4 KiB) Viewed 6824 times

Make your own, there no one helps you like you want it to be
User avatar
sky418
Command Sergeant Major
Command Sergeant Major
 
Posts: 124
Joined: Fri Nov 25, 2016 4:28 am

Re: Splatoon 2 + Titan two

Postby osbor » Tue Apr 10, 2018 12:02 pm

oh! no wonder it felt weirdly slow, i was going by your earlier post and dropped down to 3000 dpi, whoops
User avatar
osbor
Master Sergeant
Master Sergeant
 
Posts: 41
Joined: Sun Oct 08, 2017 12:19 am

Re: Splatoon 2 + Titan two

Postby nspl » Wed May 09, 2018 3:03 pm

Code: Select all
 
#include <switch.gph>
#include <mouse.gph>
 
#define MAXGX 45.0
#define DEFAULT_MMY 0.0
#define MAX_ROUND 300.0
 
const uint8 kmap[] = { 0xE3, 0x00, 0x29, 0x0F, 0x3A, 0x0D, 0x3B, 0x10, 0x3C, 0x02, 0x28, 0x0E, 0x52, 0x09, 0x51, 0x0A, 0x50, 0x0B, 0x4F, 0x0C, 0x1A, 0x98, 0x04, 0x97, 0x16, 0x18, 0x07, 0x17, 0x2C, 0x0F, 0x14, 0x06, 0x08, 0x03, 0x09, 0x05, 0xE1, 0x07, 0x2B, 0x0D, 0x3D, 0x01, 0x3E, 0x12, 0x3F, 0x13, 0x40, 0x14 };
const uint8 mmap[] = { 0x00, 0x15, 0x01, 0x96, 0x05, 0x04, 0x06, 0x03, 0x07, 0x10, 0x08, 0x0E };
const uint8 mxyc[] = { 0xFF, 0x00, 0x0F, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0xFE, 0x00, 0x05, 0x0A, 0x0F, 0x14, 0x19, 0x1E, 0x23, 0x28, 0x2D, 0x32, 0x37, 0x3C, 0x41, 0x46, 0x4B, 0x50, 0x55, 0x5A, 0x5F, 0x64 };
 
bool y_toggle = FALSE;
fix32 mmy;
 
init {
    keymapping(kmap);
    mousemapping(mmap);
    mxyconverter(mxyc);
    mmy = DEFAULT_MMY;
}
main {
    set_val(SWITCH_ACCZ,0.0 );
    set_val(SWITCH_ACCY,0.0 );
    set_val(SWITCH_GYROZ, 0.0 );
    set_val(SWITCH_GYROY, 0.0 );
    set_val(SWITCH_GYROX, 0.0 );
    set_val(SWITCH_ACCX, 0.0);
    check_rapid();
    gyro_aim();
}
 
void check_rapid(){
    if(mouse_status(MBUTTON_1))combo_run(rapid_fire);
}
combo rapid_fire {
    set_val(SWITCH_ZR,100.0);
    wait(38);
    set_val(SWITCH_ZR,0.0);
    wait(16);
    set_val(SWITCH_ZR,0.0);
}
 
fix32 gyro_rand(){
    return 0.075 - ( rand() * 0.15 );
}
 
void gyro_aim(){
    if(event_active(SWITCH_Y)) {
        y_toggle = !y_toggle;
        mmy = DEFAULT_MMY;
    }
    if(y_toggle) {
        set_val(SWITCH_Y, 100.0);
    }
 
    fix32 my = get_val(SWITCH_RY) / 100.0;
    mmy = clamp( mmy + my , -MAXGX , MAXGX );
    set_val(SWITCH_ACCY, MAX_ROUND / 6.0 * sin(mmy / MAXGX) );
    if( abs(mmy) != MAXGX ){
        set_val(SWITCH_GYROX, MAX_ROUND * sin(my) );
    }
    else {
        set_val(GYRO_1_X,0.0);
    }
    set_val(SWITCH_ACCZ, abs(get_val(SWITCH_ACCY)) - 25.0  );
    set_val(SWITCH_GYROZ, MAX_ROUND * sin(get_val(STICK_1_X)/100.0) * -get_val(SWITCH_ACCZ) / 25.0 + gyro_rand()  );
    set_val(SWITCH_GYROY, MAX_ROUND* sin(get_val(STICK_1_X)/100.0) * -get_val(SWITCH_ACCY) / 25.0 + gyro_rand() );
    set_val(SWITCH_ACCX, 0.0 );
    set_val(SWITCH_RY, 0.0);
    set_val(SWITCH_RX, 0.0);
}
 
Last edited by nspl on Tue Sep 18, 2018 12:57 pm, edited 1 time in total.
User avatar
nspl
Corporal
Corporal
 
Posts: 5
Joined: Wed May 09, 2018 2:58 pm

Re: Splatoon 2 + Titan two

Postby CrazyCoder » Sun Sep 16, 2018 1:02 pm

Are there any news on the x/y mouse to gyro 1:1 translation? I've tried the above script from @nspl and it works really weird. Not sure what other settings are needed to make it work properly.

The default translator which doesn't use motion controls works pretty good, but the max speed of turns/aim is limited in this mode.

I didn't try the GPC from @sky418 yet, seems to require a lot of manual remappings/editing, also it seems to work for Y only using gyro, so will not help with quick 180 turns in game.

Titan Two is great, was very easy to set up and use. I've already coded a small improvement for Splatoon 2 which provides stealth movement underwater while holding Shift key (map Shift or whatever key you want to BUTTON_20, rapid fire toggle is mapped to BUTTON_21, will add auto jump and auto hide from sky418 script later): https://pastebin.com/raw/HMZh0Nbq.

Diagonal moves in stealth mode require less input value than straight moves, the above script handles it well.
User avatar
CrazyCoder
Corporal
Corporal
 
Posts: 4
Joined: Thu Sep 13, 2018 11:13 am

Re: Splatoon 2 + Titan two

Postby J2Kbr » Mon Sep 17, 2018 3:11 pm

Welcome to our forums and thank you for your support.

CrazyCoder wrote:I've already coded a small improvement for Splatoon 2 which provides stealth movement underwater while holding Shift key (map Shift or whatever key you want to BUTTON_20, rapid fire toggle is mapped to BUTTON_21, will add auto jump and auto hide from sky418 script later): https://pastebin.com/raw/HMZh0Nbq. Diagonal moves in stealth mode require less input value than straight moves, the above script handles it well.

Nice work, if possible please publish your script on Gtuner's Online Resources (tools -> Publish), it will be a great addition to our library. :smile0517: :smile0517:
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: Splatoon 2 + Titan two

Postby nspl » Tue Sep 25, 2018 9:10 am

・ジャイロ機能付きコントローラーは接続していない状態で使ってください
Please disconnect gyro controller before using

・もし視点が上下する時はYボタン(視点リセット)を連打してください
If camera automatically moves up and down. Please press Y button(Reset camera) several times

Code: Select all
 
#include <switch.gph>
#include <mouse.gph>
 
#define MAXGX 45.0
#define DEFAULT_MMY 0.0
#define MAX_ROUND 300.0
 
// GIVMXYF:FF000F008000000002000200FE00050A0F14191E23282D32373C41464B50555A5F64
const uint8 mxyc[] = { 0xFF, 0x00, 0x0F, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0xFE, 0x00, 0x05, 0x0A, 0x0F, 0x14, 0x19, 0x1E, 0x23, 0x28, 0x2D, 0x32, 0x37, 0x3C, 0x41, 0x46, 0x4B, 0x50, 0x55, 0x5A, 0x5F, 0x64 };
 
bool y_toggle = FALSE;
fix32 mmy;
 
init {
    mxyconverter(mxyc);
    mmy = DEFAULT_MMY;
}
main {
    set_val(SWITCH_ACCZ,0.0 );
    set_val(SWITCH_ACCY,0.0 );
    set_val(SWITCH_GYROZ, 0.0 );
    set_val(SWITCH_GYROY, 0.0 );
    set_val(SWITCH_GYROX, 0.0 );
    set_val(SWITCH_ACCX, 0.0);
    gyro_aim();
}
 
fix32 gyro_rand(){
    return 0.075 - ( rand() * 0.15 );
}
 
void gyro_aim(){
    if(event_active(SWITCH_Y)) {
        y_toggle = !y_toggle;
        mmy = DEFAULT_MMY;
    }
    if(y_toggle) {
        set_val(SWITCH_Y, 100.0);
    }
 
    fix32 my = get_val(SWITCH_RY) / 100.0;
    mmy = clamp( mmy + my , -MAXGX , MAXGX );
    set_val(SWITCH_ACCY, MAX_ROUND / 6.0 * sin(mmy / MAXGX) );
    if( abs(mmy) != MAXGX ){
        set_val(SWITCH_GYROX, MAX_ROUND * sin(my) );
    }
    else {
        set_val(GYRO_1_X,0.0);
    }
    set_val(SWITCH_ACCZ, abs(get_val(SWITCH_ACCY)) - 25.0  );
    set_val(SWITCH_GYROZ, MAX_ROUND * sin(get_val(STICK_1_X)/100.0) * -get_val(SWITCH_ACCZ) / 25.0 + gyro_rand()  );
    set_val(SWITCH_GYROY, MAX_ROUND* sin(get_val(STICK_1_X)/100.0) * -get_val(SWITCH_ACCY) / 25.0 + gyro_rand() );
    set_val(SWITCH_ACCX, 0.0 );
    set_val(SWITCH_RY, 0.0);
    set_val(SWITCH_RX, 0.0);
}
 
Last edited by nspl on Fri Sep 28, 2018 11:52 pm, edited 2 times in total.
User avatar
nspl
Corporal
Corporal
 
Posts: 5
Joined: Wed May 09, 2018 2:58 pm

Re: Splatoon 2 + Titan two

Postby CrazyCoder » Wed Sep 26, 2018 7:37 am

Thanks, @nspl!

I've got it working. If you are using the input translator, Mouse XY Converter settings must be reset to the defaults for the above script to work correctly (the GPC script has its own mouse translation). Also disconnect any joysticks from the Titan, otherwise they will send random values for X/Y axis even if the stick is slightly decentered, it will screw up the gyro aim code and the aim will constantly drift.

It works much better than the stock input translator, allowing fast turns and moves.
User avatar
CrazyCoder
Corporal
Corporal
 
Posts: 4
Joined: Thu Sep 13, 2018 11:13 am

PreviousNext

Return to GPC2 Script Programming

Who is online

Users browsing this forum: kubawaz and 69 guests