Topic: SFC3 MACRO UTILITY v0.9 READY!  (Read 17195 times)

0 Members and 1 Guest are viewing this topic.

Krusaderr

  • Guest
Re: SFC3Macro v093 READY!
« Reply #20 on: January 31, 2003, 10:57:09 am »
Excellent work Vertigo. Thank you for taking time out of your schedule to make this.    

zaniwhoop2

  • Guest
Re: SFC3 MACRO UTILITY v0.9 READY!
« Reply #21 on: January 31, 2003, 11:13:02 pm »
Quote:


You misunderstand.  I've done that already.  When you capture keystrokes, you have two (and only two) options:

1) do your thing, and "eat" the keystrokes.  The main app (SFC3) never sees them.
2) do your thing, and pass the keystrokes onto SFC3.

With Option #1, chat doesn't work since any "a" and "s" keys never get to SFC3.

With Option #2, SFC3 sees the keystrokes and acts on them.  So you get this example:

1) You press "S."
2) My app sets your speed to EXACTLY 1/4 impulse.
3) The keystroke is then passed onto SFC3.
4) SFC3 sees the "S" command, and...
5) incremements your speed again by about 3%.
6) Your speed is no longer 1/4 impulse.

Ugly.

What I think I'll do:  I'll define ENTER as a Macro ON/OFF switch, and also pass ENTER commands through to SFC3.  So, you get this:
1) You Press ENTER to chat.
2) Seeing this, the SFC3Macro goes to sleep, and passes the ENTER key.
3) SFC3 sees your ENTER keystroke, and opens the chat window.
4) You type your message.  
5) You press ENTER to send your message.
6) Seeing this, the  SFC3Macro wakes up again, but after passing the ENTER key.
7) SFC3 sees your ENTER keystroke, and sends the message.

It's elegant, and seems like it would work.    



I guess I did misunderstand. Maybe if I could play with it, I'd understand better what's happening. What functions/interfaces are you using to catch the keystrokes (I'm assuming SFC3 uses DInput, maybe not)? As an alternative to the ENTER method, you could set the speed to a bit below 1/4 impulse so when SFC3  increases speed, it sets it to exactly 1/4 impulse. As it sounds, I think the ENTER method is strange, but maybe it's one of those things that works better that it sounds (at least to me).  

Vertigo

  • Guest
Re: SFC3 MACRO UTILITY v0.9 READY!
« Reply #22 on: January 31, 2003, 11:37:03 pm »
Quote:


I guess I did misunderstand. Maybe if I could play with it, I'd understand better what's happening. What functions/interfaces are you using to catch the keystrokes (I'm assuming SFC3 uses DInput, maybe not)? As an alternative to the ENTER method, you could set the speed to a bit below 1/4 impulse so when SFC3  increases speed, it sets it to exactly 1/4 impulse. As it sounds, I think the ENTER method is strange, but maybe it's one of those things that works better that it sounds (at least to me).  




Well, why can't you play with it? I mean, it's a free download, available from three places.  Or do you not have SFC3?

Anyway, having tried it out, the "Enter key as toggle approach" seems to work pretty well, actually.  I'm pretty happy with it, and will let it stay as the final fix.

Trying to increase it a "little less" and add a keystroke could be made to work, but it's even uglier than the Enter solution.  Also there are timing issues there I don't want to go into.  To summarize, if you give SFC3 a keystroke immediately after a mouse action, it tends to lose the keystroke.  Ugly.

If SFC3 were actually using a "instant" call like GetAsychKeyState(), I'd be out of luck.  Lucky for me, they are using a standard message queue.  If you are adept at Win32 programming, download the utility.  The source code is included.  To catch keystrokes, I'm using SetWindowsHookEx(), which allows me to intercept the message queue.  Sounds simple, but it can be very tricky in practice.  

zaniwhoop2

  • Guest
Re: SFC3 MACRO UTILITY v0.9 READY!
« Reply #23 on: February 01, 2003, 02:13:52 pm »
Sadly enough, I don't have SFC3 . But when I do, I'll play around with it a bit. Something I noticed while looking (breifly) though the code is that you had a function to get a screenshot. I haven't played around with DCs that much, but can you write to the fullscreen DC, or does that not work? If it does, that could open up a new realm of features...  

Vertigo

  • Guest
Re: SFC3 MACRO UTILITY v0.9 READY!
« Reply #24 on: February 02, 2003, 02:36:10 am »
Quote:

Sadly enough, I don't have SFC3 . But when I do, I'll play around with it a bit. Something I noticed while looking (breifly) though the code is that you had a function to get a screenshot. I haven't played around with DCs that much, but can you write to the fullscreen DC, or does that not work? If it does, that could open up a new realm of features...  




Yes, and No.  Sure, you can write to the fullscreen DC, and that will might last about 1/60th of a second before the next frame comes along.  

I'm not sure if you have done any Direct3D programming, but the Immediate Mode rendering code will clear the entire frame buffer every frame.  Any graphics you inserted would get wiped almost instantly.  In order to get persistent graphics, you have to get yourself into the rendering pipeline.

This is really, really, REALLY hard, if not impossible to do when you just latching onto someone else?s program.  It?s not quite technically impossible, but that is some really fancy (and time consuming) reverse engineering.

Basically, I?d have to
1) intercept every D3D call (I know how to do this), use that to
2) puzzle out the basic workings of the SFC3 engine.
3) Somehow insert new rendering commands into the pipeline without breaking everything.

