Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (henrybane), 1,182 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Attaching controller to gamestudio game. #264776
05/08/09 05:19
05/08/09 05:19
Joined: Aug 2003
Posts: 716
Canada, Toronto
thegamedesigner Offline OP
User
thegamedesigner  Offline OP
User

Joined: Aug 2003
Posts: 716
Canada, Toronto
Hello. I made a game last week that is going to be shown at an event next week. What I want to do is make it so people can play with an xbox controller, or equivalent. I don't own a console so I'm going to go buy a controller. Maybe a 3rd party brand off the shelves, as I hear those come with key mapping software.

Has anyone here done this? Is there certain software, or a brand of hardware that is good? Anyone made a gamestudio game with a controller attached? Any feedback?

Thanks,


My games - www.spyeart.com
Re: Attaching controller to gamestudio game. [Re: thegamedesigner] #264779
05/08/09 05:40
05/08/09 05:40
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline
User
delinkx  Offline
User

Joined: Jul 2008
Posts: 553
Singapore
there are plugins for Wii and also samples. search through the forums.


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: Attaching controller to gamestudio game. [Re: delinkx] #264805
05/08/09 10:04
05/08/09 10:04
Joined: Feb 2009
Posts: 35
Watertown, New York, US
goanna Offline
Newbie
goanna  Offline
Newbie

Joined: Feb 2009
Posts: 35
Watertown, New York, US
Here is a program for using a gamepad with games that don't have gamepad/joystick support:
www.xpadder.com
www.xpadderwave.com/
//
Download page:
http://www.xpadderwave.com/index.php?option=com_remository&Itemid=0&func=fileinfo&id=104
I use a Logitech pression gamepad USB, $10.00 US.

Last edited by goanna; 05/08/09 10:13.
How to use XBox Controller with Gamestudio [Re: thegamedesigner] #285988
08/22/09 03:18
08/22/09 03:18
Joined: Apr 2009
Posts: 27
Silicon Valley
D
Dillinger Offline
Newbie
Dillinger  Offline
Newbie
D

Joined: Apr 2009
Posts: 27
Silicon Valley
Sure, no problem laugh

Gamestudio already has generic joystick support built in, which is pretty much what the XBox controller uses since it needed to be compatible with a lot of already existing games.
All you'll need is an XBox to USB adaptor. You can find many different models on eBay.
I recommend the X-Joy Converter (Xbox to PC/MAC USB Controller Adapter). This link should bring one up :
Generic eBay Search for X-Joy Convertor
Since it is a Microsoft product, it integrates pretty seemlessly with .NET game authoring tools. I got it for XNA using C#, but found C# to be unbelievably verbose, so I switched to Gamestudio. grin
There's lots of them on eBay that require the breakaway cord. I like this one cause you plug straight in to the USB adaptor. I just plugged it into the USB and Windows went online and found the XBox driver automatically.

Here is some quick sample code to test it out.
Some of the recommended code for a standard joystick controller doesn't seem to do anything. I commented that bit out. Also, everything seemed to show up except the trigger and Dpad buttons. Perhaps somebody can figure out how to get those bits working.
Here's what I've got so far:

Code:
// XBoxController.c
// Tutorials in Plain English by Dillinger 2009 :)

#include <acknex.h>
#include <default.c>

var Xbox_Joystick_X , Xbox_Joystick_Y ; // Change var to float for higher sensitivity
var Xbox_Joystick_Raw_X , Xbox_Joystick_Raw_Y, 
	Xbox_Joystick_Rot_X, Xbox_Joystick_Rot_Y ;  
	
// var Xbox_Joystick2_Raw_X , Xbox_Joystick2_Raw_Y ; 

var Xbox_Button_A, Xbox_Button_B, Xbox_Button_X, Xbox_Button_Y, 
	Xbox_Button_Front_L, Xbox_Button_Front_R, Xbox_Button_Back, Xbox_Button_Start, 
	Xbox_Joy_Push_L, Xbox_Joy_Push_R, Xbox_Button_11, Xbox_Button_12 ; 

