PDA

View Full Version : State Machine ... some thoughts ...


Anvart
08-06-09, 11:16 AM
I have made separated thread ... :haha: ... as have asked...
*** Ïîñëå ìîèõ òåñòîâ ñäåëàííûõ ãîä íàçàä (in 2008 use HexEditor) è ïîëíîãî íåóìåíèÿ èçúÿñíÿòüñÿ ïî àíãëèéñêè ÿ âñ¸ òàêè ðåøèëñÿ è S3D by skwasjer ïîìîæåò ìíå:

I offer to your attention the method of management of any animations of 3D objects using a system of behavior control of the crew of the human submarine.
Also, I'm offering the sample of the code for implementation of my method for creating mods... and I'm publishing some additional crew commands that are not in Command_ *.cfg, but these crew commands are very usefull for use in my method.
It is especially easy to make for the looped (and not looped) animations using Crew Commands...
For example, DF antenna - raising/lowering and rotation, Flag on Turm - appearance/play/disappearance, fan rotation - play/stop, CR-RR hatch open/close, animation of the diesel engine - play/stop and so on for human submarine...
...
Attention, this material is for skilled modders...
************************************************** ******************
First, additional crew commands:

Maneuver_officer_end
Navigation_officer_end
Weapons_officer_end
Watch_officer_end
Radio_operator_end
Sonar_operator_end

Example in Command_*.cfg:

[Cmd450]
Name=Radio_operator
Ctxt=1
Key0=0x56,Cs,"Shift+V"
GoBack=Radar_view
...
[Cmd470] ; additional crew command
Name=Radio_operator_end
Ctxt=1
Key0=0x56,Cc,"Ctrl+V"
************************************************** ******
Now I'll show you a picture with the sequence of the actions and the code for the mod DF antenna raising / lowering... in more detail with the code, you can acquaint in the DFant_subFlag mod or in other recent mods.https://s25.postimg.cc/qg1v30e27/hih9.jpg****************************************** ************************
Also edit Command_*.cfg file:
[Cmd450]
Name=Radio_operator
Ctxt=1
Key0=0x56,Cs,"Shift+V"
GoBack=Radar_view
...
[Cmd470] ; additional crew command
Name=Radio_operator_end
Ctxt=1
Key0=0x56,Cc,"Ctrl+V"

************************************************** ********************
DFa_UpDnRotSMC_1.1, DFa_UpDnRot_Flags, FM30_UpDownSMC mods are outdated and I have no them, so I recommend to study detailed code in the recent mods - FM30_UpDown_final, DFant_subFlag_2010, GWX_DFa-Flag & Pens_2010, LSH3-5_DFa-Flag & Penns_2010...

*****************************************
P.S. Attention. If you use this method for animations managment in your published mods, I remind don't forget to give corresponding credits to author Anvart with the correct formulation of the method.

rowi58
08-07-09, 01:50 AM
Hi Anvart,

sounds very good :up:. When i'll get some time. I'll try this.

Greetings
rowi58

Anvart
08-07-09, 03:15 AM
Схема работает без проблем с crew командами ...
Напрягать мозги нужно только при создании логики событий/действий в новом StateMachineClass ... :D
...
Я не стал описывать азы (основы) State Machine System в игре ...
Это слишком долго, а с моим английским еще и трудно (думаю, что никто ничего не поймет) ...
но для продвинутых моддеров моей информации достаточно, чтобы делать моды на основе StateMachineCtl ...
************************************************** *****
This scheme works without problems with crew commands ...
To strain one's brains (to think) necessary only at creation of events/actions logic in new StateMachineClass ... :D
...
I did not describe bases of State Machine System in game ...
It's too long, and with my English also it's difficult (i think, that anybody will understand nothing) ... :cry:
But for advanced modders my information is enough to do mods using StateMachineCtl ...

P.S.
For management of effects it's necessary to use StateMachineWrapper, but ... it's already other theme ...

