[MOD][1.6] 2 Mice multiplayer on single PC (Windows only)
Posted: 11 Mar 2012, 17:40
by fakeuser
2 mice multiplayer on single PC
And yes, this is not a joke. It's the end product of this topic (thanks, ducharles)
What is needed is stated there, but I'll try to make a detailed tutorial here as well.
Now second mouse is exchanged with crosshair while in game window. And yes, it should not be flashy. And yes, you may change it. It is located in the graphics subfolder of your game (if you are using the standalone) or in the graphics subfolder of 2MiceMod folder (for loader users).
Now premade packages available to be loaded with Mod Loader and Mari0 Modding System. Details are found under standalone install instructions (meaning bottom of post). 2 mice multiplayer is actually compatible with ANY mod that does not modify mario:updateangle method of base game. If you do not know how to load it without using mod loader, feel free to ask for help. It's as easy as downloading one premaid pack and adding one line of code.
Now F12 captures (or releases) both cursors in the game
You get two cursors only if Mari0 window is focused! (it's sometimes buggy. If you get two cursors no matter which window is focused, try editing the .bat file with Notepad and removing the "/run /tray" part. This way script will be loaded but you will have to run it manually.)
Laptop users may use one external mouse and onboard device or two external mice (detected automatically)
Support for two mice point and shoot interface.
Changelog
18 March 2012 in version 2.3 the second (fake) Cursor is exchanged with new crosshair. You may change it, but please, use 16x16 image. The pointer is in the center of the used image.
17 March 2012 Mari0 1.6 is now supported. You know where to grab the new release.
16 March 2012 Mari0 1.5 is now supported. Standalone version of the mod may be grabbed from latest release section of this post. Loader packages are not changed but they support 1.5 version of the game. It's up to loaders' authors when their mods will support Mari0 1.5
later on 12 March 2012v2.2 - thanks to xPi's idea and code, and to TiagoTiago's demand, F12 now captures both real and fake cursors.
12 March 2012v2.1 - thanks to user comments - no more "do not move the window" rule + 2 cursors only if you have mari0 on focus
later on 11 March 2012v2 - improved game logic
11 March 2012v1 - First mod. Bugged and lame
It wasn't supposed to be like firefox constant updates but...
General Info
This is a minor modification of the original code. It allows you to use two mice for two different characters in mari0, both of wich have point and shoot controls either with one of the mice. It uses PPJoy virtual joysticks driver and GlovePIE programmable emulator, so it's windows only solution. The main idea is reading two mice values and emulating two joysticks with axes. Code modification allows you to have point and click by recalculating the click point. However you will have to leave the game window centered and not move it (The "do not move the window" rule is back again). Laptop users with onboard pointing device or touchpad - I have your back covered. You may use onboard and one external mouse, or two external mice instead. However if you have two (or even more?) onboard mouse equivalents you will have to manually mod the pie script
Installing as standalone mod
Prerequisites
Download PPJoy. You may use the download link in their blog or install a newer version if you find one. The linked installer can bypass windows 7x64 mandatory driver signing
Download GlovePIE. Yeah, we all know that their site has been hacked, but xPi stated that the direct download still works (click here). If you do not believe that hackers did not change the executable, read the linked topic or use google
Download love2d. You need version 0.8.0 (if you don't have it already). You may grab the latest windows build from here
Download my mod(Link for Mari0 1.4 version is provided in the latest standalone releases above). It's mari0 1.4 with a little modification in mario.lua > mario:updateangle(). You may find my modifications by searching for fakeuser in the comments. The linked file contains emulator configurations and batch scripts, so just posting the code won't do for you.
Installing 3rd party software
The hardest part - installing PPjoy. If you are running windows 7 with mandatory signing, you will have to follow the next steps:
open an elevated command propt (Start button > type cmd > right click the search result > Open as administrator)
You should get a succeffully passed operation message. Reboot your OS. You should get a "Test mode Windows 7 Build x" text in the lower right corner of your desktop. Bear with it, as you need this testing mode to use the PPJoy drivers
Now launch PPJoy installer and confirm that you want to install drivers even though windows is not the author (if asked).
Install GlovePIE. Nothing really special here...
Install Love. Easy
Preconfigs
Configure two joysticks. You may do this with launching Start > PPjoy joystick Driver > Configure Joysticks or from Control Panel. If you're too lazy to folow the attached doc in the linked forum in the linked topic, here's what you have to do:
Click Add. Leave default options for virtual joysticks even if they are not greyed out. Add two controllers
Select one of them and click mapping. Choose Set a custom mapping for this controller
Add Love to system path. What does this mean?! doh...
Right click My computer Icon and Click properties
Find and click Advanced system settings
Click Environment variables. Under the system variables part of the window search for PATH (ignoring the case differences), select it and click edit
DO NOT DELETE ANYTHING. Just go to the end of the string, add a semicolon (;)and add the path to the folder in wich is located love.exe (e.g. C:\Program Files (x86)\LOVE)
Click OK everywhere
Add GlovePIE to system path (Do the same for GlovePIE.exe directory)
What a long tutorial... Almost done though Apply the mod
Open the downloaded zip file (yes! finally the mod itself)
Extract all the files where your mari0_1.4.exe is.
Post configs Please reboot for all changes to be applied. This is windows after all...
And.. Thats it, you're ready. Do not forget to attach second mouse or else you will have to restart the pie script. Launch the two_mice_coop.bat. It should launch the mari0_1.4_coop.love (the moded game) and the GlovePIE emulator with two mice script - minimized to system tray. If you are running Vista or above it will be asking for admin permissions (probably in the background o.O). Be sure to grant them. If all went well you should get an extra cursor with number 2 in its lower right corner. Configure mari0 so none of the players is mouse owner - you see cursors, but mari0 sees two joysticks. When setting the AimX and AimY be sure to move the mouse in right (for x) and up (for y). After you've closed the game be sure to stop the pie script - open GlovePIE (it's still minimized to the system tray) and quit it. You should use your false mouse to do that. Why? Read the documentation of GlovePIE. Or simply - the other one will not do.
There was a bonus mentioned. What is it?!
I've packed my two-player pie script for single mouse. It's not as cool, but works if you have only one mouse. You may launch it with single_mouse_coop.bat. It however does not use the moded game and executes the original mari0_1.4.exe, so if you have renamed it or use source distribution, then you will have to manually edit the batch file. I believe you can. Note:You should set one of the players as mouse owner and configure the other with the 2mice script. Then you may use / and * to increase and decrease the angle of the portal gun and as well control the rotation step with Del and Insert. These mappings may be changed in the pie script.
Installing with available mod system
Currently premade packages for Mod Loader and Mari0 Modding System are available. To use them:
save main.lua and get it back in the love file (using... WinZip?) and overwrite the old one. Close the archive
Proceed with starting glovepie, loading the pie script and launching the game from your mod
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 11 Mar 2012, 19:05
by fakeuser
Updated
I have reviewed my code and found how dumb was I early in the morning. Now it's fixed and you should redownload it. Replacing the .love file with the new one will do.
Changes: Calculating coordinats of fake mice Consequences: If you have already tested the previous version. you will have to remap your keys because of changed logic. Axes x should be positive and axes y should be negative, meaning move the mouse right and up when mapping.
Edit:
An example for mapping (just to show how axes should be mapped)
P.s. If someone has a better idea for filehosting, I'm waitng
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
If (Window.Title == "Mari0") Then
// Modded version of MouseParty.pie
// The real cursor is now only controlled by mouse 1 or mouse 3 if present
mouse.Swallow = true
cursor.Visible = true
var.ActiveAreaLeft = Window.Left
var.ActiveAreaTop = (Window.Top + Window.Height) - Window.ClientHeight
var.ActiveAreaRight = Window.Left + window.Width
var.ActiveAreaBottom = Window.Top + Window.Height
//laptop bypass for two externa mice by fakeuser
if mouse3.present then
// How much has mouse 3 moved?
var.deltax1 = Delta(mouse3.DirectInputX)
var.deltay1 = Delta(mouse3.DirectInputY)
// Mouse ballistics attempt
var.velocity = ([(smooth(var.deltaX1) / 24ms) in inches per second, (smooth(var.deltaY1) / 24ms) in inches per second] )
var.speed = |var.velocity|
if var.speed <= 0.2 then
var.deltax1 = var.deltax1 * 2
var.deltay1 = var.deltay1 * 2
endif
if var.speed > 0.2 and var.speed <= 0.4 then
var.deltax1 = var.deltax1 * 4
var.deltay1 = var.deltay1 * 4
endif
if var.speed > 0.4 and var.speed <= 1.25 then
var.deltax1 = var.deltax1 * 7
var.deltay1 = var.deltay1 * 7
endif
if var.speed > 1.25 and var.speed <= 3.9 then
var.deltax1 = var.deltax1 *12 //* 7
var.deltay1 = var.deltay1 *12 //* 7
endif
if var.speed > 3.9 then
var.deltax1 = var.deltax1 * 20// * 13.77
var.deltay1 = var.deltay1 * 20// * 13.77
endif
var.mouse1x = EnsureRange((var.mouse1x in pixels) + (var.deltax1 in pixels), var.ActiveAreaLeft, var.ActiveAreaRight)
var.mouse1y = EnsureRange((var.mouse1y in pixels) + (var.deltay1 in pixels), var.ActiveAreaTop, var.ActiveAreaBottom)
mouse.CursorPosX = var.mouse1x in pixels
mouse.CursorPosY = var.mouse1y in pixels
mouse.LeftButton = mouse3.LeftButton
mouse.RightButton = mouse3.RightButton
mouse.MiddleButton = mouse3.MiddleButton
mouse.XButton1 = mouse3.XButton1
mouse.XButton2 = mouse3.XButton2
//end bypass
else
// How much has mouse 1 moved?
var.deltax1 = Delta(mouse1.DirectInputX)
var.deltay1 = Delta(mouse1.DirectInputY)
// Mouse ballistics attempt
var.velocity = ([(smooth(var.deltaX1) / 24ms) in inches per second, (smooth(var.deltaY1) / 24ms) in inches per second] )
var.speed = |var.velocity|
if var.speed <= 0.2 then
var.deltax1 = var.deltax1 * 2
var.deltay1 = var.deltay1 * 2
endif
if var.speed > 0.2 and var.speed <= 0.4 then
var.deltax1 = var.deltax1 * 4
var.deltay1 = var.deltay1 * 4
endif
if var.speed > 0.4 and var.speed <= 1.25 then
var.deltax1 = var.deltax1 * 7
var.deltay1 = var.deltay1 * 7
endif
if var.speed > 1.25 and var.speed <= 3.9 then
var.deltax1 = var.deltax1 *12 //* 7
var.deltay1 = var.deltay1 *12 //* 7
endif
if var.speed > 3.9 then
var.deltax1 = var.deltax1 * 20// * 13.77
var.deltay1 = var.deltay1 * 20// * 13.77
endif
var.mouse1x = EnsureRange((var.mouse1x in pixels) + (var.deltax1 in pixels), var.ActiveAreaLeft, var.ActiveAreaRight)
var.mouse1y = EnsureRange((var.mouse1y in pixels) + (var.deltay1 in pixels), var.ActiveAreaTop, var.ActiveAreaBottom)
mouse.CursorPosX = var.mouse1x in pixels
mouse.CursorPosY = var.mouse1y in pixels
mouse.LeftButton = mouse1.LeftButton
mouse.RightButton = mouse1.RightButton
mouse.MiddleButton = mouse1.MiddleButton
mouse.XButton1 = mouse1.XButton1
mouse.XButton2 = mouse1.XButton2
endif
// Show a fake cursor 2
if mouse2.present but not var.shown2 then
cursor2.visible = true
var.Mouse2x = mouse.CursorPosX
var.Mouse2y = mouse.CursorPosY
var.shown2 = true
endif
// Do mouse pointer 2
if mouse2.present then
// How much has mouse 2 moved?
var.deltax2 = Delta(mouse2.DirectInputX)
var.deltay2 = Delta(mouse2.DirectInputY)
// Mouse ballistics attempt
var.velocity = ([(smooth(var.deltaX2) / 24ms) in inches per second, (smooth(var.deltaY2) / 24ms) in inches per second] )
var.speed = |var.velocity|
if var.speed <= 0.2 then
var.deltax2 = var.deltax2 * 2
var.deltay2 = var.deltay2 * 2
endif
if var.speed > 0.2 and var.speed <= 0.4 then
var.deltax2 = var.deltax2 * 4
var.deltay2 = var.deltay2 * 4
endif
if var.speed > 0.4 and var.speed <= 1.25 then
var.deltax2 = var.deltax2 * 7
var.deltay2 = var.deltay2 * 7
endif
if var.speed > 1.25 and var.speed <= 3.9 then
var.deltax2 = var.deltax2 *12 //* 7
var.deltay2 = var.deltay2 *12 //* 7
endif
if var.speed > 3.9 then
var.deltax2 = var.deltax2 * 20// * 13.77
var.deltay2 = var.deltay2 * 20// * 13.77
endif
var.Mouse2x = EnsureRange(var.Mouse2x pixels + (var.deltax2 in pixels), var.ActiveAreaLeft, var.ActiveAreaRight)
var.Mouse2y = EnsureRange(var.Mouse2y pixels + (var.deltay2 in pixels), var.ActiveAreaTop, var.ActiveAreaBottom)
endif
Cursor2.PosX = var.Mouse2x
Cursor2.PosY = var.Mouse2y
Cursor2.LeftButton = mouse2.LeftButton
Cursor2.RightButton = mouse2.RightButton
Cursor2.MiddleButton = mouse2.MiddleButton
//Fakeuser code begins here again
//Players config
//player 1
PPJoy1.Analog0 = EnsureMapRange(var.Mouse1x , var.ActiveAreaLeft, var.ActiveAreaRight, -1, 1)
PPJoy1.Analog1 = EnsureMapRange(var.Mouse1y , var.ActiveAreaTop, var.ActiveAreaBottom, -1, 1)
PPJoy1.Digital0 = Key.Up
PPJoy1.Digital1 = Key.Down
PPJoy1.Digital2 = Key.Left
PPJoy1.Digital3 = Key.Right
// another second external mouse bypass for laptops
if mouse3.present then
PPJoy1.Digital4 = Mouse3.LeftButton
PPJoy1.Digital5 = Mouse3.RightButton
else
PPJoy1.Digital4 = Mouse1.LeftButton
PPJoy1.Digital5 = Mouse1.RightButton
endif
PPJoy1.Digital6 = Key.RightShift
PPJoy1.Digital7 = Key.NumPadEnter
PPJoy1.Digital8 = Key.NUMPAD0
PPJoy1.Digital9 = Key.RightCtrl
// player 2
PPJoy2.Analog0 = EnsureMapRange(var.Mouse2x, var.ActiveAreaLeft, var.ActiveAreaRight, -1, 1)
PPJoy2.Analog1 = EnsureMapRange(var.Mouse2y, var.ActiveAreaTop, var.ActiveAreaBottom, -1, 1)
PPJoy2.Digital0 = Key.W
PPJoy2.Digital1 = Key.S
PPJoy2.Digital2 = Key.A
PPJoy2.Digital3 = Key.D
PPJoy2.Digital4 = Mouse2.LeftButton
PPJoy2.Digital5 = Mouse2.RightButton
PPJoy2.Digital6 = Key.LeftShift
PPJoy2.Digital7 = Key.Space
PPJoy2.Digital8 = Key.R
PPJoy2.Digital9 = Key.E
else
mouse.Swallow = False
cursor2.Visible = False
endif
But now the cursors are misaligned, the few attempts i made to realign them didn't seem to work the way i expected, i'm not sure how to make sense of this; any idea what i'm doing wrong? Or is the issue in the moded Mari0 code?
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 12 Mar 2012, 12:58
by fakeuser
Wow.. I never imagined you could get window bounds from within glovepie.. Yeah, I think I can give you a clue - the problem is that glove pie gets the window frame bounds (the one with the icon and the min, max, close buttons) and in the game I'm recalculating coordinates using the game field size (top left corner of love2d to right lower). Anyway, it should not be that hard to fix this even with some hardcoded numbers. I''ll see if it can be done nicely and post back
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
I had also coded somthing to handle different window border thickness but it turns out the unredimensionable window of Mari0 never has thicker borders, at least in WinXP; so removed that bit of code.
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 12 Mar 2012, 13:09
by xPi
hi, I am going to try and implement an OSC receiver in lua. at least with that we could cut dependence on ppjoy. this would be useful if
someone doesn't want to go to the trouble of running their 64-bit windows in test signing mode
// when game is windowed,
// middleX is left edge + half width
// middleY is window.top + window.height - bottom border - clientheight/2
// in windows, bottom border height is same as left border width
var.leftborder = (window.Width - window.ClientWidth) / 2
var.middleX = window.Left + window.Width / 2
var.middleY = window.Top + window.Height - var.leftborder - window.ClientHeight/2
var.topborder = window.Height - window.ClientHeight - var.leftborder
// -snip-
//clamp mouse inside gamescreen (windowed)
var.x = max(var.x,window.Left+var.leftborder)
var.x = min(var.x,window.Left+var.leftborder+window.ClientWidth-1)
var.y = max(var.y,window.Top+var.topborder)
var.y = min(var.y,window.Top+var.topborder+window.ClientHeight-1)
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 12 Mar 2012, 13:12
by TiagoTiago
OSC even works over LAN (i guess it might work over the Internet itself even, dunno if the lag and ISP limitations etc would get in the way though); you could use a WiFi enabled laptop as a wireless controller to play, with each person with a full set of keyboard and mouse!!! :P
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 12 Mar 2012, 13:13
by xPi
my phone has a bunch of OSC apps.. and also lua scripting
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 12 Mar 2012, 13:43
by fakeuser
xPi go ahead, I hate being in test signing mode myself. I'm not much of a lua coder but when I find the time will take a look at OSC as well. But I think you will have to bypass basegame controls too as it wants to read joystick input
Anyway TiagoTiago I saw you did some maths. I just moded your logic a little and here's what came out:
// cool new feature by TiagoTiago
If (Window.Title == "Mari0") Then
// Modded version of MouseParty.pie
// The real cursor is now only controlled by mouse 1 or mouse 3 if present
mouse.Swallow = true
cursor2.Visible = true
var.border = (Window.Width - Window.ClientWidth) / 2
// Somewhat revised by fakeuser
var.ActiveAreaLeft = Window.Left + var.border
var.ActiveAreaTop = Window.Top + window.Height - window.ClientHeight - var.border
var.ActiveAreaRight = var.ActiveAreaLeft + window.ClientWidth - 1
var.ActiveAreaBottom = var.ActiveAreaTop + Window.ClientHeight - 1
// Modded version of MouseParty.pie
// The real cursor is now only controlled by mouse 1 or mouse 3 if present
//laptop bypass for two externa mice by fakeuser
if mouse3.present then
fakemouse.DirectInputX = mouse3.DirectInputX
fakemouse.DirectInputY = mouse3.DirectInputY
mouse.LeftButton = mouse3.LeftButton
mouse.RightButton = mouse3.RightButton
mouse.MiddleButton = mouse3.MiddleButton
mouse.XButton1 = mouse3.XButton1
mouse.XButton2 = mouse3.XButton2
//end bypass
else
fakemouse.DirectInputX = mouse1.DirectInputX
fakemouse.DirectInputY = mouse1.DirectInputY
mouse.LeftButton = mouse1.LeftButton
mouse.RightButton = mouse1.RightButton
mouse.MiddleButton = mouse1.MiddleButton
mouse.XButton1 = mouse1.XButton1
mouse.XButton2 = mouse1.XButton2
endif
// Show a fake cursor 2
if mouse2.present but not var.shown2 then
cursor2.visible = true
var.Mouse2x = mouse.CursorPosX
var.Mouse2y = mouse.CursorPosY
var.shown2 = true
endif
// Do mouse pointer 2
if mouse2.present then
// How much has mouse 2 moved?
var.deltax2 = Delta(mouse2.DirectInputX)
var.deltay2 = Delta(mouse2.DirectInputY)
// Mouse ballistics attempt
var.velocity = ([(smooth(var.deltaX2) / 24ms) in inches per second, (smooth(var.deltaY2) / 24ms) in inches per second] )
var.speed = |var.velocity|
if var.speed <= 0.2 then
var.deltax2 = var.deltax2 * 2
var.deltay2 = var.deltay2 * 2
endif
if var.speed > 0.2 and var.speed <= 0.4 then
var.deltax2 = var.deltax2 * 4
var.deltay2 = var.deltay2 * 4
endif
if var.speed > 0.4 and var.speed <= 1.25 then
var.deltax2 = var.deltax2 * 7
var.deltay2 = var.deltay2 * 7
endif
if var.speed > 1.25 and var.speed <= 3.9 then
var.deltax2 = var.deltax2 *12 //* 7
var.deltay2 = var.deltay2 *12 //* 7
endif
if var.speed > 3.9 then
var.deltax2 = var.deltax2 * 20// * 13.77
var.deltay2 = var.deltay2 * 20// * 13.77
endif
var.Mouse2x = var.Mouse2x pixels + (var.deltax2 in pixels)
var.Mouse2y = var.Mouse2y pixels + (var.deltay2 in pixels)
if var.Mouse2x < screen.DesktopLeft then var.Mouse2x = screen.DesktopLeft
if var.Mouse2x > screen.DesktopRight then var.Mouse2x = screen.DesktopRight
if var.Mouse2y < screen.DesktopTop then var.Mouse2y = screen.DesktopTop
if var.Mouse2y > screen.DesktopBottom then var.Mouse2y = screen.DesktopBottom
endif
Cursor2.PosX = var.Mouse2x
Cursor2.PosY = var.Mouse2y
Cursor2.LeftButton = mouse2.LeftButton
Cursor2.RightButton = mouse2.RightButton
Cursor2.MiddleButton = mouse2.MiddleButton
//Fakeuser code begins here again
//Players config
//player 1
PPJoy1.Analog0 = MapRange(mouse1.CursorPosX, var.ActiveAreaLeft, var.ActiveAreaRight, -1, 1)
PPJoy1.Analog1 = MapRange(mouse1.CursorPosY, var.ActiveAreaTop, var.ActiveAreaBottom, -1, 1)
PPJoy1.Digital0 = Key.Up
PPJoy1.Digital1 = Key.Down
PPJoy1.Digital2 = Key.Left
PPJoy1.Digital3 = Key.Right
// another second external mouse bypass for laptops
if mouse3.present then
PPJoy1.Digital4 = Mouse3.LeftButton
PPJoy1.Digital5 = Mouse3.RightButton
else
PPJoy1.Digital4 = Mouse1.LeftButton
PPJoy1.Digital5 = Mouse1.RightButton
endif
PPJoy1.Digital6 = Key.RightShift
PPJoy1.Digital7 = Key.NumPadEnter
PPJoy1.Digital8 = Key.NUMPAD0
PPJoy1.Digital9 = Key.RightCtrl
// player 2
PPJoy2.Analog0 = MapRange(var.Mouse2x, var.ActiveAreaLeft, var.ActiveAreaRight, -1, 1)
PPJoy2.Analog1 = MapRange(var.Mouse2y, var.ActiveAreaTop, var.ActiveAreaBottom, -1, 1)
PPJoy2.Digital0 = Key.W
PPJoy2.Digital1 = Key.S
PPJoy2.Digital2 = Key.A
PPJoy2.Digital3 = Key.D
PPJoy2.Digital4 = Mouse2.LeftButton
PPJoy2.Digital5 = Mouse2.RightButton
PPJoy2.Digital6 = Key.LeftShift
PPJoy2.Digital7 = Key.Space
PPJoy2.Digital8 = Key.R
PPJoy2.Digital9 = Key.E
else
mouse.Swallow = false
Cursor2.visible = false
endif
No misalignment for me. Take a look, I'm gonna update gamepack. And yeah, thanks for showing me the way how to remove the stupid window moving rule
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 12 Mar 2012, 13:58
by fakeuser
New version released. You may grab it from the latest version link in the first post of the topic, or just edit manually the Mari0_2mice.pie script. Modifications are in the post above.
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 12 Mar 2012, 18:00
by TiagoTiago
I'm still getting the misalignment
(both players have their respective cursors at exactly the middle of that floating block)
Btw, your new version doesn't trap the cursors inside the window anymore...
Oh, and about OSC; can't you just feed the OSC data to the joystick functions and make OSC stuff appear as additional joysticks internally?
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 12 Mar 2012, 19:29
by killer64
-snip- axes are messed up, ill have to try again
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 12 Mar 2012, 19:30
by fakeuser
Well I don't really get how you manage to acomplish that
Are you sure you have the new .love file? The older one had some hardcoded 16px displacment to the right (as I was extremely dumb and sleeping)
And my mod never tried to capture the mouse inside the game.. that was xPi's idea. I used the built-in F12 shortcut. You are right I should add this in my script as well.
About the OSC. I had a similar idea, but started coding in lua like yesterday, so haven't found what and how to do yet. You are free to do it and share with us, if you know what you are doing
P.s. I'm getting some strange bug with GlovePIE. If I start GlovePIE alone and then launch mari0.love it works as expected, but when I use the batch file (which actually does the same) I get 2 cursors no matter which is the focused window. Anybody have some clues?
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 12 Mar 2012, 19:37
by fakeuser
killer64 wrote:-snip- axes are messed up, ill have to try again
I hope you went to options menu and actually set all players not to own the mouse and set controls with emulator running?
P.s. If he gets another problem that sums it up. You run XP and I run 7. Or maybe you've downloaded another version of GlovePIE? I'm runninv v0.43
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 12 Mar 2012, 20:03
by fakeuser
TiagoTiago wrote:Btw, your new version doesn't trap the cursors inside the window anymore...
// cool new feature by TiagoTiago
If (Window.Title == "Mari0") Then
// Modded version of MouseParty.pie
// The real cursor is now only controlled by mouse 1 or mouse 3 if present
mouse.Swallow = true
cursor2.Visible = true
var.border = (Window.Width - Window.ClientWidth) / 2
// Somewhat revised by fakeuser
var.ActiveAreaLeft = Window.Left + var.border
var.ActiveAreaTop = Window.Top + window.Height - window.ClientHeight - var.border
var.ActiveAreaRight = var.ActiveAreaLeft + window.ClientWidth - 1
var.ActiveAreaBottom = var.ActiveAreaTop + Window.ClientHeight - 1
if key.F12 then
var.capture = not var.capture
wait 2s
endif
// Modded version of MouseParty.pie
// The real cursor is now only controlled by mouse 1 or mouse 3 if present
//laptop bypass for two externa mice by fakeuser
if mouse3.present then
fakemouse.DirectInputX = mouse3.DirectInputX
fakemouse.DirectInputY = mouse3.DirectInputY
mouse.LeftButton = mouse3.LeftButton
mouse.RightButton = mouse3.RightButton
mouse.MiddleButton = mouse3.MiddleButton
mouse.XButton1 = mouse3.XButton1
mouse.XButton2 = mouse3.XButton2
//end bypass
else
fakemouse.DirectInputX = mouse1.DirectInputX
fakemouse.DirectInputY = mouse1.DirectInputY
mouse.LeftButton = mouse1.LeftButton
mouse.RightButton = mouse1.RightButton
mouse.MiddleButton = mouse1.MiddleButton
mouse.XButton1 = mouse1.XButton1
mouse.XButton2 = mouse1.XButton2
endif
// Show a fake cursor 2
if mouse2.present but not var.shown2 then
cursor2.visible = true
var.Mouse2x = mouse.CursorPosX
var.Mouse2y = mouse.CursorPosY
var.shown2 = true
endif
// Do mouse pointer 2
if mouse2.present then
// How much has mouse 2 moved?
var.deltax2 = Delta(mouse2.DirectInputX)
var.deltay2 = Delta(mouse2.DirectInputY)
// Mouse ballistics attempt
var.velocity = ([(smooth(var.deltaX2) / 24ms) in inches per second, (smooth(var.deltaY2) / 24ms) in inches per second] )
var.speed = |var.velocity|
if var.speed <= 0.2 then
var.deltax2 = var.deltax2 * 2
var.deltay2 = var.deltay2 * 2
endif
if var.speed > 0.2 and var.speed <= 0.4 then
var.deltax2 = var.deltax2 * 4
var.deltay2 = var.deltay2 * 4
endif
if var.speed > 0.4 and var.speed <= 1.25 then
var.deltax2 = var.deltax2 * 7
var.deltay2 = var.deltay2 * 7
endif
if var.speed > 1.25 and var.speed <= 3.9 then
var.deltax2 = var.deltax2 *12 //* 7
var.deltay2 = var.deltay2 *12 //* 7
endif
if var.speed > 3.9 then
var.deltax2 = var.deltax2 * 20// * 13.77
var.deltay2 = var.deltay2 * 20// * 13.77
endif
var.Mouse2x = var.Mouse2x pixels + (var.deltax2 in pixels)
var.Mouse2y = var.Mouse2y pixels + (var.deltay2 in pixels)
if var.capture then
if var.Mouse2x < var.ActiveAreaLeft then var.Mouse2x = var.ActiveAreaLeft
if var.Mouse2x > var.ActiveAreaRight then var.Mouse2x = var.ActiveAreaRight
if var.Mouse2y < var.ActiveAreaTop then var.Mouse2y = var.ActiveAreaTop
if var.Mouse2y > var.ActiveAreaBottom then var.Mouse2y = var.ActiveAreaBottom
else
if var.Mouse2x < screen.DesktopLeft then var.Mouse2x = screen.DesktopLeft
if var.Mouse2x > screen.DesktopRight then var.Mouse2x = screen.DesktopRight
if var.Mouse2y < screen.DesktopTop then var.Mouse2y = screen.DesktopTop
if var.Mouse2y > screen.DesktopBottom then var.Mouse2y = screen.DesktopBottom
endif
endif
Cursor2.PosX = var.Mouse2x
Cursor2.PosY = var.Mouse2y
Cursor2.LeftButton = mouse2.LeftButton
Cursor2.RightButton = mouse2.RightButton
Cursor2.MiddleButton = mouse2.MiddleButton
//Fakeuser code begins here again
//Players config
//player 1
PPJoy1.Analog0 = MapRange(mouse1.CursorPosX, var.ActiveAreaLeft, var.ActiveAreaRight, -1, 1)
PPJoy1.Analog1 = MapRange(mouse1.CursorPosY, var.ActiveAreaTop, var.ActiveAreaBottom, -1, 1)
PPJoy1.Digital0 = Key.Up
PPJoy1.Digital1 = Key.Down
PPJoy1.Digital2 = Key.Left
PPJoy1.Digital3 = Key.Right
// another second external mouse bypass for laptops
if mouse3.present then
PPJoy1.Digital4 = Mouse3.LeftButton
PPJoy1.Digital5 = Mouse3.RightButton
else
PPJoy1.Digital4 = Mouse1.LeftButton
PPJoy1.Digital5 = Mouse1.RightButton
endif
PPJoy1.Digital6 = Key.RightShift
PPJoy1.Digital7 = Key.NumPadEnter
PPJoy1.Digital8 = Key.NUMPAD0
PPJoy1.Digital9 = Key.RightCtrl
// player 2
PPJoy2.Analog0 = MapRange(var.Mouse2x, var.ActiveAreaLeft, var.ActiveAreaRight, -1, 1)
PPJoy2.Analog1 = MapRange(var.Mouse2y, var.ActiveAreaTop, var.ActiveAreaBottom, -1, 1)
PPJoy2.Digital0 = Key.W
PPJoy2.Digital1 = Key.S
PPJoy2.Digital2 = Key.A
PPJoy2.Digital3 = Key.D
PPJoy2.Digital4 = Mouse2.LeftButton
PPJoy2.Digital5 = Mouse2.RightButton
PPJoy2.Digital6 = Key.LeftShift
PPJoy2.Digital7 = Key.Space
PPJoy2.Digital8 = Key.R
PPJoy2.Digital9 = Key.E
else
mouse.Swallow = false
Cursor2.visible = false
endif
I'm not really happy with it, but it works. When F12 is pressed a flag is flipped so the fake cursor is kept inside the Mari0 window. But is there a prettier way to ignore key holding? (to get the event only in the first emulator iterration and not in all of them while holding down the key). I'm currently using wait 2s command and I honestly don't like it.
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
if pressed(key.F12) then
var.capture = not var.capture
endif
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 12 Mar 2012, 23:19
by fakeuser
I really need a thanks button here... Main post updated, you may grab the new version from the latest release link, or just get the pie file as it's the only difference
Anybody else gets misalignment?
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 13 Mar 2012, 02:34
by TiagoTiago
I still get the misalignment with the 2.2 :/
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 13 Mar 2012, 16:04
by fakeuser
Well I'm gonna test it on XP tonight
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 13 Mar 2012, 21:07
by fakeuser
TiagoTiago wrote:I still get the misalignment with the 2.2 :/
Dude.. Seriosly.. What the heck are you doing? That's what I get on my XP sp3
The mouse is in the center of the right floating block. The cursors are visible only while moving and blink like hell, but still aiming EXACTLY where I point. I only managed to mess things up by starting the game from mari0_1.4.exe and not the mari0_1.4_coop.love. In case you have done this wrong, please, start the .LOVE file and not the original exe. Furthermore I provided shots of controls somewhere above. You should match the axes controls like shown. If you still get misalignment, please, post how are you launching the game and the emulator. Provide me with LOVE and GlovePIE versions, OS you are using. And please be verbose on the how part.
P.s. You may try to hardcode some adjustments in the pie script to make it work for you. Is the displacment constant, or rises when the mouse goes further from Mario? I simply can't reproduce it, so I'm not getting ANY results
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 13 Mar 2012, 21:33
by TiagoTiago
How many monitors do you got? You think it could be somthing to do with me having 3 monitors (with one of them running on a separated video card) ?
Btw, you didn't hardcode the joystick indexes right? I got a couple physical joysticks so my PPJoys don't got the same numbers as yours...
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 13 Mar 2012, 22:10
by fakeuser
Every PC i tested on has a single monitor attached. And I believe it should not be a probled (as GlovePIE handles their coordinates correctly). You may want to assure that both
return values between -1.0 and 1.0 if mouse is in game bounds...
And no, I have not hardcoded any joystick index. I just suppose you have at least two virtual PPJoy joysticks with two analog axes named Analog0 and Analog1, and 10 buttons, named Digital0-9. Some keyboard keys are just mapped to joypad buttons (defined in the script). The mouse mapping is as follows:
coordinate center (0, 0) is the center of the game area
top left corner is recalculated as (-1.0, -1.0)
lower right corner is recalculated as (1.0, 1.0)
The only part that I modded in the game is what to do with read values from joystick axes. I do not know wich joystick, I use what the game gives to me (but it is supposed that you mapped the right one in the options menu). I use game dimensions retrieved by getWidth() and getHeigth() to get coordinates in system with (0, 0) in the center of the game area. I translate this coordinates in system that is based at (0, 0) = top left corner. Then I use the same line that calculates the rotation angle of the portal gun, that is used when you use real mouse (not emulated joystick mouse).
You could try testing on another machine perhaps?
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 15 Mar 2012, 23:29
by LightningFire
Can you make this compatible with the hat loader, because I can only either play 2 players with mouses without custom hats or custom hats without 2 players with mouses
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 15 Mar 2012, 23:58
by fakeuser
Meaning this? viewtopic.php?f=13&t=750 Mod is compatible with every other single mod of mari0 1.4 that does not modigy mario:updateangle method. I made custom archives for Mod Loader and Mari0 Modding System (currently packing and gonna release soon). Hat loader however does not provide any way for me to just plug my files somewhere.. But you may tweak hat loader so it loads my mod as well. You will just have to get the (say) Mod Loader package and load it manually in main.lua of Hat Loader.
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 16 Mar 2012, 00:43
by fakeuser
Packages for Mod Loader and Mari0 Modding System released! See first post, section Installing with available mod system for instructions. Version is not changed as this is the same version, but now you may choose not to use the standalone version. As I said before, this should be compatible with every single mod that does not modify the mario:updateangle() method. Instructions for getting it to work with random (not loader) mod can be found under the cited section of the first post.
Known bugs of ported packages
Package for Mod Loader gets "mod not loaded" error in the stack (the black window). Ignore it. Mod is loaded, it is just not a custom entity. But the loader doesn't really understand the possibility of not creating one. At least the game doesn't get crashed... (look below)
Package for Mari0 Modding System gets standard entities pack loaded as custom entities as well (well.. not tested, but I expect that might happen)They do not. This is because I do not need any entities, but the author of the loader made the absence of entities.png fatal - crashes the game. So I copied the standard entities.png. Inserted: I will silently update this mod package so it has transparent 16x16 entities.png. Just to minimize package size
Re: [MOD] 2 Mice multiplayer on single PC (Windows only)
Posted: 16 Mar 2012, 11:21
by fakeuser
Mari0 1.5 was released and now 2 Mice Mod supports it. You may grab standalone mod version from the first post's latest release section. Loader packages are not changed, but they will support Mari0 1.5 as long as the loader supports it.
Re: [MOD][1.6] 2 Mice multiplayer on single PC (Windows only
Posted: 17 Mar 2012, 14:43
by fakeuser
Added standalone version of modded Mari0 version 1.6. As usual packages for mod loaders will support the new firefox.. oops, Mari0 version as long as the loader in use supports it
Re: [MOD][1.6] 2 Mice multiplayer on single PC (Windows only
Posted: 17 Mar 2012, 16:37
by jakov
Hi there!
I've successfully installed your 2mice script; haven't played against anyone yet, but in testing it seems to work perfectly! Love it!
There are some minor points I want to feed back though:
When the game crashes for some reason (on my pc it's when I quit to desktop, which isnt really harmful) it leaves the GlovePIE open. When I start the game through the two_mice_coop.bat it opens yet another instance of GlovePIE which results in weird double second mouse effects; maybe there's a way to kill the first instance when opening again, or to force single instance mode?
Is it possible to use a third and fourth mouse? Can I use a laptop's trackpad?
Would it be possible to hide the two mice from the screen altogether? My second mouse keeps flickering, which looks ugly. Maybe its possible to create some sort of a crosshair inside the game (consisting of just a few pixels). This might be a good suggestion for the game even without multiple mice; therefore maybe maurice could adress this.
Re: [MOD][1.6] 2 Mice multiplayer on single PC (Windows only
Posted: 17 Mar 2012, 23:29
by fakeuser
I'm thinking about making the bat file terminate the glopie process after the game closes. This however leads me to some problems - the batch script has to be executed with elevated privileges (not possible for all users) and taskkill command seems to have no effect when glovepie is minimized to system tray... Also it is strange that when executed with elevated privileges, the batch script is unable to load the game as the working directory changes to system32... Still investigating on it. I'm open for suggestions. Also you could use shortcut (Shift + P + I + E) to terminate runing pie scripts and then close their glovepie windows
third and fourth - Of course. Glove PIE supports up to 16. Haven't made such a script as I find it difficult to share the keyboard. But it is possible to map more than one keyboard as well. I bet you could modify the script to do this yourself. I was thinking of making mine map all mice to virtual joysticks. And yes. You could use your laptop's trackpad. Just don't connect 2 external mice, but only one. Then the onboard one (the trackpad) will be mapped on one of the virtual joysticks
So I assume you are on XP? Yes, it is possible to hide both mice and even exchange them wih custom crosshair. I may add this for the second (fake) mouse, but think it is up to Maurice if the real one will be hidden (I just don't want to make it mandatory for all users of my mod). If you preffer invisible mouse to flashy mouse, open mari0_2mice.pie with text editor, find this code (in the begining)
save the document and try the game again. It will just make the custom cursor invisible. It will not make it a crosshair.
Re: [MOD][1.6] 2 Mice multiplayer on single PC (Windows only
Posted: 18 Mar 2012, 01:43
by fakeuser
version 2.3 is out! It's a small improvement but I'm sure you XP users will like it - the fake (second) cursor now gets hidden while the mouse is over the game window and a crosshair is drawn instead. You may even change the crosshair image - locate it in the graphics subfolder. If you change the image, make sure it is 16x16 and the name is unchanged. Loader packages are updated as well.
Re: [MOD][1.6] 2 Mice multiplayer on single PC (Windows only
Posted: 18 Mar 2012, 01:50
by fakeuser
If somebody managed to download the wrong packages, please redownload the update.. Sorry about that, the pie script included was unchanged
Re: [MOD][1.6] 2 Mice multiplayer on single PC (Windows only
Posted: 27 Mar 2012, 11:11
by ducharles
Nice job dude :). This a way more completed solution. Its working nicely, but theres a slight misalignment on my screen. The cursor with the cross-hair graphics on works spot on, but the normal mouse looking cursor is slightly misaligned and also, when I had set up the y-axis properly, for some reason to get the cursors working properly, I had to move my mouse up instead of down(the control command in the game, tells you to move up). I am using windows 7 32 bit ultimate. Though this is still a very usable mod.
Re: [MOD][1.6] 2 Mice multiplayer on single PC (Windows only
Posted: 27 Mar 2012, 19:27
by fakeuser
ducharles wrote:The cursor with the cross-hair graphics on works spot on, but the normal mouse looking cursor is slightly misaligned
You are telling me player1 has problems with aiming and player2 doesn't? Not possible - aiming is done the same way for BOTH players. Please provide me a screenshot to prove your thesis (find a map with a single brick-block floating, place both mice in its center and make screenshot). Also do you get the misalignment with player configured to be the mouse owner? Are you using other mods?
ducharles wrote:when I had set up the y-axis properly, for some reason to get the cursors working properly, I had to move my mouse up instead of down
Please, point where did I say to move the mouse down? Because that is wrong, you just have to match the screenshots in my scecond post here
Re: [MOD][1.6] 2 Mice multiplayer on single PC (Windows only
Posted: 05 Apr 2012, 19:25
by KINNG
Do I have to stay in this so called test mode?
Re: [MOD][1.6] 2 Mice multiplayer on single PC (Windows only
Posted: 05 Apr 2012, 20:02
by xPi
well, you only need to be in the test mode to use ppjoy (one of this mod's dependencies) but you can reboot out of it when not using ppjoy
Re: [MOD][1.6] 2 Mice multiplayer on single PC (Windows only
Posted: 06 Apr 2012, 11:19
by xPi
okay, I've figured out the osc stuff
glovepie 0.43 has a serious problem with encoding numbers into byte streams (source)
there is a new version of glovepie. the website is fixed apart from a rogue index.html (the real index.php [is] ok [again])
the good about this new version: numbers in osc messages are encoded properly. bad: it can't receive osc messages.. (source)
fortunately, I won't need this glovepie version to receive osc messages, but I will be making it send osc directly into mari0. I've just now got a prototype .love game to receive and decode messages with int or float in them :D
update: it now decodes true and false from osc messages, and signed int is now supported
update: added crosshairs to demo
update2 (01 Dec 2012): old news, no longer applies today
since march 2012, the glovepie.org website was hacked and the main page (index.php) was replaced with something that was utterly useless (defacement page) if you were visiting the site to download glovepie. I changed the link to the glovepie website to bypass the defacement page. just in case it happens again or if the whole site is gone, there are unofficial alternate download links below. the zip files should always match the ones downloaded from the official site, and have the following checksums:
update3: I noticed that the glovepie.org website was restored, so I reworded and improved the text in update 2
update4: glovepie's website was taken down in 2016, links now point to archived version. on 15th march 2017, dropbox has discontinued the "public folder" feature which means links with "/u/" in it are now broken. I've had to make dropbox generate fresh share links for every file I'm still sharing. the required version of love2d hasn't been "latest nightly" since may 2012. updated text to accurately state the version needed.
since google has reported that they have cracked SHA-1, I've added SHA-256 checksums for glovepie files in update2.
why did I update such an old post? I want to prevent a situation similar to "xkcd 979" where future readers can't access files I've posted.
Re: [MOD][1.6] 2 Mice multiplayer on single PC (Windows only
Posted: 06 Apr 2012, 17:35
by fakeuser
I'm not really happy with this new version as it became somewhat unresponsive (Shift + P + I + E did the trick) and it breaks my current script - the real cursor does not move when fakemouse is fed with Mouse1 data. However OSC problems of 0.43 are annoying. So you are going to make another multi-mice mod? You may get some ideas of my current implementation (e.g. for recalculating coords and painting crosshair there). If you are thinking about transferring mouse clicks as well, one way to force player i to shoot portal is
shootportal(i, 1, objects["player"][i].x+6/16, objects["player"][i].y+6/16, objects["player"][i].pointingangle) -- left portal
shootportal(i, 2, objects["player"][i].x+6/16, objects["player"][i].y+6/16, objects["player"][i].pointingangle) -- right portal
(as written in mario.lua ~2726 line)
or call the game_keypressed function, passing controls["portal1"][1], or controls["portal2"][1] as argument.
Re: [MOD][1.6] 2 Mice multiplayer on single PC (Windows only
Posted: 08 Apr 2012, 20:26
by xPi
I just realized I wanted this since 2009, to use in desmume.. so uh... killing two birds with one stone :)
been thinking a bit about how I'm gonna present this new type of input to the user, letting the user configure the controls, and how it will accept and deal with packets from remote PCs on the LAN or wherever.
Re: [MOD][1.6] 2 Mice multiplayer on single PC (Windows only
this is made to be a bit more flexible by being changeable in control settings.
all you need now is:
LÖVE from love2d.org (2014 edit: old versions, 0.8.0)
glovepie 0.45
and the download in this post
to get this version going:
plug in extra mice
run glovepie script manually
open the game
press F12 to lock the real mouse pointer
go into options > controls
on each player make sure "uses the mouse" is "no"
go to aimx, press enter and move a mouse to the right
go to aimy, set it to a mouse moving down
set portal1 to a mouse click
set portal2 to a mouse click
switch to another player's controls and repeat process with other mice
if you want, or have to because you're stuck with built-in touchpad, you can run the glovepie script on multiple computers. just edit the osc.ip line at the top to the ip you want to control
at this point you should be ready for onescreen multiplayer
edit: now supports keyboard
edit: updated dropbox link
Re: [MOD][1.6] 2 Mice multiplayer on single PC (Windows only
Posted: 03 Oct 2012, 15:32
by marrio33
If you connect the two mice that happen chevo
Re: [MOD][1.6] 2 Mice multiplayer on single PC (Windows only
Posted: 24 Feb 2013, 16:59
by xPi
hi, I have finally had a chance to try my own mod with multiple keyboards:
there is a problem on all the menus with taking keyboard input from glovepie as well as directly.
SOLUTION: click on a different window and then press F12 to lock keyboard and mouse
once you're done configuring, every keyboard button and mouse button should begin with "OSC" and aimx and aimy should also have "OSC"
one more thing: I have found an old version that has a working OSC, this may also solve fakeuser's unresponsive problem
Re: [MOD][1.6] 2 Mice multiplayer on single PC (Windows only
Posted: 10 Mar 2013, 07:41
by dragonballfan1231
can u play over the internet with other people?
Re: [MOD][1.6] 2 Mice multiplayer on single PC (Windows only
Posted: 10 Mar 2013, 17:53
by xPi
you should be in the same room (in real life) as the person running the game
using this over the internet is not feasible. you could try sharing the screen with the other players but the result will be terrible for them. (worse than castle crashers since screen sharing is involved)
Re: [MOD][1.6] 2 Mice multiplayer on single PC (Windows only
Posted: 14 Oct 2014, 23:13
by Wirespark
i love the mod and i've been working with a wiimote and glovepie,
but i need help inserting a wiimote into mari0.
osc.ip = "127.0.0.1"
osc.port = 28436
var.x += deadzone(Nunchuk.JoyX,0.03) * 15 // fiddle with this number to adjust mouse speed!
var.y += deadzone(Nunchuk.JoyY,0.03) * 15 // fiddle with this number to adjust mouse speed!
if delta([var.x,var.y]) != [0,0] then
osc.mouse.1.x = var.x
osc.mouse.1.y = var.y
endif
if delta(Nunchuk.C ) then osc.keyboard.1.wiinc = Nunchuk.C
if delta(Nunchuk.Z ) then osc.keyboard.1.wiinz = Nunchuk.Z
if delta(wiimote.Minus ) then osc.keyboard.1.wiiminus = wiimote.Minus
if delta(wiimote.plus ) then osc.keyboard.1.wiiplus = wiimote.plus
if delta(wiimote.Up ) then osc.keyboard.1.wiiup = wiimote.Up
if delta(wiimote.Left ) then osc.keyboard.1.wiileft = wiimote.Left
if delta(wiimote.Down ) then osc.keyboard.1.wiidown = wiimote.Down
if delta(wiimote.right ) then osc.keyboard.1.wiiright = wiimote.right
if delta(wiimote.A ) then osc.keyboard.1.wiia = wiimote.A
if delta(wiimote.b ) then osc.keyboard.1.wiib = wiimote.b
if delta(WIIMOTE.HOME ) then osc.keyboard.1.wiihome = WIIMOTE.HOME
if delta(wiimote.One ) then osc.keyboard.1.wiione = wiimote.One
if delta(wiimote.Two ) then osc.keyboard.1.wiitwo = wiimote.Two
then setup the controls similar to this
the controls shown in this screenshot seem pretty awkward. not sure how to press LEFT RIGHT while holding the RUN or JUMP key
for this reason, I urge you to look into setting up a wii remote sensor bar near your computer
the glovepie script will need further changes to make the nunchuck stick work like keys and add sensor bar support
edit: modified the glovepie script to add sensor bar support and nunchuck stick as buttons
osc.ip = "127.0.0.1"
osc.port = 28436
if delta(wiimote1.PointerXY) != [0,0] then
//osc.mouse.1.x = wiimote.PointerX * 1000
//osc.mouse.1.y = wiimote.PointerY * 1000
osc.mouse.1.x = -wiimote.dot1x
osc.mouse.1.y = wiimote.dot1y
endif
if delta(Nunchuk1.Left ) then osc.keyboard.1.wiinleft = Nunchuk1.Left
if delta(Nunchuk1.Right ) then osc.keyboard.1.wiinright = Nunchuk1.Right
if delta(Nunchuk1.Up ) then osc.keyboard.1.wiinup = Nunchuk1.Up
if delta(Nunchuk1.Down ) then osc.keyboard.1.wiindown = Nunchuk1.Down
if delta(Nunchuk1.C ) then osc.keyboard.1.wiinc = Nunchuk1.C
if delta(Nunchuk1.Z ) then osc.keyboard.1.wiinz = Nunchuk1.Z
if delta(wiimote1.Minus ) then osc.keyboard.1.wiiminus = wiimote1.Minus
if delta(wiimote1.plus ) then osc.keyboard.1.wiiplus = wiimote1.plus
if delta(wiimote1.Up ) then osc.keyboard.1.wiiup = wiimote1.Up
if delta(wiimote1.Left ) then osc.keyboard.1.wiileft = wiimote1.Left
if delta(wiimote1.Down ) then osc.keyboard.1.wiidown = wiimote1.Down
if delta(wiimote1.right ) then osc.keyboard.1.wiiright = wiimote1.right
if delta(wiimote1.A ) then osc.keyboard.1.wiia = wiimote1.A
if delta(wiimote1.b ) then osc.keyboard.1.wiib = wiimote1.b
if delta(WIIMOTE1.HOME ) then osc.keyboard.1.wiihome = WIIMOTE1.HOME
if delta(wiimote1.One ) then osc.keyboard.1.wiione = wiimote1.One
if delta(wiimote1.Two ) then osc.keyboard.1.wiitwo = wiimote1.Two
example controls:
ok, one more edit to add 4 wii remotes with nunchucks glovepie script!
osc.ip = "127.0.0.1"
osc.port = 28436
if delta(wiimote1.PointerXY) != [0,0] then
//osc.mouse.1.x = wiimote1.PointerX * 1000
//osc.mouse.1.y = wiimote1.PointerY * 1000
osc.mouse.1.x = -wiimote1.dot1x
osc.mouse.1.y = wiimote1.dot1y
endif
if delta(wiimote1.Nunchuk.Left ) then osc.keyboard.1.wiinleft = wiimote1.Nunchuk.Left
if delta(wiimote1.Nunchuk.Right ) then osc.keyboard.1.wiinright = wiimote1.Nunchuk.Right
if delta(wiimote1.Nunchuk.Up ) then osc.keyboard.1.wiinup = wiimote1.Nunchuk.Up
if delta(wiimote1.Nunchuk.Down ) then osc.keyboard.1.wiindown = wiimote1.Nunchuk.Down
if delta(wiimote1.Nunchuk.C ) then osc.keyboard.1.wiinc = wiimote1.Nunchuk.C
if delta(wiimote1.Nunchuk.Z ) then osc.keyboard.1.wiinz = wiimote1.Nunchuk.Z
if delta(wiimote1.Minus ) then osc.keyboard.1.wiiminus = wiimote1.Minus
if delta(wiimote1.plus ) then osc.keyboard.1.wiiplus = wiimote1.plus
if delta(wiimote1.Up ) then osc.keyboard.1.wiiup = wiimote1.Up
if delta(wiimote1.Left ) then osc.keyboard.1.wiileft = wiimote1.Left
if delta(wiimote1.Down ) then osc.keyboard.1.wiidown = wiimote1.Down
if delta(wiimote1.right ) then osc.keyboard.1.wiiright = wiimote1.right
if delta(wiimote1.A ) then osc.keyboard.1.wiia = wiimote1.A
if delta(wiimote1.b ) then osc.keyboard.1.wiib = wiimote1.b
if delta(WIIMOTE1.HOME ) then osc.keyboard.1.wiihome = WIIMOTE1.HOME
if delta(wiimote1.One ) then osc.keyboard.1.wiione = wiimote1.One
if delta(wiimote1.Two ) then osc.keyboard.1.wiitwo = wiimote1.Two
if delta(wiimote2.PointerXY) != [0,0] then
//osc.mouse.2.x = wiimote2.PointerX * 1000
//osc.mouse.2.y = wiimote2.PointerY * 1000
osc.mouse.2.x = -wiimote2.dot1x
osc.mouse.2.y = wiimote2.dot1y
endif
if delta(wiimote2.Nunchuk.Left ) then osc.keyboard.2.wiinleft = wiimote2.Nunchuk.Left
if delta(wiimote2.Nunchuk.Right ) then osc.keyboard.2.wiinright = wiimote2.Nunchuk.Right
if delta(wiimote2.Nunchuk.Up ) then osc.keyboard.2.wiinup = wiimote2.Nunchuk.Up
if delta(wiimote2.Nunchuk.Down ) then osc.keyboard.2.wiindown = wiimote2.Nunchuk.Down
if delta(wiimote2.Nunchuk.C ) then osc.keyboard.2.wiinc = wiimote2.Nunchuk.C
if delta(wiimote2.Nunchuk.Z ) then osc.keyboard.2.wiinz = wiimote2.Nunchuk.Z
if delta(wiimote2.Minus ) then osc.keyboard.2.wiiminus = wiimote2.Minus
if delta(wiimote2.plus ) then osc.keyboard.2.wiiplus = wiimote2.plus
if delta(wiimote2.Up ) then osc.keyboard.2.wiiup = wiimote2.Up
if delta(wiimote2.Left ) then osc.keyboard.2.wiileft = wiimote2.Left
if delta(wiimote2.Down ) then osc.keyboard.2.wiidown = wiimote2.Down
if delta(wiimote2.right ) then osc.keyboard.2.wiiright = wiimote2.right
if delta(wiimote2.A ) then osc.keyboard.2.wiia = wiimote2.A
if delta(wiimote2.b ) then osc.keyboard.2.wiib = wiimote2.b
if delta(WIIMOTE2.HOME ) then osc.keyboard.2.wiihome = WIIMOTE2.HOME
if delta(wiimote2.One ) then osc.keyboard.2.wiione = wiimote2.One
if delta(wiimote2.Two ) then osc.keyboard.2.wiitwo = wiimote2.Two
if delta(wiimote3.PointerXY) != [0,0] then
//osc.mouse.3.x = wiimote3.PointerX * 1000
//osc.mouse.3.y = wiimote3.PointerY * 1000
osc.mouse.3.x = -wiimote3.dot1x
osc.mouse.3.y = wiimote3.dot1y
endif
if delta(wiimote3.Nunchuk.Left ) then osc.keyboard.3.wiinleft = wiimote3.Nunchuk.Left
if delta(wiimote3.Nunchuk.Right ) then osc.keyboard.3.wiinright = wiimote3.Nunchuk.Right
if delta(wiimote3.Nunchuk.Up ) then osc.keyboard.3.wiinup = wiimote3.Nunchuk.Up
if delta(wiimote3.Nunchuk.Down ) then osc.keyboard.3.wiindown = wiimote3.Nunchuk.Down
if delta(wiimote3.Nunchuk.C ) then osc.keyboard.3.wiinc = wiimote3.Nunchuk.C
if delta(wiimote3.Nunchuk.Z ) then osc.keyboard.3.wiinz = wiimote3.Nunchuk.Z
if delta(wiimote3.Minus ) then osc.keyboard.3.wiiminus = wiimote3.Minus
if delta(wiimote3.plus ) then osc.keyboard.3.wiiplus = wiimote3.plus
if delta(wiimote3.Up ) then osc.keyboard.3.wiiup = wiimote3.Up
if delta(wiimote3.Left ) then osc.keyboard.3.wiileft = wiimote3.Left
if delta(wiimote3.Down ) then osc.keyboard.3.wiidown = wiimote3.Down
if delta(wiimote3.right ) then osc.keyboard.3.wiiright = wiimote3.right
if delta(wiimote3.A ) then osc.keyboard.3.wiia = wiimote3.A
if delta(wiimote3.b ) then osc.keyboard.3.wiib = wiimote3.b
if delta(WIIMOTE3.HOME ) then osc.keyboard.3.wiihome = WIIMOTE3.HOME
if delta(wiimote3.One ) then osc.keyboard.3.wiione = wiimote3.One
if delta(wiimote3.Two ) then osc.keyboard.3.wiitwo = wiimote3.Two
if delta(wiimote4.PointerXY) != [0,0] then
//osc.mouse.4.x = wiimote4.PointerX * 1000
//osc.mouse.4.y = wiimote4.PointerY * 1000
osc.mouse.4.x = -wiimote4.dot1x
osc.mouse.4.y = wiimote4.dot1y
endif
if delta(wiimote4.Nunchuk.Left ) then osc.keyboard.4.wiinleft = wiimote4.Nunchuk.Left
if delta(wiimote4.Nunchuk.Right ) then osc.keyboard.4.wiinright = wiimote4.Nunchuk.Right
if delta(wiimote4.Nunchuk.Up ) then osc.keyboard.4.wiinup = wiimote4.Nunchuk.Up
if delta(wiimote4.Nunchuk.Down ) then osc.keyboard.4.wiindown = wiimote4.Nunchuk.Down
if delta(wiimote4.Nunchuk.C ) then osc.keyboard.4.wiinc = wiimote4.Nunchuk.C
if delta(wiimote4.Nunchuk.Z ) then osc.keyboard.4.wiinz = wiimote4.Nunchuk.Z
if delta(wiimote4.Minus ) then osc.keyboard.4.wiiminus = wiimote4.Minus
if delta(wiimote4.plus ) then osc.keyboard.4.wiiplus = wiimote4.plus
if delta(wiimote4.Up ) then osc.keyboard.4.wiiup = wiimote4.Up
if delta(wiimote4.Left ) then osc.keyboard.4.wiileft = wiimote4.Left
if delta(wiimote4.Down ) then osc.keyboard.4.wiidown = wiimote4.Down
if delta(wiimote4.right ) then osc.keyboard.4.wiiright = wiimote4.right
if delta(wiimote4.A ) then osc.keyboard.4.wiia = wiimote4.A
if delta(wiimote4.b ) then osc.keyboard.4.wiib = wiimote4.b
if delta(WIIMOTE4.HOME ) then osc.keyboard.4.wiihome = WIIMOTE4.HOME
if delta(wiimote4.One ) then osc.keyboard.4.wiione = wiimote4.One
if delta(wiimote4.Two ) then osc.keyboard.4.wiitwo = wiimote4.Two
unable to really test, would like to know if this works with 4 wii remotes with nunchucks plugged in