Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Nymphodora), 972 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Force engine joypad connection recheck... #424563
06/18/13 18:08
06/18/13 18:08

M
Malice
Unregistered
Malice
Unregistered
M



Link to OP Link to OP in Starting with Gamestudio

I have a controller and would like to force a 'connected' recheck if the controller is turn-on/connected after the game starts. Currently joypads are only detected if attached/active before the game app starts. This is inconvenient to game players who learn that the game is joypad-able in the game options and then must restart the game to use the joypad.

I hope that this post is clear.

Thanks
Mal

Re: Force engine joypad connection recheck... [Re: ] #424597
06/19/13 10:31
06/19/13 10:31
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Yes, that makes sense. We'll add an option to initialize the joystick driver at runtime.

Re: Force engine joypad connection recheck... [Re: jcl] #424635
06/19/13 15:58
06/19/13 15:58

M
Malice
Unregistered
Malice
Unregistered
M



Thank jcl. That will be a big help.

Re: Force engine joypad connection recheck... [Re: ] #441214
05/15/14 13:52
05/15/14 13:52
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Took me a while to find this thread but can you please try to add this functionality in the next months? Thanks!


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Force engine joypad connection recheck... [Re: Superku] #441220
05/15/14 18:50
05/15/14 18:50
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline
Serious User
DLively  Offline
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Yes this would be a great feature to have added ^_^


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: Force engine joypad connection recheck... [Re: DLively] #445934
09/30/14 10:10
09/30/14 10:10
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Mr. Lotter, please see my previous post!


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Force engine joypad connection recheck... [Re: Superku] #445953
09/30/14 15:48
09/30/14 15:48
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
I second that, please add it.

Re: Force engine joypad connection recheck... [Re: Reconnoiter] #446356
10/12/14 04:21
10/12/14 04:21

M
Malice
Unregistered
Malice
Unregistered
M



Ha ha... My goodness. Talk about a dropped promise. Use the current work arounds
1) use a engine that adds simple features.Wasn't there an update after my request?
2) Don't use a controller. After all most pc games still don't include stable controller support.

Oh whats that? Most game on pc now offer it! Steam is building a whole market around controller input! But I love my mouse and keyboard! It is not annoying at all to restart my game because I got up to piss!

Sorry jcl, but blindly ingoring my only real request in years feels like a snub and a giggle.

Re: Force engine joypad connection recheck... [Re: ] #446358
10/12/14 07:49
10/12/14 07:49
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Hey Malice, I managed to do it with Windows functions in KarBOOM before I switched to Unity:

Originally Posted By: JibbSmart
Basically, using the right windows function, you can poll all connected joysticks at any time, regardless of when they were connected.

OK, so, my code is a mess, and it's hard to be sure, but this will hopefully be helpful:

Code:
#include <windows.h>

UINT __stdcall joyGetPosEx(UINT, long);
#define PRAGMA_API joyGetPosEx;winmm!joyGetPosEx

#define JOYSTICK_SIZE 52
#define JOYSTICK_INDICES 13
#define JOYSTICK_XPOS 2
#define JOYSTICK_YPOS 3
#define JOYSTICK_ZPOS 4
#define JOYSTICK_RPOS 5
#define JOYSTICK_UPOS 6
#define JOYSTICK_VPOS 7
#define JOYSTICK_BUTTONS 8
#define JOYSTICK_POV 10
#define HALF_JOY 32768

DWORD joystick[JOYSTICK_INDICES];

function getJoy(int i) {
	// get joystick info and put it in our global array
	joystick[0] = JOYSTICK_SIZE;
	joystick[1] = JOY_RETURNALL;
	var r = joyGetPosEx(i, (void*)joystick);
	if (hasZAxis[i] == 0) {
		joystick[JOYSTICK_ZPOS] = HALF_JOY; // cancel out z axis when not available
	}
	return r;
}

function joyButton(int i) {
	i--;
	if (joystick[JOYSTICK_BUTTONS] & (1<<i))
		return 1;
	else
		return 0;
}

#define MIN_JOY 0.1
#define MAX_JOY 0.9

function joyNormalize(var value) {
	// here I can define a min and max value -- min gets scaled to zero, and max gets scaled to 1
	value = (value - HALF_JOY) / HALF_JOY;
	value -= sign(value) * minv(abs(value), MIN_JOY); // scale down zero
	value /= MAX_JOY - MIN_JOY; // scale up
	return clamp(value, -1, 1);
}