P.P.S.
I have forgotten to tell ... i think, that using this scheme it's possible to create additional crew with existing attributes (Models, Textures, StateMachineClass'es, Animations and so on...) ...
But the new object will not be controlled by hardcode as existing crew sockets (DMY_Soclu_...) ... in other words ... don't work disappearance of crew model at submarine submerging, change of crew models at storm weather and so on...

skwasjer
08-07-09, 03:22 AM
:yeah:

I will try to add a few tips/tutorial in a few weeks time regarding the StateMachineClass & Wrapper controller itself (the properties). I think that if we just add tips and hints as we go, it will be easy for everyone to do in 6 months time :03:

skwasjer
08-07-09, 03:56 AM
lol, I seem to have offended you again, and have to take a beating... (Also nice how you editted that out already...) :nope:

I was speaking of how to script behaviors with StateMachineClass controller. I do not see you explaining that here, do I?


I did not describe bases of State Machine System in game ...
It's too long, and with my English also it's difficult (i think, that anybody will understand nothing) ... :cry:

Basically, what you said here is what I wanted to cover. But ok, I'll just write my own tutorial (as good as I can) like I promised and won't bother with your thread here if you don't want me to.

Regards, skwas

Anvart
08-08-09, 05:18 PM
...
This scheme works without problems ...
To think necessary only at creation of events/actions logic in new StateMachineClass ... :D
...

P.P.S.
I have forgotten to tell ... i think, that using this scheme it's possible to create additional crew with existing attributes (Models, Textures, StateMachineClass'es, Animations and so on...) ...
But the new object will not be controlled by hardcode as existing crew sockets (DMY_Soclu_...) ...

Example: Creation of additional AI (!) crew with standard POSWatch StateMachine Class ...https://s25.postimg.cc/grrrw27cf/poswatch.jpgYes, of course, it's better to make additional crew in separated file ... :haha: (AI...)

Anvart
08-08-09, 05:30 PM
Да-а-а ... :hmmm:
Очевидно мало кто понимает в этом деле ... и поговорить не с кем ...
Мало кому интересна эта не очень простая тема ...
Наверно надо её удалить ...
А то я тут в основном сам с собой разговариваю ...
:haha:
***************************
Obviously this theme is not interesting to the majority of modders ...
At this forum i talk to myself ...
Likely the theme should be deleted ... :har:

Easy_Eight65
08-10-09, 05:56 PM
And it's very interesting to Playable Warship folks like myself.

How cool would it be to have (and see in external view) 20 or 30 addtional crew on the bridge...on the deck...at flak and deck gun battlestations...the possibilities are endless here!

Right now in WSM 2.0 for example, we're limited to only 5 watch crew (max in GWX and stock SH3) with a few crudely modeled AI at AA batteries / DC stations...in external view, the Capital ships look almost abandoned...(SH4 seems to have fixed this with more AI crew on the decks / at flak, DC and gun positions) so keep up the good work, Anvart!

Easy_Eight65

denis_469
08-27-09, 01:35 PM
Анварт - ты немного не прав в своём выводе. Просто таких гуру как ты единицы, а поднятый тобой вопрос слишком сложный для моддинга и его обсуждение не самое простое для большинства.
Спасибо за твои моды ещё раз.

Anvart
08-28-09, 05:12 AM
Анварт - ты немного не прав в своём выводе. Просто таких гуру как ты единицы, а поднятый тобой вопрос слишком сложный для моддинга и его обсуждение не самое простое для большинства.
Спасибо за твои моды ещё раз.
... но до сих пор никто не пытался говорить "конкретно" и не давал каких-либо интересных конструктивных предложений ...

DivingDuck
10-19-09, 07:38 PM
Moin Anvart,

this is incredibly valuable information. Many thanks for sharing.
And kudos to Skwas for S3D. It makes modding so much easier.


This is the result:

http://i182.photobucket.com/albums/x241/DivingDuck/SHIII/Peri_Ani_002.gif



Regards,
DD

