4 player split screen

Posted By: jumpman

4 player split screen - 04/06/17 18:59

Is there a way to handle 4 players? I know we can plug in 2 controllers, but is it possible to have 4 players? 4 controllers? 2 on keyboard and 2 on controllers? Not sure if that would work since some keys stop other keys.
Posted By: Reconnoiter

Re: 4 player split screen - 04/07/17 09:45

Perhaps let on use the mouse? Or joystick? How many keys does the player have to hold simultaneously? If it is not to absurd, 2 can be on the same keyboard as long as its has anti ghosting.
Posted By: alibaba

Re: 4 player split screen - 04/07/17 10:52

Use the XInput Plugin by SuperKu. It's pretty easy to use and can handle 4 controllers. Afaik it was 'AckXinput'
Posted By: jumpman

Re: 4 player split screen - 04/07/17 18:05

thank you for the replies friends!
Posted By: jenGs

Re: 4 player split screen - 04/10/17 10:42

You can just use the win api to catch input from the controllers. I once managed 8 controller inputs. Or direct-input, but I never used this.
I think up to 16 controller can be connected.
Posted By: jumpman

Re: 4 player split screen - 04/10/17 15:47

Hi JenGs,

What does that mean? The Api is a dll/plugin I use?
Posted By: jenGs

Re: 4 player split screen - 04/10/17 17:08

Hi,
First you need to include the windows.h

#include <windows.h>

then you need to set up some needed structs:

Code:
typedef struct { 
	UINT wXpos; 
	UINT wYpos; 
	UINT wZpos; 
	UINT wButtons; 
} JOYINFO; 

typedef struct { 
    WORD wMid; 
    WORD wPid; 
    char szPname[32]; 
    UINT wXmin; 
    UINT wXmax; 
    UINT wYmin; 
    UINT wYmax; 
    UINT wZmin; 
    UINT wZmax; 
    UINT wNumButtons; 
    UINT wPeriodMin; 
    UINT wPeriodMax; 
    UINT wRmin; 
    UINT wRmax; 
    UINT wUmin; 
    UINT wUmax; 
    UINT wVmin; 
    UINT wVmax; 
    UINT wCaps; 
    UINT wMaxAxes; 
    UINT wNumAxes; 
    UINT wMaxButtons; 
    char szRegKey[32]; 
    char szOEMVxD[260]; 
} JOYCAPS;



Then you need to declare the methods you want to use from the Windows API, because windows.h only has a fraction declared.

Code:
UINT WINAPI joyGetPos(UINT uJoyID, JOYINFO* pji);
UINT WINAPI joyGetNumDevs(VOID); 
UINT WINAPI joyGetDevCaps(UINT uJoyId, JOYCAPS* pjc, UINT cbjc);



These are some methods I used.
You need to test the for joiIds, save them somewhere and use the controller id with joyGetPos. You can read about it on msdn.

Of course there are other (perhaps better) ways to capture jostick input. (I think directinput is better but in my experience it is not that nice to use directx interface methods with acknex, but as I said, I never used it).
Posted By: jumpman

Re: 4 player split screen - 04/11/17 20:51

hey thanks Jengs! Do you have a finished game/demo with this controller support if possible?
Posted By: jenGs

Re: 4 player split screen - 04/12/17 00:27

sadly not. I will try to extract it out of my old project this weekend, if you are willing to wait that long.
Posted By: Superku

Re: 4 player split screen - 04/12/17 14:15

What's giving you trouble about it/ have you tried doing so yet? You're using lite-C now, right?
Have a look at joyGetPosEx, too. It returns more data than joyGetPos.
The data obviously can be easily converted into (Gamestudio) standard values or factors, for example like this:
joyStickForceX = (Xpos-32768.0)/32768.0; // and so on
Posted By: jumpman

Re: 4 player split screen - 04/12/17 16:12

Thanks man! You dont have to extract the code if you dont want to, I would be fine with just playing a closed exe without the resources open, I have multiple USB controllers and would like to see it in action in gs
© 2024 lite-C Forums