That ain?t no joke.  That?s full time work, the kind you could get paid $80K a year to do.

But persistent overlays could be very cool.

And is SFC3 really a good enough game to warrant this effort?  I don?t think so.  You?d be better served taking my code and porting it back to a better game, like OP.  It actually should be relatively trivial for someone who?s motivated, and anyone has my permission to try.

Come to think of it, I?ve never looked at the released public source for previous SFC games.  Is the retained 3D engine code public, too?  That would make step #2 almost easy.

You actually looked at my source code?  I?m FLATTERED!  What do you think?
 

Vertigo

  • Guest
Re: SFC3 MACRO UTILITY v0.9 READY!
« Reply #25 on: February 02, 2003, 02:37:41 am »
BTW, HAS ANYONE ACTUALLY TRIED THIS UTILITY YET?  DOES IT WORK?

I wanna know...  please?  

Tulmahk

  • Guest
Re: SFC3 MACRO UTILITY v0.9 READY!
« Reply #26 on: February 02, 2003, 04:25:14 am »
When I tried to use it, the log file records the following:

*********** SFC3MACRO Message Log ***********


Message Logging Level = 1.
Could not find action name.
Could not find action name.
Could not find "=" sign.
Could not find "=" sign.
Could not find throttle!  Green Color: 5AC300.
Error finding throttle.
SFC3 Macro has been stopped.
SFC3 Macro has been started.
Could not find throttle!  Green Color: 5AC300.
Error finding throttle.
SFC3 is closing.  Closing Log.


This is a very interesting utility, I sure hope the kinks can be worked out.  It is very promising.

If I may offer my layman's opinion of what is going on above, it could have something to do with different monitors having different Color Profiles (and/or the video card itself).

My setup is a GeForce2 200MX PCI with a 19" GEM Delta DC 995 monitor & an inactive S3 onboard video chip.

I hope this helps, I'd love to see this thing work.  

zaniwhoop2

  • Guest
Re: SFC3 MACRO UTILITY v0.9 READY!
« Reply #27 on: February 02, 2003, 05:48:54 pm »
Quote:

Quote:

Sadly enough, I don't have SFC3 . But when I do, I'll play around with it a bit. Something I noticed while looking (breifly) though the code is that you had a function to get a screenshot. I haven't played around with DCs that much, but can you write to the fullscreen DC, or does that not work? If it does, that could open up a new realm of features...  




Yes, and No.  Sure, you can write to the fullscreen DC, and that will might last about 1/60th of a second before the next frame comes along.  

I'm not sure if you have done any Direct3D programming, but the Immediate Mode rendering code will clear the entire frame buffer every frame.  Any graphics you inserted would get wiped almost instantly.  In order to get persistent graphics, you have to get yourself into the rendering pipeline.

This is really, really, REALLY hard, if not impossible to do when you just latching onto someone else?s program.  It?s not quite technically impossible, but that is some really fancy (and time consuming) reverse engineering.