Kpt. Lehmann
10-19-09, 08:09 PM
Just when you think that things can't get any more interesting... Diving Duck and Anvart storm ahead with a new masterpiece!

:rock::rock::rock:

Philipp_Thomsen
10-20-09, 04:11 PM
Hats off, DD...

That moving periscope is a genius idea! :rock:

DivingDuck
10-21-09, 08:49 AM
Hey Anvart,
I have made periscope animation on commands Rise_whole_obs_periscope/Lower_whole_obs_periscope only after editing hard code in executable files ...
well, that´s worth a hats off. :salute:

Did you change the hardcode
-to trigger the animation via Rise/Lower_whole_obs_periscope or
-to make 'obj_Extensible' available for interior use?

Regards,
DD

Philipp_Thomsen
10-21-09, 10:44 AM
Actually, hats off for both of you!

Not only for this, but for all the past modding.:up:

DivingDuck
10-22-09, 04:38 AM
Moin,
In any case conception "цель оправдывает средства" and hacking here is not pertinent ... i think ...
Well, you´re right. The devs would most probably not be amused if you would release altered hard code. But anyway, you´ve made it possible. And I do understand that you´ll keep it on your own pc. I wouldn´t release it either. So, I can live with the crew command 'borrowed' to trigger the animation.

Regards,
DD

Uber Gruber
10-22-09, 07:37 AM
The devs would most probably not be amused if you would release altered hard code.

Oh yes, this is definately a no no. The Devs and all of UBI would be most annoyed to think someone released altered hard code from a game released.....err....let me think....oh yeah, 5 years ago this Jan. God forbid such a thing, I imagine the world would stop turning or WW3 at least!

roadhogg
06-20-10, 04:16 PM
Skywas, if you still visit the forums nowdays, did you ever get round to releasing a tutorial on the use of StateMachineClass/Ctl.?

It appears to be able to detect the hull integrity of the uboats via Data/Library/GraphHitPointsAll.Dat. and generate effects/actions.

I was wondering if it could be used to detect the condition of a ship, for instance when it's classed as sunk, and trigger the flooding of zones to make the ship actually sink, in the event that the ship doesn't do so of it's own accord?

If so it could solve the problem of ships being sunk (technically but not actually), reappearing sometime later to be sunk again, but awarding the player no renown because the game considers it already sunk.

roadhogg
06-22-10, 03:55 PM
Hi Anvart,
i was talking about the condition that sometimes happens when a ship is classed as sunk, but doesn't actually sink.
I think it's due to the ship being classed as sunk by destroying critical areas like the keel, engines, fuel or ammo bunkers, but the damage done is not enough to drag the boat under the water, so it sits on the surface.

In that instance the ship is re-rendered when you go out of visual range, and resumes the course the original ship was on.

Happens to me about every 2nd sinking with the Repulse.

I noticed that the GraphHitPointsAll file in the library folder, detects the condition of the hull of a uboat, and triggers actions and effects as a result of hull integrity states.

So i wondered if a similar routine could be made to flood ship zones on a timer delay, on condition that a ship is classed as sunk, but doesn't go down of it's own accord within say 20-30 mins.
I presume the interiors are zoned areas?
Can the interior be flooded even if it's not recieved any damage?

roadhogg
06-23-10, 11:52 AM
I noticed that the GraphHitPointsAll file in the library folder, detects the condition of the hull of a uboat, and triggers actions and effects as a result of hull integrity states.

So i wondered if a similar routine could be made to flood ship zones on a timer delay, on condition that a ship is classed as sunk, but doesn't go down of it's own accord within say 20-30 mins.




About what you speak... about Human Submarine-Ship or about AI Ship...?
I already spoke to you...



When was this?

Unless you mean this?

But you can use StateMachineWrapper for creating flooding effect in interior...


No worries Anvart :DL, if it only works with human controllable submarines or ships it might not be convertable to guarantee non human ships sink anyway.

Btw, your English is much better than my Russian :03:

