Jump to content
The Dark Mod Forums

Recommended Posts

Posted

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
Posted

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
Posted (edited)

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

.

Posted

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.

Posted

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

Posted

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?

Posted

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++
Posted

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.

Posted

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.

Posted

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.
  • 1 month later...
Posted

Uploaded new version (see link in the first post).

 

Now this commands syntax is available as a part of automation library.

If you know a bit of Python, you can easily use it in your own script.

 

Also did some refactoring.

Hopefully testing framework would be next step.

 

  • Like 1
  • 6 years later...
Posted
19 hours ago, datiswous said:

I wonder is this still being used by devs? Or there other methods being used now?

Yes, I still use it every year to check that missions are bootable.
Also I sometimes try to use it to reproduce problematic bugs, although it rarely helps.

But I never extended it to anything like a full-fledged testing framework.
There is a major feeling that such kind of tests will drain a lot of time to maintain and won't catch more issues than what any player can do in one play session.

The most up-to-date Python automation framework is in the assets SVN.

Also, hot reload feature in DarkRadiant uses the same code & protocol on the side of TDM engine (but not the Python part).

Posted

I tried to script something recently. But couldn't start the mission from command. Menu sysyem has changed.

I don't know a lot of the commands possible.

I tried to start a mission and immidiatelly frob a readable somewhere in the mission (or a bunch of them in succession). I thought it could aid testing readable text in missions. But it seems too much work considering the other options.

  • Like 1
Posted
20 hours ago, datiswous said:

Where can I find the assets svn? I looked for it here but couldn't find it:

It is not public.

I have added current version of automation to the first post of the thread.
But yes, usually using it is too much work.

  • Thanks 1
Posted

Cool thanks, got it working. Also the controls.txt is helpful. Took me a while to figure out how to type it though.

Guide says:

Controlled via gamectrl.impulse:

0: put away all weapons (backspace)
1-10: ready k-th weapon  (digits 1234567890)
19: objectives (O)
23: crouch          (usable only with "toggle crouch")
24: mantle

But you have to write:

@gamectrl impulse48

Not very straight forward, but I figured it out.

Posted

Question:

In @help of console.py it states:

@guiscript: execute GUI script of specified window (allows clicking menu buttons)",

Is that a gui inside the mission, or some gui file that I have to specify? If I have let's say 20 readable's in a mission, can I open those directly this way? 

Posted
6 hours ago, datiswous said:

In @help of console.py it states:

@guiscript: execute GUI script of specified window (allows clicking menu buttons)",

Is that a gui inside the mission, or some gui file that I have to specify? If I have let's say 20 readable's in a mission, can I open those directly this way? 

I think this is the global GUI active at the current moment.
Most likely this is only main menu GUIs, I believe readables are "overlays" so they won't receive these signals.

  • Like 1

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

    • datiswous

      So on a regular basis I try to start building something in Darkradiant but very quickly I loose interest and give up.
      I tend to
      create a room, position an ai in it (or first ai, then room, probably better) put a light in it Put some stuff in it test the room in tdm Now I had this new idea:
      Start of with a gigantic room. To skip the importance of sealing for the time being and to think broader than one room. Then just use ground without wall, just to visualise the structure of the level.  Then just use prefab walls and other elements (arches, etc.). Just building area's that aren't enclosed. I can always close them at a later point. Maybe this is all very logical from a mappers perspective, but tdm is the first game where I have done any kind of real mapping and I always stop at the start. It just takes too long to make something exciting.
      I want to build something at some point, because over time I accumulated lots of ideas.
      · 12 replies
    • MayheM

      It would be nice to have a link to the forum thread of a mission in download section, rather than having to search for it manually, like on Thief Guild.
      · 1 reply
    • taffernicus

      Anaglypta , floral and damask wallpaper look great in older homes 
      It’s rare to see anyone using “shader not found” wallpaper in their house

       
      · 0 replies
    • Ansome

      Terribly difficult juggling map designing with work, but I'm still alive and chipping away at something very special. I'm actually making a collaboration of sorts with a friend, I make the map itself and he acts as my "Chief Scope Creep Consultant" that checks in every so often to make sure this project isn't getting out of hand. It's a good system!
      · 1 reply
    • JackFarmer

      We don't need artificial intelligence; we need artistic intelligence. 
      Ralf Hütter, Kraftwerk
      · 6 replies
×
×
  • Create New...