Basically, I?d have to
1) intercept every D3D call (I know how to do this), use that to
2) puzzle out the basic workings of the SFC3 engine.
3) Somehow insert new rendering commands into the pipeline without breaking everything.

That ain?t no joke.  That?s full time work, the kind you could get paid $80K a year to do.

But persistent overlays could be very cool.

And is SFC3 really a good enough game to warrant this effort?  I don?t think so.  You?d be better served taking my code and porting it back to a better game, like OP.  It actually should be relatively trivial for someone who?s motivated, and anyone has my permission to try.

Come to think of it, I?ve never looked at the released public source for previous SFC games.  Is the retained 3D engine code public, too?  That would make step #2 almost easy.

You actually looked at my source code?  I?m FLATTERED!  What do you think?




Well, I actually have had some experience with Direct3D, but only DX8 and 9. Currently I have a few little programs that can read, render, optimize, and distort (with vertex and pixel shaders) SFC2 and most Armada models (many thanks to assimsoft.com for the formats), SFC3 is closer to what I'd like to work with and have experience with. All I'd need is the a pointer to the Direct3D device and I'd be set (as long as there was no switching video modes in game).

Unfortunately, there is no source code for SFC 1 or 2 (something about proprietary code I think). If you could block and execute code before the D3D scene ended, you could do a lot. Or, have your app use another instance of D3D to render to a surface, and then copy it to the DC. Although slow, it could be interesting...I need to get SFC3.  

Vertigo

  • Guest
Re: SFC3 MACRO UTILITY v0.9 READY!
« Reply #28 on: February 02, 2003, 10:18:32 pm »
Quote:

When I tried to use it, the log file records the following:

*********** SFC3MACRO Message Log ***********


Message Logging Level = 1.
Could not find action name.
Could not find action name.
Could not find "=" sign.
Could not find "=" sign.
Could not find throttle!  Green Color: 5AC300.
Error finding throttle.
SFC3 Macro has been stopped.
SFC3 Macro has been started.
Could not find throttle!  Green Color: 5AC300.
Error finding throttle.
SFC3 is closing.  Closing Log.


This is a very interesting utility, I sure hope the kinks can be worked out.  It is very promising.

If I may offer my layman's opinion of what is going on above, it could have something to do with different monitors having different Color Profiles (and/or the video card itself).

My setup is a GeForce2 200MX PCI with a 19" GEM Delta DC 995 monitor & an inactive S3 onboard video chip.

I hope this helps, I'd love to see this thing work.  




It does, and I half expected that problem.  I'd say there are two separate problems:

1) Sounds like there is an error in the  [Command List] section of the .INI file.  It's of no consequence since the throttle command are being found anyway.  If you want to cut'n paste that section into a post, I'll take a look at it.

2) I HOPED beyond hope that the color of the throttle bar would be constant across all systems, but it doesn't look like it will be that easy.  This is the number one reason I kept trying to get someone to test it.  It's also the reason that the color is defined in the INI file, so it can be changed, just in case.

*Tech note: My video card does 16-bit RGB in 5-6-5 format, the problem is probably that your card uses 5-5-5 format.  No big deal, I just have to find out the actual combined color value, so the utility can find the throttle.

OK, I've got alternate code that spends more effort searching for the throttle color, I'll get that polished and into the next revision.  It eats more CPU time, so I wasn't going to add it unless I had to.

Anyone else?




 

Tulmahk

  • Guest
Re: SFC3 MACRO UTILITY v0.9 READY!
« Reply #29 on: February 03, 2003, 07:46:24 pm »
That's another concern, does it make a differance if you're in 16 or 32 bit color mode?  I was playing in 16, but it sounds like you coded with that color depth in mind.

Still, should be worth a test.  I'll do that and report back.  

LATER...
Ok, I tested it in 32 bit color depth and same problem.

Maybe a fuzzy logic routine would help?  Instead of requiring an exact color match, match it to within 10% or so?  Surely there is some hardware-independent way to do this.

Of course, Taldren should've designed the game this way from the get-go.  There's a button for full impulse, but not one for any other speed (except 0).  And there should be power-slider presets.  Well, hindsight is 20/20 I suppose.