roadhogg
06-24-10, 12:58 PM
I received some PM's from readers of this forum with similar problems...
You did not write PM's to me..?



No, i've not sent any pm's Anvart.

I plead innocence your honour, honest guv :DL

Similar problems?

Were they related to using the StateMachine controllers to make ships sink?

Or perhaps from people who also had ships that didn't sink?

Or neither of the above maybe?

roadhogg
06-28-10, 06:04 PM
Ok Anvart :).

I'll play with it when i get time.

I might be able to use the floodfB and floodbB zones to get round it ( and might be able to use them as longitudinal armour as well :03:) but it would be better to have a programmed in, 100% reliable sinker for when the boats throw in the towel.

Not even sure yet how the floodf's and b's work exactly, but they seem to sink the boat, unless it's coincidence. But i want to keep the zone count down.


Thanks for the info anyways :up:



Edit: Anyone happen to know if there's an importable (single) model of the Seahawk available anywhere for the Iowa?

Doesn't seem to be in the Air folder or CV_Airplanes file.

Madox58
06-28-10, 06:13 PM
Here's some info for you.
Ref sent this to me along time ago.
Maybe it will help you now.

http://www.mediafire.com/?mngjwmymjy1

roadhogg
06-29-10, 07:06 AM
Six months or so ago some of the info in that document would have come in handy, but at least theres some basic info out there now for anyone else who may be thinking of experimenting with zones and/or spheres.

So on behalf of who ever those people may be, thanks for releasing it.

roadhogg
07-01-10, 02:37 PM
Anvart,
friend . . .
buddy . . .
(have i grovelled enough yet? :D)

since you seem to have a working knowledge of how the StateMachineClass controllers work, is it possible you could give me a brief outline of the formation structure of these controllers?

For instance, where the entry names and expressions that the entries in the controllers refer to, are located?

I imagine that these entry descriptions/expressions must be set somewhere, so that the controller recognises the entry, such as "State_Damaged70", and the expressions, such as "HullIntegrity" & "TimerElapsed", plus the check types "1000", and the GotoEntry numerical routines.

As if that's not enough to be going on with, would you also happen to know how the red map icon, and the "She's going down" message are generated when a ship is classed as sunk, how the game knows when a ships hitpoints have expired (the hitpoint counter) and where i can find their triggers?

Even if i can get the SMC controller to work with non human controlled ships, i have to be able to initiate expressions and actions that the controller will associate with these triggers before i have any hope of making it work.

Any info would be appreciated :DL

roadhogg
07-02-10, 02:35 PM
"Heavy" (difficult) case.
I see you do not understand me...



This is true :DL

I thought that the condition and expression names in the SMC had to be "set" in another file before the SMC would recognise it, but having looked at it again it seems they are "set" locally, ie:

condition [0] = HullIntegrity

Type = 1000

Expression = HullIntegrity

( Condition "HullIntegrity" now recognised as check type 1000 ( whatever, and wherever that is).

Also the State entry names and actions are set locally too.

But i'm still wondering by what means the game calculates the expired or remaining hitpoints a ship has, against it's hitpoint rating.
And by what means it generates the broken red ship icon on the map, or generates the "She's going down" message ( not the appearance of the message, but when to generate it).

I do understand this:

IIRC :haha:,... StateMachine System works only with Human Submarine-Ship

But if there is the possibility it can be made to work for non human ships, and a controller made to gaurantee the sinking of ALL ships when they're supposed to be sunk, then i figure it may be worth a try :DL.

Nothing ventured nothing gained, as they say.

Apologies if i'm causing you headaches.

Anyone here speak Russian? :D and English, fluently?

roadhogg
07-06-10, 01:20 PM
What you mean?
The object which modder can read, to treat and to change (for ex. through S3D) is not the controller... it's the named part of code (part of parameters), which the true controller (hard coded) uses for work...
...
It's difficult to me to discuss programming questions on english... therefore i have finished my speech... :haha:



The object which modder can read, to treat and to change (for ex. through S3D)


1)The bits that you describe, may indeed be an object (3D), but can also be descriptions (Alphabetical fields) or numeric values (numeric fields).

