PDA

View Full Version : TBDI - Progress report



Michael Hartlef
08-03-2007, 00:16
Hi folks,

I think I will get ForceFeedback working. So far and till now I can tell that a FF-Device is connected, that it has buildin effects and how many of them does the device have. Cool. So press your thumbs and within this week I hope I can show you guys some new functions.

Michael

ErosOlmi
08-03-2007, 00:27
Fantastic, Mike.

I'm fighting with some code on FOR/NEXT. I'm recoding all FOR/NEXT handling routines, but, when done, I will go out to buy a good ... game pad with force FF functionalities.

Thanks a lot
Eros

kryton9
08-03-2007, 01:26
The same here, will definitly hit the stores to get a nice gamepad with rumble and what other cool works they have.

I remember quite a few years ago when the force feedback joysticks came out, they had one demo at the store. It was neat, you got to push a button to try out various modes. It was amazing, you actually felt like you had a machine gun or light sabre in your hand. Even punching gloves for boxing, really amazing programming who ever programmed those forces. A couple years later I bought a Logitech Force Feedback but it was nowhere as good as that demo controller so I gave it a friend who really wanted it. I still can't forget how cool the light sabre mood felt, just amazing.

I don't know if the game pads have such cool effects built in, but it will be neat even to have the rumble when your ship gets hit!!

Anyways keep up the great work Mike and Eros good luck with that tough Loop code trackdown!!

Michael Hartlef
10-03-2007, 13:42
Damn, I think I hit a point where I am forced to switch to C++. I can't get the effects to work. Plus I found more conversion errors in the PB headers. I wasted 8 hours now for it so before I run into more of this, I will switch the project to C++. :(

kryton9
10-03-2007, 14:13
Mike, I am thinking of moving from Delphi and more into C++. Just to make the move. I am almost done with my Delphi project. Then I might port it over to C++ for future development too.

Michael Hartlef
10-03-2007, 14:51
Good luck, I basically can't stand C++ much, but if it will get the job done, then I have to use it.

Petr Schreiber
10-03-2007, 17:36
Hi Mike,

it is your project, but ... :)

I am doing PB for a long time, and even if I have found bad things in headers, I went over it because PB still offered too much comfort to me in other ways. If there is any help I can provide, please tell me.


Bye,
Petr

Michael Hartlef
10-03-2007, 18:34
Ok, I will zip the sources and maybe you can look at them.

Michael Hartlef
10-03-2007, 20:03
Here are the Powerbasic sources, including the DirectX headers.

Petr Schreiber
10-03-2007, 20:58
Hi Mike,

thanks a lot, I will have a look.


Petr

Michael Hartlef
10-03-2007, 21:04
Like I said, it detects the force feedback abilities, but I think it is the autocenter part, that is not working correctly. Because the assigned effect is not playing.

ErosOlmi
10-03-2007, 22:19
Hi Mike,

I will study more your sources later because I have to go out right now but just to give you little advices (not related to the problem you are facing).

1.
To zero fill a structure you can use RESET Power Basic keyword instead of using ZeroMemoryAPI API function.

2.
avoid globals when possible. Defining local variables or full structures is really fast in Power Basic even if executed thousands of times per seconds.
So instead to RESET a global structure used by many functions, declare structures locally in the function. Power Basic will RESET them for you every time avoiding the need to call a RESET or a ZeroMemory fill operation.
Of course if you need a global to share info among different functions, it is ok. But if it is only to reuse it, better go local.

3.
thinBasic interface: instead of using


If thinBasic_CheckOpenParens() Then
thinBasic_ParseNumber efID
If thinBasic_CheckCloseParens() Then
...

you can do it in one line using:


efID = thinBasic_Parse1NumberAndParens


or with more variables...

If thinBasic_CheckOpenParens() Then
thinBasic_ParseNumber minT
If thinBasic_CheckComma() Then
thinBasic_ParseNumber maxT
If thinBasic_CheckCloseParens() Then
...


to

thinBasic_Parse2NumbersAndParens(minT, maxT)


There are also other thinBasic_Parse* functions in thinCore.inc up to 6 parameters.


I will check your code again later. I'm not an expert on DI but at least I can see if I find any Power Basic related problem.

Ciao
Eros

kryton9
11-03-2007, 03:22
Guys, as some of you are also in the market, I found this nice article about current gamepads.
I will go out tomorrow and start looking to see if the stores here have it in stock.

http://compactiongames.about.com/od/hardware/tp/gamepads.htm

I used to have a generic no name gamepad I bought for $9, that worked well. I then bought a microsoft game pad as well as joystick and those things you could use for years. Very durable.

It looks like they really like the logitech wireless. My friend Josh has one in South Carolina and he says he loves it. So I will look for that.

Last chance to tell me any other good recommendations :)

Michael Hartlef
11-03-2007, 08:57
Sorry, can't help here. I have a Microsoft sidewinder Force feedback 2 joystick and a regular Saitek P880 Gamepad without FF.