The important thing is joyGetPosEx (helpful reading material on its parameters here), a windows function (hence the need for #include <windows.h>).
So, if I recall correctly, it goes something like this...

Calling getJoy(n) will poll the nth joystick, populating the global array "joystick" (that DWORD array) with all the details of that joystick, if it is connected.

So, joystick[JOYSTICK_XPOS] will get you the raw x-axis position of the left stick. joyNormalize(joystick[JOYSTICK_XPOS]) will give it to you from -1 to +1, with a deadzone and a clamp on the top defined by MIN_JOY and MAX_JOY, respectively.

The buttons are all flags - individual bits - set in element 8 in the array (JOYSTICK_BUTTONS), so I have a function that lets you check if button i on the last-polled joystick (with getJoy) is being pressed: joyButton(i).

KarBOOM's kars will start each frame by calling "getJoy" and whatever number their joystick is. Then joyButton(i) and any use of joystick[] gives them information about their joystick. If getJoy gets called with a different joystick number before they're done with it for this frame, they'll start getting the wrong values. So you COULD change it to populate a different array for each joystick, which might simplify things.

Hopefully nothing's missing, and I hope that's helpful! I haven't looked at this stuff in a really long time. I understand I've been a bit vague - it's been a big day and I'm tired tongue But feel free to ask if anything isn't clear laugh


Superku apparently had problems with it, though, with some buttons not being responsive.


Formerly known as JulzMighty.
I made KarBOOM!
Re: Force engine joypad connection recheck... [Re: JibbSmart] #446370
10/12/14 19:00
10/12/14 19:00

M
Malice
Unregistered
Malice
Unregistered
M



@JibbSmart, thank you for this information.

Lite-c was the death of the real idea behind this engine. When I came into the loop, I was sold on a idea of very low coding was needed. Sure they claimed click-together. But I knew before joining, that was an over claim. The real claim was only having to master the scripting language. Which I have worked a long time to understand and be good at the 3dgs API(or so I will call everything covered in the manual).

When Lite-C was introduced, I stop hearing "This will be updated in the features...", instead as a user I was told time and time again, "You'll have to go outside the 3dgs API to do that." Lite-C gave the devs the ability to tell users that they were not going to update the features, but instead the users needed to learn to code beyond the 3dgs API.
e.g.
Q:Can you add file menus to 3dgs?
A:You can do this through the Windows API.
Q:Can you add rechecking for a joystick?
A: You can do this through the Windows API.

The expansions in to the Windows API and C libs is great for many programs. But it wasn't just a bad editor that drove people way. When you tell me all I have to do is learn the 3dgs API and then refuse to add things, because I now need to master and understand higher APIs, that is what drives all the users like me away.

I am fairly good at coding in this engine, and can not be called a Unity click-no-think game maker. And that is the promise I made when joining this engine. I do not need a Unity editor to make games, I need a robust scripting language that is regularly updated.

The facts are, many users here are far beyond the scripting level and the user that are not are being punished. The ability to reach beyond 3dgs into Windows and other libs for 'advanced' reasons is not excuse to stop developing the base API.

My request was made over a year ago, and if JibbSmart's answer works, there is no reason that a simple handful of commands can not be placed in the engine API for me -The User Mastering 3gds scripting and 3dgs API! Let the engine do the work in Windows API and give me a nice simple 3dgs command set.

That is the promise made to the buyers of this engine and the promise failed. We can build level and models in 3dsmax,We can paint in Gimp, we can mix sound in audacity, we can code and debug in Sed, we can adjust things and compile in Wed. All are old tools but still functioning.

The 3gds package meets all it's promises with these old tools, but the promise that the engine scripting would be updated so I would not need to learn beyond it's scripting for most thing is a failed promise. The replay shouldn't be "This is a simple thing you can do with the Windows API." That should never be the replay. Instead if it is a simple thing, than simply add it to the 3dgs API! Because I was promised only to need the higher API access for 'Advanced things' not SIMPLE!

If the devs want to chase cross platform compilers and direct-x 2020super tech, or other such things. That is great. But you have a handful of high level users left crying to you about these things, while your core user base vanished because they could not even get a recheck for a joystick. There were many click-and-make user who ran day one of the Unity march(ratchet). But since then you have lost 1000's of 3dgs script strong user like me.

I can rant for ever and I deserve to, to many years I have said little and hope for much.

Page 1 of 2 1 2

Moderated by  aztec, Spirit 

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