S3D provides the interface, courtesy, as we all know, of skywasjer. :)


is not the controller...


2) I refer you to the first page of skywasjer's interface, line 2) on the right, in red.

I also refer you to any of the StateMachineClass "Graph" files in SH3's Library.
Click on the first node, read the (type) number in the top right hand section.
It's type 10, and the name for type 10. . . is controller.

it's the named part of code (part of parameters). . . . . . refer to part 1)


which the true controller (hard coded) uses for work...


The true controller that you refer to is not actually called the controller.
Some of the generally accepted names are. . . routine, sub-routine, method, function, procedure.
These names describe a section, or chunk, of program code, written to fulfill a specific function (or functions) within a program.

Where the procedure ( or any of the above descriptions ) is relatively simple, preferably uses the same values, and outputs the same result each time, the procedure may be replaced or substituted by a Macro instruction/procedure.
If you are confused by the dual use of the word "Function", it is simply that a procedure fulfils a function ( or functions ), but a procedure can also be CALLED a function, and a procedure can also CALL a function, which is another procedure.

I understand that your knowledge of English is limited, but as a second language, it's more advanced than my second language, so congratulations.

But if i understand you correctly, you are in fact calling a procedure. . . a controller.

If a program is written well, and structured to be easily editable by someone unfamiliar with that particular program, each procedure ( or function ) will be preceeded by explanatory notes written by the original programmer, and headed. The heading for the programmer's notes describing the StateMachineClass code, may well "name" the procedure "StateMachineClassController", or something similar, but these notes, including the heading
will be enclosed within parenthesis, so the program doesn't attempt to read it as part of the code, and crash.

I don't know where you got the name controller for the hard code, because i haven't seen the hard code, nor should i, and therefore nor do i want to.

On the subject of code, i have tried to put an IF, THEN, ELSE condition in the parameters of a zone in the Zones.cfg, just on the off chance that the fields would act on it, but it became obvious that the Zones.cfg just consisted of alphabetical fields for the zone descriptions, and numeric fields for the parameters.

But then hell, without seeing the hard code, i wouldn't know till i tried.

Come to think of it, the effects parameters reads alpha and numerics, so i'll try that later, just in case.
It'll never work i know, but then, as i said i won't know till i try.

If the effects fields will understand an IF, THEN, ELSE as actions, it could be as simple as:

IF ShipDamageState=State_Dead . . . (send it off to the SMC controller to check conditions)
THEN FloodingTime=1800 . . . . . . . . . (slowly flood undamaged zones of dead boat)
ELSE FloodingTime=650 . . . . . . . . . . (normal flood time if ship not dead but zone damaged.)