Good luck, I hope you get this working, it will provide a great advantage for anyone using it (if your opponent isn't).  
« Last Edit: February 03, 2003, 07:58:33 pm by Tulmahk »

Tulmahk

  • Guest
Re: SFC3 MACRO UTILITY v0.9 READY!
« Reply #30 on: February 03, 2003, 08:02:34 pm »
As you requested, here is the entire [Command] section of the .ini file:

;------------------------------------------------------------------------------
;This is where you bind your keystrokes to the commands you want SFC3Macro to
;perform.
;
;For instructions about available keys and commands, please see Commands.txt.
;
;Format:
;(Command) = 'key', [SHIFT], [CONTROL], [ALT], [RunAlways], [PassThru], [IsExtended], [NotExtended]
;
[Command List]
UpThrottle=S
DownThrottle=A
OnOff=ENTER, RunAlways, PassThru
;ShowLog=F6, RunAlWays
;AdvancedDisplayQuery=F7, RunAlWays
 

Vertigo

  • Guest
Re: SFC3 MACRO UTILITY v0.9 READY!
« Reply #31 on: February 03, 2003, 08:47:28 pm »
Quote:

That's another concern, does it make a differance if you're in 16 or 32 bit color mode?  I was playing in 16, but it sounds like you coded with that color depth in mind.

Still, should be worth a test.  I'll do that and report back.  

LATER...
Ok, I tested it in 32 bit color depth and same problem.

Maybe a fuzzy logic routine would help?  Instead of requiring an exact color match, match it to within 10% or so?  Surely there is some hardware-independent way to do this.

Of course, Taldren should've designed the game this way from the get-go.  There's a button for full impulse, but not one for any other speed (except 0).  And there should be power-slider presets.  Well, hindsight is 20/20 I suppose.

Good luck, I hope you get this working, it will provide a great advantage for anyone using it (if your opponent isn't).  




I've just sent out v0.931, which has a crude matching algorithim.  I don't want to spend the CPU cycles doing anything as heavy as fuzzy logic.  I am, after all, leeching CPU cycles from an unaware program as it is.  Hopefully, this revision will fix your problems.  Let me know.

Technically, GetPixel() should be returning a device-independent 32bit RGB color, but it just doesn't seem to work that way.  So, I gotta kludge a little.

SFC3 does 32 bit color?  :O  This I didn't know, not having seen any ability in SFC.INI or the GUI config tool.  How do you do this?

 

Vertigo

  • Guest
Re: SFC3 MACRO UTILITY v0.9 READY!
« Reply #32 on: February 03, 2003, 11:13:42 pm »
Tulmahk,

     You can fetch the updated v0.931 file from:

http://www.gfluniverse.net/downloads


 

Tulmahk

  • Guest
Re: SFC3 MACRO UTILITY v0.9 READY!
« Reply #33 on: February 04, 2003, 02:36:41 am »
I'll be grabbing that presently.

As to the color depth thing, that's the way I believe the game works.  The game uses the resolution you set it to use in the config utility, but the color depth you happen to be at when the game launches (but no less than 16bit).

Anyone feel free to correct me if I'm wrong on that, but I do believe that's the way it works (learned that by reading these forums).  

Tulmahk

  • Guest
Re: SFC3 MACRO UTILITY v0.9 READY!
« Reply #34 on: February 04, 2003, 03:14:18 am »
IT WORKS!

Whatever you did, the damned thing is actually working now!

Shouldn't be too great a leap from here to get the power sliders working.  Same basic principle, right?

That's an excellent bit of programming.  

Vertigo

  • Guest
Re: SFC3 MACRO UTILITY v0.9 READY!
« Reply #35 on: February 04, 2003, 05:09:51 am »
Tulmahk,

     Great to hear that the fix worked.  It's a bit of a hack, but I don't care at this point.

     I don't know about the desktop color thing.  When I was first running tests, the color rez ALWAYS came up at 16 bit, and I run my desktop at 32.  I think that may be either an urban legend, or hardware specific.  I was querying color depth through the DC, so I know it's right.

     For a technical point of view, sliders are a piece o' cake.  It's the interface that is tricky.  Not being able to use a GUI during gametime makes it tough.  Here's what I settled on:

     For every hull you fly (up to 10), you can save a profile.  For every profile, you can define an unlimited amount of power sets.  A set is the settings of the 3 power bars, expressed as percentages.  When you start a match, you first load the profile for the ship you are in.  Then you can cycle through your energy sets at the press of a button.

So far I have added these bindable commands:

LoadHullProfileX (where X goes from 0-9, giving 10 profiles.)
CycleEnergySetsUp (Cycles through your energy sets)
CycleEnergySetsDown (reverse cycles)

Sets are cycled in the order they are listed in the INI file.

By default, I'll bind the load commands to CTRL-Fx, so loading Hull Profile 5 is CTRL-F5, etc.

A profile looks like this in the INI:

[Hull 0 Energy Profile]
Optimal=100P,100H,100S
MaxShields=200S, 100P, 100H
Alpha=200H,200P, 10S
_Custom1=103P, 122H, 110S

The entries can be decoded as follows.  The set name is first, that's whatever name you choose, it's only there for human reference.  The 3 commands following show what percentages of power you want to each system.  The systems must be  listed in order of priority.  Taking the Maxshields set as an example, Shields will get 200% power, then Primaries get 100% power, then Heavies get 100% last.  If there isn't enough energy, heavies won't get 100%, etc.  In reality, I'm just going to send mouse messages in reverse order of priority.

Seems simple enough to me.  There's only one real hassle, and that's creating the Sets in the first place.  It will take a lot of trail and error to get the percentages just right if you want to create Sets.  Without access to a GUI, there is no easy answer.

I'm gonna start by creating another command, something like SaveCustomEnergySet.  This command reads your current energy settings off the display, converts to percentages, and saves it as a "_CustomX" Set , where X increments every time.    It will save it in your current profile.  Then you can rename it to what you want.  Not perfect, but it works.

What would be really awesome is a stand-alone GUI utility so you can tweak your INI settings when you aren't playing.  In a perfect world, this app would allow you to perform refits and select Officers, calculate power nominals, allow you to move energy sliders just like the game, and then save those settings to the INI file.  Anyone interested?

Comments?  Sheesh, I feel like I'm writing RFCs.  

zaniwhoop2

  • Guest
Re: SFC3 MACRO UTILITY v0.9 READY!
« Reply #36 on: February 04, 2003, 07:37:02 pm »
Quote:


What would be really awesome is a stand-alone GUI utility so you can tweak your INI settings when you aren't playing.  In a perfect world, this app would allow you to perform refits and select Officers, calculate power nominals, allow you to move energy sliders just like the game, and then save those settings to the INI file.  Anyone interested?
 



Yes, but getting the time to do it will be difficult for a week or so. Have you also considered a scripting language (Lua, Python come to mind)? I still need the game to get the sliders to work right (right?)? Somewhere I have an amazon gift certificate that should cover the cost.  

Vertigo

  • Guest
Re: SFC3 MACRO UTILITY v0.9 READY!
« Reply #37 on: February 04, 2003, 07:50:48 pm »
Quote:

Quote:


What would be really awesome is a stand-alone GUI utility so you can tweak your INI settings when you aren't playing.  In a perfect world, this app would allow you to perform refits and select Officers, calculate power nominals, allow you to move energy sliders just like the game, and then save those settings to the INI file.  Anyone interested?
 



Yes, but getting the time to do it will be difficult for a week or so. Have you also considered a scripting language (Lua, Python come to mind)? I still need the game to get the sliders to work right (right?)? Somewhere I have an amazon gift certificate that should cover the cost.  




Scripting doesn't help because you still won't have an easy-to-use GUI.  I mean, I'm a Perl junkie, but that doesn't help the average joe.  

Vertigo

  • Guest
UK host...
« Reply #38 on: February 04, 2003, 07:51:46 pm »
Jaffa has updated his hosting link for version v.0931:

http://www.whopperchopper.pwp.blueyonder.co.uk/SFC3Macro_v0931.zip  

SghnDubh

  • Guest
Now on BattleClinic!
« Reply #39 on: February 04, 2003, 08:24:14 pm »
Visit the Analysis section of BattleClinic for prompt and courteous d/l.  


BTW, follow link #4 that looks like this:










  .