Jump to content
The Dark Mod Forums

Automation features and discussion


stgatilov

Recommended Posts

I have previously posted about automation efforts in this thread about watching over asset files.

I decided to create a more generic thread for whatever discussions related to automation.

 

The most recent version of automation library and scripts (by the time this topic was created) can be downloaded from this link.

More information can be found in readme.md.

It should run properly against any beta version of TDM 2.07.

 

Some new Python 3 is required to run automation stuff.

I'm afraid that decent skills in Python are needed if you want to do anything advanced with it.

If you have some tedious work that you regularly do with TDM, and feel that it can be automated, post ideas here.

 

UPDATE: Current version (2019.02.22) is available here.

It should run properly against TDM 2.07.

 

  • Like 5
Link to comment
Share on other sites

Here is a video showcasing automation commands (you can type them into console.py, and I intend to integrate them into automation library in future).

I managed to complete the shortest TDM mission without directly interacting with the game.

 

Beware: the video is long and very boring :mellow:

 

  • Like 4
Link to comment
Share on other sites

Just now automation has been used to start every FM released to date.

It is about 125-128 missions already :o

That's a huge number :wub: , and merely starting and cheat-completing them all takes something like 90 minutes :wacko:

 

If anyone is interested in this feature, see complete_any.seq (commands sequence) and foreachfm.py (the runner script) in the automation package.

  • Like 2
Link to comment
Share on other sites

At this moment, i can only say to this automation feature: WOW! :blink:

Immediately got some ideas for it. Like a TDM-Tweaker, video-problems debugger, benchmarker, etc.

 

Now to find a small python collection package (or one-single binary), to run scripts from.

Do you know something i can use.

Like winpython?

 

 

Btw,

nice to see midnight commander in action.

I'm a bit more a totalcommander (ultima prime) user myself.

Edited by freyk

Info: My portfolio and darkmod graphical installer
Amnesty for Bikerdude!

Link to comment
Share on other sites

Now to find a small python collection package (or one-single binary), to run scripts from.

Do you know something i can use.

Like winpython?

Never used anything except CPython myself.

People use py2exe or pyinstaller to produce a standalone executable.

I'll try them in future (after I get rid of ugly sys.path hack).

 

 

nice to see midnight commander in action.

I'm a bit more a totalcommander (ultima prime) user myself.

Thou shalt not confuse the great Far Manager with the ugly Midnight Commander!

Anyway, all of them are descendants of the same Norton Commander.

Link to comment
Share on other sites

I figured, I'll use automation for testing if my fix for #4952 works. :-)

I have added two new commandline args "num_repeats" and "repeat_seqFile" to foreachfm.py. If both are specified, the regular seqFile is only executed once as a form of initialization and then repeat_seqFile is executed periodically as specified in the num_repeats argument.

 

This way, I can now easily repeatedly enter the fighting area and let myself get killed by the AI with a simple a script as this:

#teleport to fighting area, wait to be killed

setviewpos -551.59 -1949.04 -180.94 -16.0 -176.5 1.1

$time.sleep(20.0)

This is really awesome and makes our lives a lot easier, so thanks stgatilov!! :-) I have the debugger attached. If I eventually hit a set breakpoint, my fix works! :-) If the game crashes, it doesn't. ^^

 

By the way, I accidentally once tele-fragged the AI because I had used a too low sleep timing. :-D

Link to comment
Share on other sites

Ok, so far, I didn't manage to reproduce the behavior with this sequence. So I was thinking to add random rotations and movements as well as the occasional attack. So, how to feed random values from python to the automation interface? One way to achieve this would be to have python write a new .seq file with the desired commands and have that .seq file executed. I guess, there is no other interface to achieve that right now, is there?

Link to comment
Share on other sites

After three hours of running, the game crashed in Automation::ParseAction() with a Null-pointer exception because

idFile *f = fileSystem->OpenFileRead(logFile->GetName());

apparently failed to open the file for some reason and f==NULL is not asserted. I wonder why it cannot open the file anymore. I backuped the pdb and saved both a full dump and a minidump, if you want to investigate the issue closer. The full dump is 5 gigs, though.

 

This is not the crash I was hoping for... If it had crashed during LeaveSearch() again, I would've known that my fix does not work. Now, as it stands, I haven't learnt anything, except that this is maybe the wrong way to reproduce the issue or that it is incredibly rare!

 

Callstack:

 