Now that sounds mad, and linking it all together reliably is not gonna be that simple,
but all i need is for SH3 to understand that statement in some form, wherever i can get it to understand it, (even if it's nowhere near the zones.cfg), linked to the conditions and/or a timer, which will flood previously undamaged zones on a dead boat . . . and job done.

A tall order maybe, but has anybody tried?

But i digress...

Anvart,i've written the above descriptions for program code so that next time you want to explain what a procedure is to someone, you'll know what to call it.
Unfortunately i at least hope, that what i've written is of more assistance to you, than you've been to me.

Maybe in six months or so, after i've cracked it, you might see fit to throw me a relevant crumb.

Of course if i DO find a solution to the sinking problem, obviously you won't want it.

Fair do's.

Madox58
07-06-10, 06:39 PM
Mate,

Anvart is not being rude or with holding anything.
I myself had a hard time understanding him at first.
So I know your frustration.
What he is telling you is quit simple.

The State Machine Controller is Hard Coded to ONLY work for Player Subs.
Take a Stock in Game sub and assign it as an AI Sub in a test mission.
Does it use the State Machine stuff?
(Which is all there!)
NO!
And it never will unless you Hack the basic code.
(Big NO NO!)
Or create a DLL intercept.
(That's allowed to an extent not limited yet.)

Regards,
Privateer

roadhogg
07-07-10, 03:22 PM
I assumed that Anvart may be trying to tell me that the SMC was hard coded for only player subs and ships, but that's not what i got, and assumptions, when you're looking for hard facts, are useless.

IIRC leaves the possibility that he may NOT recall correctly, which throws in to doubt the rest of his statement.


Yes, of course you can try... if you do not regret about time spent uselessly...


Which begs the question, how do you know?
have you tried using it to cause the sinking of supposedly sunk ships?
. . .No indication given.
I'm afraid i was left with nothing i could call constructive or definitive information.

If he wants to withold any information, he's perfectly entitled to. I have no problems with it.

But i was surprised, disapointed, and none too pleased with what looked like the derisory phrasing of those comments, not least because Anvart has never struck me as someone prone to that type of behaviour before.


That said, i am also aware of Anvart's difficulty with English, but wasn't aware of perhaps HOW MUCH difficulty he has with it.

Anvart, if you read this, please accept my unreserved, and most humble apologies for my misunderstanding ( mistake ) . . .good sir. :salute: :salute: :salute:

Regards the SMC, sometimes the best way from A to B, is via a stop off at C, so the SMC possibilities are not over yet.

I've only just scratched the surface on SMC's and the sinking issue.

But this garaunteed sinking problem has become the key to everything i've been working on during the last 6-9 months.
The fact that it already exists in SH3/GWX is no excuse, i have to find a solution, or it's not good enough.
What has become clear, is that as usual, i'm on my own with it. :hmmm:

Editing hardcode . . .as you say, big no no.
Dll intercept's . . . apparently manifests are more reliable than dot.local's, but Vista is supposed to have restrictions on known DLL's ( of which kernel.dll is one ) which don't necessarily work ( the O/S tends to allow none or all ) .
Don't know about Windows 7.
These abilities may be restricted by future updates on any or all O/S's, so don't represent a favoured stable solution.
But thanks.

And Anvart, sorry if i've hijacked your thread.
My questions were only meant to be quickies :cry:

Anvart
07-09-10, 04:07 PM
Thanks, Privateer.
...
And i will repeat... i will not discuss questions of cracking-hacking of game and of injections of ex. code...
http://img20.imageshack.us/img20/3063/offtopicly.gif

Madox58
07-09-10, 07:20 PM
@Anvart,

He has an Idea that State Machine Controllers may be used
when it can not be done.
(unless you hack!)

He should be looking at the Zones to do this.

Adding the correct zones in the correct areas would do this.
It's a matter of trial and error though.
The best have tried and all Mods suffer from the:
It is not good enuff for me.

Nothing was certain during WWII.
History proves that.
Seems to me that the not credited kills kind of adds to the Game.
But I'm weird that way.
:haha:

roadhogg
07-14-10, 07:40 AM
I can't be bothered to reply to this rubbish anymore :nope:

you boys just keep stroking each other's ego's ;)

Edit:

Oh, and consider that apology most definitely withdrawn.

Assuming "that person" might be an adult was such an error.

roadhogg
07-15-10, 01:42 PM
Umm . . . . . you're mistaking me for someone that cares what you think :03:

You and you're buddies haven't twigged it yet have you :O:

Go on mate, try harder, i'm sure you can do better than that if you put your mind to it :D.

Sailor Steve
07-15-10, 02:42 PM
@ roadhogg: At this point you might want to take your own advice, at least for awhile. :sunny:

I can't be bothered to reply to this rubbish anymore :nope:

Anvart
08-21-13, 12:53 PM
The first post, I have restored the losted image with the description of the method and the text was slightly renovated... I think this picture is not worse than previous one.
....
I updated my main picture with describing of my method again, because imageshack has deleted all my pictures.