PANEL* Xbox_Variables =
{
	digits( 60, 10, "XBox Controller Variables", Arial#28b, 1, 0 ) ; 
	
	digits( 60, 40, "Xbox_Joystick_X = %0.f", Arial#18b, 1, Xbox_Joystick_X ) ; 
	digits( 60, 60, "Xbox_Joystick_Y = %0.f", Arial#18b, 1, Xbox_Joystick_Y ) ; 
	
	digits( 60, 80, "Green A Button = %0.f", Arial#18b, 1, Xbox_Button_A ) ; 
	digits( 60, 100, "Red B Button = %0.f", Arial#18b, 1, Xbox_Button_B ) ; 
	digits( 60, 120, "Blue X Button = %0.f", Arial#18b, 1, Xbox_Button_X ) ; 
	digits( 60, 140, "Yellow Y Button = %0.f", Arial#18b, 1, Xbox_Button_Y ) ; 
	digits( 60, 160, "Front Left Button = %0.f", Arial#18b, 1, Xbox_Button_Front_L ) ; 
	digits( 60, 180, "Front Right Button = %0.f", Arial#18b, 1, Xbox_Button_Front_R ) ; 
	digits( 60, 200, "Back Button = %0.f", Arial#18b, 1, Xbox_Button_Back ) ; 
	digits( 60, 220, "Start Button = %0.f", Arial#18b, 1, Xbox_Button_Start ) ; 
	digits( 60, 240, "Push Joystick Left = %0.f", Arial#18b, 1, Xbox_Joy_Push_L ) ; 
	digits( 60, 260, "Push Joystick Right = %0.f", Arial#18b, 1, Xbox_Joy_Push_R ) ; 
	
//	digits( 60, 280, "Xbox_Button_11 = %0.f", Arial#18b, 1, Xbox_Button_11 ) ; 
//	digits( 60, 300, "Xbox_Button_12 = %0.f", Arial#18b, 1, Xbox_Button_12 ) ; 
	
	digits( 60, 320, "Joystick Left Raw X = %0.f", Arial#18b, 1, Xbox_Joystick_Raw_X ) ; 
	digits( 60, 340, "Joystick Left Raw Y = %0.f", Arial#18b, 1, Xbox_Joystick_Raw_Y ) ; 
	
	digits( 60, 360, "Joystick Right Raw X = %0.f", Arial#18b, 1, Xbox_Joystick_Rot_X ) ; 
	digits( 60, 380, "Joystick Right Raw Y = %0.f", Arial#18b, 1, Xbox_Joystick_Rot_Y ) ; 
	
//	digits( 60, 400, "Xbox_Joystick2_Raw_X = %0.f", Arial#18b, 1, Xbox_Joystick2_Raw_X ) ; 
//	digits( 60, 420, "Xbox_Joystick2_Raw_Y = %0.f", Arial#18b, 1, Xbox_Joystick2_Raw_Y ) ; 
	
	red = 255 ; green = 255 ; blue = 255 ; // Change Text color
	flags = VISIBLE ; 
}

function main()
{
	level_load ("") ; // Tell the engine to load a Level, then suddenly change your mind
	wait (1) ; // Give it a little time to think about that one
   
	while( 1 ) // as long as the sun rises in the East...
	{	// copy everything to temp variables for display purposes
		Xbox_Joystick_X = joy_force.x ; 
		Xbox_Joystick_Y = joy_force.y ; 
		
		Xbox_Joystick_Raw_X = joy_raw.x ; 
		Xbox_Joystick_Raw_Y = joy_raw.y ; 
		
		Xbox_Joystick_Rot_X = joy_rot.y ; // X = Y ?? It Works. Go Figure.
		Xbox_Joystick_Rot_Y = joy_rot.x ; 

		Xbox_Button_A = joy_1 ; 
		Xbox_Button_B = joy_2 ; 
		Xbox_Button_X = joy_3 ; 
		Xbox_Button_Y = joy_4 ; 
		Xbox_Button_Front_L = joy_5 ; 
		Xbox_Button_Front_R = joy_6 ; 
		Xbox_Button_Back = joy_7 ; 
		Xbox_Button_Start = joy_8 ; 
		Xbox_Joy_Push_L = joy_9 ; 
		Xbox_Joy_Push_R = joy_10 ; 
		
//		Xbox_Button_11 = joy_11 ; 
//		Xbox_Button_12 = joy_12 ; 	

//		Xbox_Joystick2_Raw_X = joy2_raw.x ; 
//		Xbox_Joystick2_Raw_Y = joy2_raw.y ; 

		wait(1);
	} 
}



Sorry I couldn't get the answer to you before your big presentation.


Last edited by Dillinger; 08/22/09 03:37.
Re: How to use XBox Controller with Gamestudio [Re: Dillinger] #294186
10/16/09 20:47
10/16/09 20:47
Joined: Jul 2009
Posts: 1,198
Berlin, Germany
L
Liamissimo Offline
Serious User
Liamissimo  Offline
Serious User
L

Joined: Jul 2009
Posts: 1,198
Berlin, Germany
Okay, so I also want to add it. I Played around with the Code and I think I'll get something useful:) So, here is what I got until now:P
Code:
#include <acknex.h>
#include <default.c>
ENTITY* box;
var Xbox_Joystick_X , Xbox_Joystick_Y ; // Change var to float for higher sensitivity
var Xbox_Joystick_Raw_X , Xbox_Joystick_Raw_Y, 
	Xbox_Joystick_Rot_X, Xbox_Joystick_Rot_Y ;  
	
// var Xbox_Joystick2_Raw_X , Xbox_Joystick2_Raw_Y ; 

var Xbox_Button_A, Xbox_Button_B, Xbox_Button_X, Xbox_Button_Y, 
	Xbox_Button_Front_L, Xbox_Button_Front_R, Xbox_Button_Back, Xbox_Button_Start, 
	Xbox_Joy_Push_L, Xbox_Joy_Push_R, Xbox_Button_11, Xbox_Button_12 ; 

function main()
{
	level_load ("") ; // Tell the engine to load a Level, then suddenly change your mind
	wait (1) ; // Give it a little time to think about that one
  	box = ent_create("cube.mdl", nullvector, NULL);
	while( 1 ) // as long as the sun rises in the East...
	{	// copy everything to temp variables for display purposes
		Xbox_Joystick_Y = joy_force.x ; 
		Xbox_Joystick_X = joy_force.y ; 
		box.y = joy_force.x;
		box.x = joy_force.y;
		wait(1);
	} 
}


So, but if you change for example the camera, the ball also changes the direction. Littel bit confused but thanks for making this big script:)


"Ich weiss nicht genau, was Sie vorhaben, aber Sie können keine Triggerzonen durch Ihr Level kullern lassen."
-JCL, 2011

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1