TheDarkModx64.exe!idCommonLocal::GetConsoleContents(int begin=31058, int end=31058) Line 502 C++
TheDarkModx64.exe!Automation::ParseAction(Automation::ParseIn & parseIn={...}) Line 298 C++
TheDarkModx64.exe!Automation::ParseMessage(Automation::ParseIn & parseIn={...}) Line 269 C++
TheDarkModx64.exe!Automation::ParseMessage(const char * message=0x00000232c0554cb0, int len=107) Line 256 C++
TheDarkModx64.exe!Automation::Think() Line 533 C++
TheDarkModx64.exe!Auto_Think() Line 538 C++
TheDarkModx64.exe!idEventLoop::RunEventLoop(bool commandExecution=true) Line 171 C++
TheDarkModx64.exe!idCommonLocal::Frame() Line 2450 C++
TheDarkModx64.exe!WinMain(HINSTANCE__ * hInstance=0x00007ff7e4f40000, HINSTANCE__ * hPrevInstance=0x0000000000000000, char * lpCmdLine=0x00000232df913bbe, int nCmdShow=10) Line 1363 C++
Link to comment
Share on other sites

I figured, I'll use automation for testing if my fix for #4952 works. :-)

I have added two new commandline args "num_repeats" and "repeat_seqFile" to foreachfm.py. If both are specified, the regular seqFile is only executed once as a form of initialization and then repeat_seqFile is executed periodically as specified in the num_repeats argument.

To be honest, I hoped that script will only be used for massive testing over many FMs, not for ordinary checking.

Probably it's better to keep it that way, because otherwise a lot of stuff will fill it over time.

 

There is another script called repeat.py, which is very small and not really important.

It's better to fill it with regular testing stuff.

For instance, I used it for testing crashes in 4919 the following hacky way:

1) I created a file finish_mission.seq, which loads a quicksave, moves forward to mission exit, waits until mission finish screen loads up.

2) Then I created another file finish_mission_10.seq, which had one command @file finish_mission.seq copy-pasted 10 times, and exit at the very end.

3) Then I run repeat.py finish_mission_10.seq.

So it boots TDM, performs sequence 10 times in a row, then properly exits. Repeat 100 times. If something crashes, repeat.py will catch nonzero exit code.

Link to comment
Share on other sites

Ok, so far, I didn't manage to reproduce the behavior with this sequence. So I was thinking to add random rotations and movements as well as the occasional attack. So, how to feed random values from python to the automation interface? One way to achieve this would be to have python write a new .seq file with the desired commands and have that .seq file executed. I guess, there is no other interface to achieve that right now, is there?

There is no plan to turn automation commands syntax into real programming language --- there is python for that!

Just write your own Python script and use automation class there directly.

For gameplay actions you can either try to use game_controls directly or try to invoke console.py (I seriously plan to move commands execution engine from this script to library).

 

After three hours of running, the game crashed in Automation::ParseAction() with a Null-pointer exception because

idFile *f = fileSystem->OpenFileRead(logFile->GetName());

apparently failed to open the file for some reason and f==NULL is not asserted. I wonder why it cannot open the file anymore. I backuped the pdb and saved both a full dump and a minidump, if you want to investigate the issue closer. The full dump is 5 gigs, though.

This is not the crash I was hoping for... If it had crashed during LeaveSearch() again, I would've known that my fix does not work. Now, as it stands, I haven't learnt anything, except that this is maybe the wrong way to reproduce the issue or that it is incredibly rare!

Did you look for this file on your machine? Was it present or not? empty or not?

When did this happened? Does your script rerun TDM process? install different FM?

Do you normally have logFile cvar enabled?

 

This may be some sort of race condition.

Link to comment
Share on other sites

Wowza, I expected you'd be happy about somebody actually using your automation stuff. ^^

 

To be honest, I hoped that script will only be used for massive testing over many FMs, not for ordinary checking.

Probably it's better to keep it that way, because otherwise a lot of stuff will fill it over time.

Well, that script already supported testing individual FMs. And using a repeatable .seq file might also make sense with massive FM testing. With that in place, you can very easily, without even knowing python, test about anything, and that's good right? I really see no harm in adding that feature, but if you don't like it, we can very well revert the change and I'll add a renamed copy of it. But look at the diff first. It's really almost nothing I have added. ;)

 

Just write your own Python script and use automation class there directly.

For gameplay actions you can either try to use game_controls directly or try to invoke console.py (I seriously plan to move commands execution engine from this script to library).

Could you show me an example of howto do a random rotation in tdm with a python script? I tried to figure it out, but I am not that experienced with python and I also miss all those comfort features of Visual Studio. :-)

 

Did you look for this file on your machine? Was it present or not? empty or not?

When did this happened? Does your script rerun TDM process? install different FM?

Do you normally have logFile cvar enabled?

It was present and filled, if happened after 3 hours of "fighting" in the Training Mission using the described automation script. It does not restart TDM process inbetween, just 3 hours of continuous testing in a single FM without any reloading. I have logfile 2 always set.
Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
×
×
  • Create New...