Michael Hartlef
11-03-2007, 09:02
LAst night I played more with it and at least I get the interfaces called now that I wanted to. I made my own GUID structure and that way it worked better. Here is the updated DINput include and the lib source. Sorry that it is a little messy now but I will clean it up over the time. I hope I get this FF thing going, I would really love to.

Michael Hartlef
11-03-2007, 12:13
Ok, I found the little bugger I think.

SetCoorperativeLevel needs a dialog/window handler. And I don't know it at the time I initialize directinput.

Any ideas?

ErosOlmi
11-03-2007, 12:25
Give TBDI_INIT to user to be called after window is created :)

Michael Hartlef
11-03-2007, 12:28
Ok, I talked to Eros, and there is no way to initialize the module for ForceFeedback without having the window handle from TBGL. So I will first install TBDI_Init again. After all the testing is done and the lib is pratically final, we should talk about if it would be a positive mode to integrate TBDI functionality into TBGL. This way TBGL could initialize TBDI when it creates a window.

Michael Hartlef
11-03-2007, 14:09
Dooo, that was it. ::) This damn window handle did the trick. And now a BIG YEAH!!!!!
I managed it. My sidewinder is jumping like a nutcase ;D ;D ;D

Gues... expect ForceFeedback comming to your local thinbasic installation within the next days .

Man I feel like a little kid. Outside is great weather, my son is going to a birthday party soon and I will go for a long walk with my wife. What a sunday. YIPPIE!!! ;D

ErosOlmi
11-03-2007, 14:15
WOW, thanks. We want to see an example soon. Tomorrow I will get my new toy (Joystick with FF)



Ok, I talked to Eros, and there is no way to initialize the module for ForceFeedback without having the window handle from TBGL. So I will first install TBDI_Init again. After all the testing is done and the lib is pratically final, we should talk about if it would be a positive mode to integrate TBDI functionality into TBGL. This way TBGL could initialize TBDI when it creates a window.

This gave me a nice idea to add inter module communications. Still to understand how but should not be so difficult.
Maybe you will have to add a new exported function in your module able to get info from other module. Something like

ModuleMessages(ModuleSource, ModuleTarget, Message, Param1, Param2, param3) as longwhere
ModuleSource="TBGL"
ModuleTarget="TBDI"
Message = Get..., Set... something
some parameters
and a return value

thinCore will take care to call this function from the target module (if loaded) passing all needed parameters and returning data to source module.

Just an idea.

Michael Hartlef
11-03-2007, 14:20
Yes, that would be nice. I can see some possiblities to use.

I will see that I will come up with a nice sample soon.

Petr Schreiber
11-03-2007, 14:27
Hi Mike,

terrific news !
I must say this sunday is very cool as I solved my problem too :D

And weather outside is great, I am considering leaving computer for a while ( what a heretic idea ! )


Bye,
Petr

Michael Hartlef
11-03-2007, 14:57
Yes, I leave the house now too, have a 60 minute walk with my wife, have a nice ice cream and then tonight, have more brainpower to work more on it. I'm so excited.

kryton9
12-03-2007, 01:50
Very glad to hear all the good news. My "The Force" be with us all soon :)

Michael Hartlef
12-03-2007, 09:53
It will Kent, it will. :) The first thing I will implement is the ability to load predefined effects and play them at command. The DirectX SDK contains a lot of effects that you can use, also there is an editing program for them, if you want to create your own. The rumbling effect is one target for this.

Next thing will be the ability to create and set constant force effects from commands. With a little luck and no brain freeze on my site, plus a spell or two from wife, this should be easy to implement. After this all I will head to the blender exporter to enhance this and then get back to our game. Got a little quite around it.

kryton9
12-03-2007, 22:09
Oh man presets, and configuration The Force is indeed with us!!!

Good luck with all of these new additions!!!

Michael Hartlef
14-03-2007, 00:17
Thanks Kent, and yes, I had luck. I managed it to read an effectfile and play it back. Well, at least the first effect from it. I guess releasing tommorow was a bit off but I'm on track. I still have to find a nice way of organizing this stuff. Just wanted to let you know about this little progress.

ErosOlmi
14-03-2007, 01:00
8) Cool !
Thanks Mike.

kryton9
14-03-2007, 04:05
Guys, will a gamepad be able to have different forces effects or is just a rumble? I know the joysticks have lots of cool effects, but I find the gamepad more suited for so many game styles. I am still going to buy a force feedback joystick, but I would like to find one wireless like the gamepad I plan to buy.

Glad to hear you had a good day with effects Mike!!

Michael Hartlef
14-03-2007, 07:56
I think that gamepads just support rumbling.

kryton9
14-03-2007, 10:04
THanks Mike, that is what it sounded like in what I read. Well rumble for now till I find that good wireless joystick then with ForceFeedback.