From 67166abd3dd4c16b5a9f930f743824d6e43f12dc Mon Sep 17 00:00:00 2001 From: Marqt Date: Mon, 20 Feb 2017 15:06:42 +0100 Subject: [PATCH 1/7] example Dockerfile for Torch and TensorFlow Former-commit-id: b89f45c664439013e29d3ae5c6823896caecac3e --- docker/tensorflow/Dockerfile | 92 ++++++++++++++++++++++++++++++++++++ docker/torch/Dockerfile | 86 +++++++++++++++++++++++++++++++++ 2 files changed, 178 insertions(+) create mode 100644 docker/tensorflow/Dockerfile create mode 100644 docker/torch/Dockerfile diff --git a/docker/tensorflow/Dockerfile b/docker/tensorflow/Dockerfile new file mode 100644 index 000000000..63e71c194 --- /dev/null +++ b/docker/tensorflow/Dockerfile @@ -0,0 +1,92 @@ +FROM ubuntu:16.04 # CPU ONLY + +# GPU -> see: https://github.com/NVIDIA/nvidia-docker +#FROM nvidia/cuda:7.5-cudnn5-devel +# or +#FROM nvidia/cuda:8.0-cudnn5-devel + +# Install dependencies +RUN apt-get update && apt-get install -y \ + build-essential \ + bzip2 \ + cmake \ + curl \ + git \ + libboost-all-dev \ + libbz2-dev \ + libfluidsynth-dev \ + libfreetype6-dev \ + libgme-dev \ + libgtk2.0-dev \ + libjpeg-dev \ + libopenal-dev \ + libpng12-dev \ + libsdl2-dev \ + libwildmidi-dev \ + libzmq3-dev \ + nano \ + nasm \ + pkg-config \ + python-dev \ + python \ + rsync \ + software-properties-common \ + sudo \ + tar \ + timidity \ + unzip \ + wget \ + zlib1g-dev + + +# Pick up pip +RUN curl -O https://bootstrap.pypa.io/get-pip.py && \ + python get-pip.py && \ + rm get-pip.py + +# Install more dependencies via pip +RUN pip --no-cache-dir install \ + ipykernel \ + jupyter \ + matplotlib \ + numpy \ + scipy \ + sklearn \ + pandas \ + Pillow \ + +# Install TensorFlow +RUN pip --no-cache-dir install http://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl +# or +#RUN pip --no-cache-dir install http://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl + +# Clone ViZDoom and build + install via pip +RUN git clone https://github.com/mwydmuch/ViZDoom.git /root/vizdoom && \ + pip install git+file:///root/vizdoom + +# Expose ViZDoom's multiplayer port +EXPOSE 5029 + +# Code below allows sharing X11 socket with container +# Replace 1000 with your user / group id +RUN export uid=1000 gid=1000 && \ + mkdir -p /home/developer && \ + echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \ + echo "developer:x:${uid}:" >> /etc/group && \ + echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \ + chmod 0440 /etc/sudoers.d/developer && \ + chown ${uid}:${gid} -R /home/developer + +USER developer +ENV HOME /home/developer + +# Set workdir +WORKDIR /root/vizdoom/examples/pyhton + +# Expose python command +CMD ["python"] + +# Examples of usage: +# BUILD THIS DOCKER: docker build -t tf+vizdoom . +# RUN THIS DOCKER WITH X11: docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix tf+vizdoom python basic.py + diff --git a/docker/torch/Dockerfile b/docker/torch/Dockerfile new file mode 100644 index 000000000..04ec6a895 --- /dev/null +++ b/docker/torch/Dockerfile @@ -0,0 +1,86 @@ +FROM ubuntu:16.04 # CPU ONLY + +# GPU -> see: https://github.com/NVIDIA/nvidia-docker +#FROM nvidia/cuda:7.5-cudnn5-devel +# or +#FROM nvidia/cuda:8.0-cudnn5-devel + +# Install all dependencies +RUN apt-get update && apt-get install -y \ + build-essential \ + bzip2 \ + cmake \ + git \ + libboost-all-dev \ + libbz2-dev \ + libfluidsynth-dev \ + libgme-dev \ + libgtk2.0-dev \ + libjpeg-dev \ + libopenal-dev \ + libsdl2-dev \ + libwildmidi-dev \ + nasm \ + nano \ + sudo \ + tar \ + timidity \ + unzip \ + wget \ + zlib1g-dev + +# Clone Torch, install dependencies and build Torch (building blas may take a while) +RUN git clone https://github.com/torch/distro.git /root/torch --recursive && \ + cd /root/torch && \ + bash install-deps && \ + ./install.sh + +# Export environment variables manually +ENV LUA_PATH='/root/.luarocks/share/lua/5.1/?.lua;/root/.luarocks/share/lua/5.1/?/init.lua;/root/torch/install/share/lua/5.1/?.lua;/root/torch/install/share/lua/5.1/?/init.lua;./?.lua;/root/torch/install/share/luajit-2.1.0-beta1/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua' +ENV LUA_CPATH='/root/.luarocks/lib/lua/5.1/?.so;/root/torch/install/lib/lua/5.1/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so' +ENV PATH=/root/torch/install/bin:$PATH +ENV LD_LIBRARY_PATH=/root/torch/install/lib:$LD_LIBRARY_PATH +ENV DYLD_LIBRARY_PATH=/root/torch/install/lib:$DYLD_LIBRARY_PATH +ENV LUA_CPATH='/root/torch/install/lib/?.so;'$LUA_CPATH +ENV TERM xterm + +# Install more dependencies via luarocks +RUN luarocks install torchffi && \ + luarocks install image + +# Install CUDA libraries +RUN luarocks install cutorch && \ + luarocks install cunn && \ + luarocks install cudnn + +# Clone ViZDoom and build + install via luarocks +RUN git clone https://github.com/mwydmuch/ViZDoom.git /root/vizdoom && \ + cd /root/vizdoom && \ + luarocks make + +# Expose ViZDoom's multiplayer port +EXPOSE 5029 + +# Code below allows sharing X11 socket with container +# Replace 1000 with your user / group id +RUN export uid=1000 gid=1000 && \ + mkdir -p /home/developer && \ + echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \ + echo "developer:x:${uid}:" >> /etc/group && \ + echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \ + chmod 0440 /etc/sudoers.d/developer && \ + chown ${uid}:${gid} -R /home/developer + +USER developer +ENV HOME /home/developer + +# Set workdir +WORKDIR /root/vizdoom/examples/lua + +# Expose th command +CMD ["th"] + +# Examples of usage: +# BUILD THIS DOCKER: docker build -t torch+vizdoom . +# RUN THIS DOCKER WITH X11: docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix torch+vizdoom th basic.lua + From bf1f761dc7476c50236ab6d3487e06335318812f Mon Sep 17 00:00:00 2001 From: Marqt Date: Wed, 22 Mar 2017 01:32:37 +0100 Subject: [PATCH 2/7] viz_respawn_delay option, max number of players rised to 16, viz_nocheat is now serverinfo cvar Former-commit-id: 6f3cac10a0fa84f0c1241a6d55f05330d594e934 --- include/ViZDoomConsts.h | 2 +- src/vizdoom/src/d_net.h | 2 +- src/vizdoom/src/doomdef.h | 2 +- src/vizdoom/src/p_interaction.cpp | 8 +++++++- src/vizdoom/src/p_user.cpp | 8 +++++++- src/vizdoom/src/viz_main.cpp | 19 ++++++++++++++++++- 6 files changed, 35 insertions(+), 6 deletions(-) diff --git a/include/ViZDoomConsts.h b/include/ViZDoomConsts.h index 2295e7271..318a66cd6 100644 --- a/include/ViZDoomConsts.h +++ b/include/ViZDoomConsts.h @@ -26,7 +26,7 @@ namespace vizdoom{ const unsigned int SLOT_COUNT = 10; - const unsigned int MAX_PLAYERS = 8; + const unsigned int MAX_PLAYERS = 16; const unsigned int MAX_PLAYER_NAME_LENGTH = 16; const unsigned int USER_VARIABLE_COUNT = 60; const unsigned int DEFAULT_TICRATE = 35; diff --git a/src/vizdoom/src/d_net.h b/src/vizdoom/src/d_net.h index f9c4f6106..54930f199 100644 --- a/src/vizdoom/src/d_net.h +++ b/src/vizdoom/src/d_net.h @@ -37,7 +37,7 @@ // #define DOOMCOM_ID 0x12345678l -#define MAXNETNODES 8 // max computers in a game +#define MAXNETNODES 16 // max computers in a game #define BACKUPTICS 36 // number of tics to remember #define MAXTICDUP 5 #define LOCALCMDTICS (BACKUPTICS*MAXTICDUP) diff --git a/src/vizdoom/src/doomdef.h b/src/vizdoom/src/doomdef.h index 802591386..5c7a4f3db 100644 --- a/src/vizdoom/src/doomdef.h +++ b/src/vizdoom/src/doomdef.h @@ -53,7 +53,7 @@ typedef enum #endif // The maximum number of players, multiplayer/networking. -#define MAXPLAYERS 8 +#define MAXPLAYERS 16 // State updates, number of tics / second. #define TICRATE 35 diff --git a/src/vizdoom/src/p_interaction.cpp b/src/vizdoom/src/p_interaction.cpp index 0c61b2d7d..b7603fcc2 100644 --- a/src/vizdoom/src/p_interaction.cpp +++ b/src/vizdoom/src/p_interaction.cpp @@ -72,6 +72,10 @@ CVAR (Bool, cl_showsprees, true, CVAR_ARCHIVE) CVAR (Bool, cl_showmultikills, true, CVAR_ARCHIVE) EXTERN_CVAR (Bool, show_obituaries) +//VIZDOOM_CODE +#include "viz_main.h" +EXTERN_CVAR (Int, viz_respawn_delay) + FName MeansOfDeath; @@ -604,7 +608,9 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags) FBehavior::StaticStartTypedScripts (SCRIPT_Death, this, true); // [RH] Force a delay between death and respawn - player->respawn_time = level.time + TICRATE; + //VIZDOOM_CODE + player->respawn_time = level.time + *viz_respawn_delay * TICRATE; + //VIZ_DebugMsg(2, VIZ_FUNC, "level.time: %d, viz_respawn_delay: %d, player->respawn_time: %d", level.time, *viz_respawn_delay, player->respawn_time); //Added by MC: Respawn bots if (bglobal.botnum && !demoplayback) diff --git a/src/vizdoom/src/p_user.cpp b/src/vizdoom/src/p_user.cpp index c4c594858..fc40c7b08 100644 --- a/src/vizdoom/src/p_user.cpp +++ b/src/vizdoom/src/p_user.cpp @@ -55,6 +55,10 @@ #include "farchive.h" #include "r_renderer.h" +//VIZDOOM_CODE +#include "viz_main.h" +EXTERN_CVAR (Int, viz_spectator) + static FRandom pr_skullpop ("SkullPop"); // [RH] # of ticks to complete a turn180 @@ -2135,7 +2139,9 @@ void P_DeathThink (player_t *player) if ((player->cmd.ucmd.buttons & BT_USE || ((multiplayer || alwaysapplydmflags) && (dmflags & DF_FORCE_RESPAWN))) && !(dmflags2 & DF2_NO_RESPAWN)) { - if (level.time >= player->respawn_time || ((player->cmd.ucmd.buttons & BT_USE) && player->Bot == NULL)) + //VIZDOOM_CODE + if (level.time >= player->respawn_time && ((player->cmd.ucmd.buttons & BT_USE) && player->Bot == NULL)) + //if (level.time >= player->respawn_time || ((player->cmd.ucmd.buttons & BT_USE) && player->Bot == NULL)) { player->cls = NULL; // Force a new class if the player is using a random class player->playerstate = (multiplayer || (level.flags2 & LEVEL2_ALLOWRESPAWN)) ? PST_REBORN : PST_ENTER; diff --git a/src/vizdoom/src/viz_main.cpp b/src/vizdoom/src/viz_main.cpp index 43374b5e7..204194d00 100644 --- a/src/vizdoom/src/viz_main.cpp +++ b/src/vizdoom/src/viz_main.cpp @@ -98,9 +98,12 @@ CVAR (Bool, viz_noxserver, false, CVAR_NOSET) CVAR (Bool, viz_noconsole, false, CVAR_NOSET) CVAR (Bool, viz_nosound, false, CVAR_NOSET) +// multiplayer/recordings CVAR (Int, viz_override_player, 0, 0) CVAR (Bool, viz_loop_map, false, CVAR_NOSET) -CVAR (Bool, viz_nocheat, false, CVAR_NOSET) +CVAR (Bool, viz_spectator, false, CVAR_NOSET) +CVAR (Bool, viz_nocheat, false, CVAR_NOSET|CVAR_SERVERINFO) +CVAR (Int, viz_respawn_delay, 1, CVAR_DEMOSAVE|CVAR_SERVERINFO) CCMD(viz_set_seed){ viz_seed.CmdSet(argv[1]); @@ -198,6 +201,20 @@ void VIZ_Tic(){ VIZ_DebugMsg(2, VIZ_FUNC, "tic: %d, vizTime: %d", gametic, vizTime); VIZ_DebugMsg(4, VIZ_FUNC, "rngseed: %d, use_staticrng: %d, staticrngseed: %d", rngseed, use_staticrng, staticrngseed); + if(*viz_debug >= 5){ + std::string vizCvarsStateMsg = std::string("viz_cvars: ") + + "viz_controlled: %d, viz_instance_id: %d, viz_seed: %d, viz_async: %d, viz_allow_input: %d, viz_sync_timeout: %d" + + ", viz_screen_format: %d, viz_depth: %d, viz_labels: %d, viz_automap: %d, viz_render_mode: %d, viz_automap_mode: %d" + + ", viz_render_corpses: %d, viz_render_all: %d, viz_window_hidden: %d, viz_noxserver: %d, viz_noconsole: %d, viz_nosound: %d" + + ", viz_override_player: %d, viz_loop_map: %d, viz_spectator: %d, viz_nocheat: %d, viz_respawn_delay: %d"; + + VIZ_DebugMsg(5, VIZ_FUNC, vizCvarsStateMsg.c_str(), + *viz_controlled, *viz_instance_id, *viz_seed, *viz_async, *viz_allow_input, *viz_sync_timeout, + *viz_screen_format, *viz_depth, *viz_labels, *viz_automap, *viz_render_mode, *viz_automap_mode, + *viz_render_corpses, *viz_render_all, *viz_window_hidden, *viz_noxserver, *viz_noconsole, *viz_nosound, + *viz_override_player, *viz_loop_map, *viz_spectator, *viz_nocheat, *viz_respawn_delay); + } + VIZ_InterruptionPoint(); if (*viz_controlled){ From e4b6d4e3494d095c7696c7086bf18163fd7fd780 Mon Sep 17 00:00:00 2001 From: Marqt Date: Thu, 23 Mar 2017 10:28:32 +0100 Subject: [PATCH 3/7] Experimental spectator mode Former-commit-id: 588921c06b2f825119dc31c42d9c80eab0dc385e --- src/vizdoom/src/d_netinfo.cpp | 14 ++++++++++++-- src/vizdoom/src/d_player.h | 6 ++++++ src/vizdoom/src/g_game.cpp | 6 ++++++ src/vizdoom/src/namedef.h | 3 +++ src/vizdoom/src/p_user.cpp | 3 +-- src/vizdoom/src/viz_game.cpp | 7 +++++++ src/vizdoom/src/viz_main.cpp | 16 +++++++++------- 7 files changed, 44 insertions(+), 11 deletions(-) diff --git a/src/vizdoom/src/d_netinfo.cpp b/src/vizdoom/src/d_netinfo.cpp index 3010de16d..4569f4ec4 100644 --- a/src/vizdoom/src/d_netinfo.cpp +++ b/src/vizdoom/src/d_netinfo.cpp @@ -72,6 +72,10 @@ CVAR (Float, movebob, 0.25f, CVAR_USERINFO | CVAR_ARCHIVE); CVAR (Float, stillbob, 0.f, CVAR_USERINFO | CVAR_ARCHIVE); CVAR (String, playerclass, "Fighter", CVAR_USERINFO | CVAR_ARCHIVE); +//VIZDOOM_CODE +#include "viz_main.h" +EXTERN_CVAR(Bool, viz_spectator) + enum { INFO_Name, @@ -85,6 +89,9 @@ enum INFO_StillBob, INFO_PlayerClass, INFO_ColorSet, + + //VIZDOOM_CODE + INFO_Viz_Spectator }; const char *GenderNames[3] = { "male", "female", "other" }; @@ -883,14 +890,14 @@ void ReadCompatibleUserInfo(FArchive &arc, userinfo_t &info) char netname[MAXPLAYERNAME + 1]; BYTE team; int aimdist, color, colorset, skin, gender; - bool neverswitch; + bool neverswitch, spectator; //fixed_t movebob, stillbob; These were never serialized! //int playerclass; " info.Reset(); arc.Read(&netname, sizeof(netname)); - arc << team << aimdist << color << skin << gender << neverswitch << colorset; + arc << team << aimdist << color << skin << gender << neverswitch << colorset << spectator; *static_cast(info[NAME_Name]) = netname; *static_cast(info[NAME_Team]) = team; @@ -900,6 +907,9 @@ void ReadCompatibleUserInfo(FArchive &arc, userinfo_t &info) *static_cast(info[NAME_NeverSwitchOnPickup]) = neverswitch; *static_cast(info[NAME_ColorSet]) = colorset; + //VIZDOOM_CODE + *static_cast(info[NAME_VIZ_Spectator]) = spectator; + UCVarValue val; val.Int = color; static_cast(info[NAME_Color])->SetGenericRep(val, CVAR_Int); diff --git a/src/vizdoom/src/d_player.h b/src/vizdoom/src/d_player.h index 5ada741dc..e01ccf7ee 100644 --- a/src/vizdoom/src/d_player.h +++ b/src/vizdoom/src/d_player.h @@ -336,6 +336,12 @@ struct userinfo_t : TMap return *static_cast(*CheckKey(NAME_Wi_NoAutostartMap)); } + //VIZDOOM_CODE + bool GetSpectator() const + { + return *static_cast(*CheckKey(NAME_VIZ_Spectator)); + } + void Reset(); int TeamChanged(int team); int SkinChanged(const char *skinname, int playerclass); diff --git a/src/vizdoom/src/g_game.cpp b/src/vizdoom/src/g_game.cpp index 96e39fb4b..60055e037 100644 --- a/src/vizdoom/src/g_game.cpp +++ b/src/vizdoom/src/g_game.cpp @@ -1570,6 +1570,12 @@ void G_DeathMatchSpawnPlayer (int playernum) unsigned int selections; FPlayerStart *spot; +// VIZ_DebugMsg(0, VIZ_FUNC, "player %d, spectator: %d", playernum, players[playernum].userinfo.GetSpectator()); +// if(!players[playernum].userinfo.GetSpectator()) { +// players[playernum].playerstate = PST_DEAD; +// return; +// } + selections = deathmatchstarts.Size (); // [RH] We can get by with just 1 deathmatch start if (selections < 1) diff --git a/src/vizdoom/src/namedef.h b/src/vizdoom/src/namedef.h index ae456883c..b428c4cb6 100644 --- a/src/vizdoom/src/namedef.h +++ b/src/vizdoom/src/namedef.h @@ -616,3 +616,6 @@ xx(MoveBob) xx(StillBob) xx(PlayerClass) xx(Wi_NoAutostartMap) + +//VIZDOOM_CODE +xx(VIZ_Spectator) diff --git a/src/vizdoom/src/p_user.cpp b/src/vizdoom/src/p_user.cpp index fc40c7b08..ab1246931 100644 --- a/src/vizdoom/src/p_user.cpp +++ b/src/vizdoom/src/p_user.cpp @@ -57,7 +57,6 @@ //VIZDOOM_CODE #include "viz_main.h" -EXTERN_CVAR (Int, viz_spectator) static FRandom pr_skullpop ("SkullPop"); @@ -2203,7 +2202,7 @@ void P_PlayerThink (player_t *player) if (player->mo == NULL) { - I_Error ("No player %td start\n", player - players + 1); + I_Error ("No player %td start\n", player - players + 1); } if (debugfile && !(player->cheats & CF_PREDICTING)) diff --git a/src/vizdoom/src/viz_game.cpp b/src/vizdoom/src/viz_game.cpp index bed956092..b867b32a8 100644 --- a/src/vizdoom/src/viz_game.cpp +++ b/src/vizdoom/src/viz_game.cpp @@ -251,6 +251,13 @@ void VIZ_GameStateTic(){ vizGameStateSM->PLAYER_COUNT = 0; for (size_t i = 0; i < VIZ_MAX_PLAYERS; ++i) { if(playeringame[i]){ + if(players[i].userinfo.GetSpectator() && players[i].mo != NULL) { + //players[i].mo->UnlinkFromWorld (); + players[i].mo->flags = MF_NOCLIP|MF_NOGRAVITY|MF_FRIENDLY; + players[i].mo->flags2 |= MF2_FLY; + players[i].mo->renderflags |= RF_INVISIBLE; + } + ++vizGameStateSM->PLAYER_COUNT; vizGameStateSM->PLAYER_N_IN_GAME[i] = true; strncpy(vizGameStateSM->PLAYER_N_NAME[i], players[i].userinfo.GetName(), VIZ_MAX_PLAYER_NAME_LEN); diff --git a/src/vizdoom/src/viz_main.cpp b/src/vizdoom/src/viz_main.cpp index 204194d00..759e4507f 100644 --- a/src/vizdoom/src/viz_main.cpp +++ b/src/vizdoom/src/viz_main.cpp @@ -101,9 +101,9 @@ CVAR (Bool, viz_nosound, false, CVAR_NOSET) // multiplayer/recordings CVAR (Int, viz_override_player, 0, 0) CVAR (Bool, viz_loop_map, false, CVAR_NOSET) -CVAR (Bool, viz_spectator, false, CVAR_NOSET) -CVAR (Bool, viz_nocheat, false, CVAR_NOSET|CVAR_SERVERINFO) -CVAR (Int, viz_respawn_delay, 1, CVAR_DEMOSAVE|CVAR_SERVERINFO) +CVAR (Bool, viz_nocheat, false, CVAR_NOSET | CVAR_SERVERINFO) +CVAR (Int, viz_respawn_delay, 1, CVAR_DEMOSAVE | CVAR_SERVERINFO) +CVAR (Bool, viz_spectator, false, CVAR_USERINFO) CCMD(viz_set_seed){ viz_seed.CmdSet(argv[1]); @@ -144,7 +144,7 @@ void VIZ_FreezeTime (bool frozen){ //if (*viz_allow_input) _I_FreezeTime(frozen); vizFreeze = frozen; } - +//players[playernum].userinfo.GetSpectator() void VIZ_Init(){ if(*viz_controlled) { Printf("VIZ_Init: instance id: %s, async: %d, input: %d\n", *viz_instance_id, *viz_async, *viz_allow_input); @@ -173,6 +173,8 @@ void VIZ_Init(){ I_FreezeTime = &VIZ_FreezeTime; } } + + Printf("VIZ_Init: specatator name: %s\n", viz_spectator.GetName()); } void VIZ_Close(){ @@ -206,13 +208,13 @@ void VIZ_Tic(){ + "viz_controlled: %d, viz_instance_id: %d, viz_seed: %d, viz_async: %d, viz_allow_input: %d, viz_sync_timeout: %d" + ", viz_screen_format: %d, viz_depth: %d, viz_labels: %d, viz_automap: %d, viz_render_mode: %d, viz_automap_mode: %d" + ", viz_render_corpses: %d, viz_render_all: %d, viz_window_hidden: %d, viz_noxserver: %d, viz_noconsole: %d, viz_nosound: %d" - + ", viz_override_player: %d, viz_loop_map: %d, viz_spectator: %d, viz_nocheat: %d, viz_respawn_delay: %d"; + + ", viz_override_player: %d, viz_loop_map: %d, viz_nocheat: %d, viz_respawn_delay: %d"; VIZ_DebugMsg(5, VIZ_FUNC, vizCvarsStateMsg.c_str(), *viz_controlled, *viz_instance_id, *viz_seed, *viz_async, *viz_allow_input, *viz_sync_timeout, *viz_screen_format, *viz_depth, *viz_labels, *viz_automap, *viz_render_mode, *viz_automap_mode, *viz_render_corpses, *viz_render_all, *viz_window_hidden, *viz_noxserver, *viz_noconsole, *viz_nosound, - *viz_override_player, *viz_loop_map, *viz_spectator, *viz_nocheat, *viz_respawn_delay); + *viz_override_player, *viz_loop_map, *viz_nocheat, *viz_respawn_delay); } VIZ_InterruptionPoint(); @@ -268,7 +270,7 @@ EXTERN_CVAR(Int, wipetype) // hud EXTERN_CVAR(Int, screenblocks) -EXTERN_CVAR (Bool, st_scale) +EXTERN_CVAR(Bool, st_scale) EXTERN_CVAR(Bool, hud_scale) EXTERN_CVAR(Bool, hud_althud) From 0b750419d56e8cbc5db0756e2022d18c2a332f8b Mon Sep 17 00:00:00 2001 From: Marqt Date: Thu, 23 Mar 2017 12:05:11 +0100 Subject: [PATCH 4/7] Improved multiplayer spectator Former-commit-id: c2cd56b6615faf44b695abadf578639672af9e14 --- src/vizdoom/src/g_game.cpp | 15 +++++++++------ src/vizdoom/src/viz_game.cpp | 9 +-------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/vizdoom/src/g_game.cpp b/src/vizdoom/src/g_game.cpp index 60055e037..b3102b40b 100644 --- a/src/vizdoom/src/g_game.cpp +++ b/src/vizdoom/src/g_game.cpp @@ -1570,12 +1570,6 @@ void G_DeathMatchSpawnPlayer (int playernum) unsigned int selections; FPlayerStart *spot; -// VIZ_DebugMsg(0, VIZ_FUNC, "player %d, spectator: %d", playernum, players[playernum].userinfo.GetSpectator()); -// if(!players[playernum].userinfo.GetSpectator()) { -// players[playernum].playerstate = PST_DEAD; -// return; -// } - selections = deathmatchstarts.Size (); // [RH] We can get by with just 1 deathmatch start if (selections < 1) @@ -1611,6 +1605,15 @@ void G_DeathMatchSpawnPlayer (int playernum) AActor *mo = P_SpawnPlayer(spot, playernum); if (mo != NULL) P_PlayerStartStomp(mo); + //VIZDOOM_CODE + //VIZ_DebugMsg(0, VIZ_FUNC, "player %d, spectator: %d", playernum, players[playernum].userinfo.GetSpectator()); + if(players[playernum].userinfo.GetSpectator() && players[playernum].mo != NULL) { + //players[playernum].mo->UnlinkFromWorld (); + players[playernum].mo->flags = MF_NOCLIP|MF_NOGRAVITY|MF_FRIENDLY; + players[playernum].mo->flags2 |= MF2_FLY; + players[playernum].mo->renderflags |= RF_INVISIBLE; + } + // TODO: Causes crash - fix //VIZ_DebugMsg(4, VIZ_FUNC, "playernum: %d (%s), spot: %d %d %d", gametic, playernum, players[playernum].userinfo.GetName(), spot->x, spot->y, spot->z); } diff --git a/src/vizdoom/src/viz_game.cpp b/src/vizdoom/src/viz_game.cpp index b867b32a8..9c8827275 100644 --- a/src/vizdoom/src/viz_game.cpp +++ b/src/vizdoom/src/viz_game.cpp @@ -251,20 +251,13 @@ void VIZ_GameStateTic(){ vizGameStateSM->PLAYER_COUNT = 0; for (size_t i = 0; i < VIZ_MAX_PLAYERS; ++i) { if(playeringame[i]){ - if(players[i].userinfo.GetSpectator() && players[i].mo != NULL) { - //players[i].mo->UnlinkFromWorld (); - players[i].mo->flags = MF_NOCLIP|MF_NOGRAVITY|MF_FRIENDLY; - players[i].mo->flags2 |= MF2_FLY; - players[i].mo->renderflags |= RF_INVISIBLE; - } - ++vizGameStateSM->PLAYER_COUNT; vizGameStateSM->PLAYER_N_IN_GAME[i] = true; strncpy(vizGameStateSM->PLAYER_N_NAME[i], players[i].userinfo.GetName(), VIZ_MAX_PLAYER_NAME_LEN); vizGameStateSM->PLAYER_N_FRAGCOUNT[i] = players[i].fragcount; } else{ - strncpy(vizGameStateSM->PLAYER_N_NAME[i], players[i].userinfo.GetName(), VIZ_MAX_PLAYER_NAME_LEN); + //strncpy(vizGameStateSM->PLAYER_N_NAME[i], players[i].userinfo.GetName(), VIZ_MAX_PLAYER_NAME_LEN); vizGameStateSM->PLAYER_N_FRAGCOUNT[i] = 0; } } From 675cdd979adf8a3817de70571214a6f5c5535ee4 Mon Sep 17 00:00:00 2001 From: Marqt Date: Fri, 24 Mar 2017 02:45:15 +0100 Subject: [PATCH 5/7] Improvments for game spectators: disabled hud, blocked atacks and hidden on the scoreboard Former-commit-id: 5a69531164d33def76375c77eb4f181c71b0e028 --- src/vizdoom/src/hu_scores.cpp | 7 +++++-- src/vizdoom/src/viz_game.cpp | 2 +- src/vizdoom/src/viz_input.cpp | 8 ++++++-- src/vizdoom/src/viz_main.cpp | 15 +++++++++++++-- src/vizdoom/src/viz_main.h | 2 ++ 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/vizdoom/src/hu_scores.cpp b/src/vizdoom/src/hu_scores.cpp index fe2735ede..f7791709f 100644 --- a/src/vizdoom/src/hu_scores.cpp +++ b/src/vizdoom/src/hu_scores.cpp @@ -268,7 +268,9 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER for (i = 0; i < MAXPLAYERS; ++i) { - if (playeringame[sortedplayers[i]-players] && TeamLibrary.IsValidTeam (sortedplayers[i]->userinfo.GetTeam())) + //VIZDOOM_CODE + if (playeringame[sortedplayers[i]-players] && TeamLibrary.IsValidTeam (sortedplayers[i]->userinfo.GetTeam()) + && !sortedplayers[i]->userinfo.GetSpectator()) { if (Teams[sortedplayers[i]->userinfo.GetTeam()].m_iPlayerCount++ == 0) { @@ -339,7 +341,8 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER for (i = 0; i < MAXPLAYERS && y <= bottom; i++) { - if (playeringame[sortedplayers[i] - players]) + //VIZDOOM_CODE + if (playeringame[sortedplayers[i] - players] && !sortedplayers[i]->userinfo.GetSpectator()) { HU_DrawPlayer(sortedplayers[i], player == sortedplayers[i], x, col2, col3, col4, col5, maxnamewidth, y, ypadding, lineheight); y += lineheight + CleanYfac; diff --git a/src/vizdoom/src/viz_game.cpp b/src/vizdoom/src/viz_game.cpp index 9c8827275..1a474388c 100644 --- a/src/vizdoom/src/viz_game.cpp +++ b/src/vizdoom/src/viz_game.cpp @@ -44,7 +44,7 @@ EXTERN_CVAR (Bool, viz_labels) EXTERN_CVAR (Bool, viz_automap) EXTERN_CVAR (Bool, viz_loop_map) EXTERN_CVAR (Bool, viz_override_player) - +EXTERN_CVAR (Bool, viz_spectator) EXTERN_CVAR (Float, timelimit) VIZGameState *vizGameStateSM = NULL; diff --git a/src/vizdoom/src/viz_input.cpp b/src/vizdoom/src/viz_input.cpp index 4b2d1ef27..8f2d83dac 100644 --- a/src/vizdoom/src/viz_input.cpp +++ b/src/vizdoom/src/viz_input.cpp @@ -40,6 +40,9 @@ unsigned int vizLastInputUpdate[VIZ_BT_COUNT]; EXTERN_CVAR (Bool, viz_debug) EXTERN_CVAR (Bool, viz_allow_input) +EXTERN_CVAR (Bool, viz_nocheat) +EXTERN_CVAR (Bool, viz_cmd_filter) +EXTERN_CVAR (Bool, viz_spectator) void VIZ_Command(char * cmd){ AddCommandString(cmd); @@ -49,7 +52,8 @@ bool VIZ_CommmandFilter(const char *cmd){ VIZ_DebugMsg(3, VIZ_FUNC, "allow_input: %d, cmd: %s", *viz_allow_input, cmd); - if(!vizInputInited || !*viz_allow_input) return true; + if(*viz_spectator && (strcmp(cmd, "+attack") == 0 || strcmp(cmd, "+altattack") == 0)) return false; + if(!vizInputInited || !*viz_allow_input || (!*viz_cmd_filter && (!*viz_nocheat || *viz_spectator))) return true; bool action = false; int state = 1; @@ -89,7 +93,7 @@ bool VIZ_CommmandFilter(const char *cmd){ return false; } - for(int i = 0; i Date: Fri, 24 Mar 2017 02:53:36 +0100 Subject: [PATCH 6/7] Arguments associated with CIG 2017 rules added Former-commit-id: 9d18b145910c76144743186df5d77dd4db7140bb --- examples/c++/CIGBots.cpp | 3 ++- examples/c++/CIGHost.cpp | 2 ++ examples/c++/README.md | 4 ++-- examples/java/CIG.java | 4 ++-- examples/java/CIGBots.java | 9 ++++++--- examples/java/CIGHost.java | 20 +++++++++++--------- examples/java/README.md | 4 ++-- examples/lua/cig.lua | 2 +- examples/lua/cig_bots.lua | 8 ++++---- examples/lua/cig_host.lua | 7 ++++++- examples/python/README.md | 4 ++-- examples/python/cig.py | 6 ++++-- examples/python/cig_bots.py | 3 ++- examples/python/cig_host.py | 8 +++++++- 14 files changed, 53 insertions(+), 31 deletions(-) diff --git a/examples/c++/CIGBots.cpp b/examples/c++/CIGBots.cpp index 86969ac6c..635dc4d3b 100644 --- a/examples/c++/CIGBots.cpp +++ b/examples/c++/CIGBots.cpp @@ -23,7 +23,8 @@ int main(){ // Start multiplayer game only with Your AI (with options that will be used in the competition, details in CIGHost example). game->addGameArgs("-host 1 -deathmatch +timelimit 1.0 " - "+sv_forcerespawn 1 +sv_noautoaim 1 +sv_respawnprotect 1 +sv_spawnfarthest 1"); + "+sv_forcerespawn 1 +sv_noautoaim 1 +sv_respawnprotect 1 +sv_spawnfarthest 1 +sv_nocrouch 1 " + "+viz_respawn_delay 10 +viz_nocheat 1"); // Name your agent and select color // colors: 0 - green, 1 - gray, 2 - brown, 3 - red, 4 - light gray, 5 - light brown, 6 - light red, 7 - light blue diff --git a/examples/c++/CIGHost.cpp b/examples/c++/CIGHost.cpp index 19cdc3655..b0b2a707d 100644 --- a/examples/c++/CIGHost.cpp +++ b/examples/c++/CIGHost.cpp @@ -29,6 +29,8 @@ int main(){ "+sv_noautoaim 1 " // Autoaim is disabled for all players. "+sv_respawnprotect 1 " // Players will be invulnerable for two second after spawning. "+sv_spawnfarthest 1 " // Players will be spawned as far as possible from any other players. + "+sv_nocrouch 1 " // Disables crouching. + "+viz_respawn_delay 10 " // Sets delay between respanws (in seconds). "+viz_nocheat 1"); // Disables depth and labels buffer and the ability to use commands that could interfere with multiplayer game. // Name your agent and select color diff --git a/examples/c++/README.md b/examples/c++/README.md index cdea0ce05..ff3c5bbbe 100644 --- a/examples/c++/README.md +++ b/examples/c++/README.md @@ -14,10 +14,10 @@ To run the examples, [freedoom2.wad]( https://freedoom.github.io/download.html) Demonstrates how to use the most basic features of the environment. It configures the engine, and makes the agent perform random actions. It also prints the current state and the reward earned with every action. ###[CIG.cpp](https://github.com/Marqt/ViZDoom/blob/master/examples/c++/CIG.cpp), [CIGHost.cpp](https://github.com/Marqt/ViZDoom/blob/master/examples/c++/CIGHost.cpp) -Demonstrates how to configure and play multiplayer game for CIG 2016 competition. +Demonstrates how to configure and play multiplayer game for CIG competition. ###[CIGBots.cpp](https://github.com/Marqt/ViZDoom/blob/master/examples/c++/CIGBots.cpp) -Demonstrates how to play with bots to simulate multiplayer game. Helpful for developing AI agent for CIG 2016 competition. +Demonstrates how to play with bots to simulate multiplayer game. Helpful for developing AI agent for CIG competition. ###[DeltaButtons.cpp](https://github.com/Marqt/ViZDoom/blob/master/examples/c++/DeltaButtons.cpp) Shows how delta buttons work (they may take values other than 0 and 1 and can be used for precise movement). diff --git a/examples/java/CIG.java b/examples/java/CIG.java index 849e3bb47..ce0855b2b 100644 --- a/examples/java/CIG.java +++ b/examples/java/CIG.java @@ -7,11 +7,11 @@ public class CIG { public static void main (String[] args) { - DoomGame game = new DoomGame(); - System.out.println("\n\nCIG EXAMPLE\n"); + DoomGame game = new DoomGame(); + // Use CIG example config or Your own. game.loadConfig("../../scenarios/cig.cfg"); diff --git a/examples/java/CIGBots.java b/examples/java/CIGBots.java index 767c7ba1b..90830f7b0 100644 --- a/examples/java/CIGBots.java +++ b/examples/java/CIGBots.java @@ -7,10 +7,11 @@ public class CIGBots { public static void main (String[] args) { - DoomGame game = new DoomGame(); - System.out.println("\n\nCIG BOTS EXAMPLE\n"); + + DoomGame game = new DoomGame(); + // Use CIG example config or Your own. game.loadConfig("../../scenarios/cig.cfg"); @@ -22,7 +23,9 @@ public static void main (String[] args) { //game.setDoomMap("map02"); // Full deathmatch. // Start multiplayer game only with Your AI (with options that will be used in the competition, details in CIGHost example). - game.addGameArgs("-host 1 -deathmatch +timelimit 1.0 +sv_forcerespawn 1 +sv_noautoaim 1 +sv_respawnprotect 1 +sv_spawnfarthest 1"); + game.addGameArgs("-host 1 -deathmatch +timelimit 1.0 " + + "+sv_forcerespawn 1 +sv_noautoaim 1 +sv_respawnprotect 1 +sv_spawnfarthest 1 +sv_nocrouch 1 " + + "+viz_respawn_delay 10 +viz_nocheat 1"); // Name your agent and select color // colors: 0 - green, 1 - gray, 2 - brown, 3 - red, 4 - light gray, 5 - light brown, 6 - light red, 7 - light blue diff --git a/examples/java/CIGHost.java b/examples/java/CIGHost.java index 749e54d32..877267d07 100644 --- a/examples/java/CIGHost.java +++ b/examples/java/CIGHost.java @@ -7,11 +7,11 @@ public class CIGHost { public static void main (String[] args) { - DoomGame game = new DoomGame(); - System.out.println("\n\nCIG HOST EXAMPLE\n"); + DoomGame game = new DoomGame(); + // Use CIG example config or Your own. game.loadConfig("../../scenarios/cig.cfg"); @@ -24,13 +24,15 @@ public static void main (String[] args) { // Host game with options that will be used in the competition. game.addGameArgs("-host 8 " // This machine will function as a host for a multiplayer game with this many players (including this machine). It will wait for other machines to connect using the -join parameter and then start the game when everyone is connected. - +"-deathmatch " // Deathmatch rules are used for the game. - +"+timelimit 10.0 " // The game (episode) will end after this many minutes have elapsed. - +"+sv_forcerespawn 1 " // Players will respawn automatically after they die. - +"+sv_noautoaim 1 " // Autoaim is disabled for all players. - +"+sv_respawnprotect 1 " // Players will be invulnerable for two second after spawning. - +"+sv_spawnfarthest 1 " // Players will be spawned as far as possible from any other players. - +"+viz_nocheat 1"); // Disables depth and labels buffer and the ability to use commands that could interfere with multiplayer game. + + "-deathmatch " // Deathmatch rules are used for the game. + + "+timelimit 10.0 " // The game (episode) will end after this many minutes have elapsed. + + "+sv_forcerespawn 1 " // Players will respawn automatically after they die. + + "+sv_noautoaim 1 " // Autoaim is disabled for all players. + + "+sv_respawnprotect 1 " // Players will be invulnerable for two second after spawning. + + "+sv_spawnfarthest 1 " // Players will be spawned as far as possible from any other players. + + "+sv_nocrouch 1 " // Disables crouching. + + "+viz_respawn_delay 10 " // Sets delay between respanws (in seconds). + + "+viz_nocheat 1"); // Disables depth and labels buffer and the ability to use commands that could interfere with multiplayer game. // Name your agent and select color // colors: 0 - green, 1 - gray, 2 - brown, 3 - red, 4 - light gray, 5 - light brown, 6 - light red, 7 - light blue diff --git a/examples/java/README.md b/examples/java/README.md index 6e987fa9b..0a67039a0 100644 --- a/examples/java/README.md +++ b/examples/java/README.md @@ -20,10 +20,10 @@ To run the examples, [freedoom2.wad]( https://freedoom.github.io/download.html) Demonstrates how to use the most basic features of the environment. It configures the engine, and makes the agent perform random actions. It also prints the current state and the reward earned with every action. ###[CIG.java](https://github.com/Marqt/ViZDoom/blob/master/examples/java/CIG.java), [CIGHost.java](https://github.com/Marqt/ViZDoom/blob/master/examples/java/CIGHost.java) -Demonstrates how to configure and play multiplayer game for CIG 2016 competition. +Demonstrates how to configure and play multiplayer game for CIG competition. ###[CIGBots.java](https://github.com/Marqt/ViZDoom/blob/master/examples/java/CIGBots.java) -Demonstrates how to play with bots to simulate multiplayer game. Helpful for developing AI agent for CIG 2016 competition. +Demonstrates how to play with bots to simulate multiplayer game. Helpful for developing AI agent for CIG competition. ###[DeltaButtons.java](https://github.com/Marqt/ViZDoom/blob/master/examples/java/DeltaButtons.java) Shows how delta buttons work (they may take values other than 0 and 1 and can be used for precise movement). diff --git a/examples/lua/cig.lua b/examples/lua/cig.lua index 1da665783..01fdd8b45 100755 --- a/examples/lua/cig.lua +++ b/examples/lua/cig.lua @@ -59,7 +59,7 @@ while not game:isEpisodeFinished() do game:respawnPlayer() end - print("Frags:", game:getGameVariable(vizdoom.GameVariable.FRAGCOUNT)) + --print("Frags:", game:getGameVariable(vizdoom.GameVariable.FRAGCOUNT)) end game:close() diff --git a/examples/lua/cig_bots.lua b/examples/lua/cig_bots.lua index b3120d011..b8aea90cf 100755 --- a/examples/lua/cig_bots.lua +++ b/examples/lua/cig_bots.lua @@ -16,14 +16,14 @@ game:setDoomMap("map01") -- Limited deathmatch. -- Start multiplayer game only with your AI (with options that will be used in the competition, details in cig_host example). game:addGameArgs("-host 1 -deathmatch +timelimit 1 " .. - "+sv_forcerespawn 1 +sv_noautoaim 1 " .. - "+sv_respawnprotect 1 +sv_spawnfarthest 1") + "+sv_forcerespawn 1 +sv_noautoaim 1 +sv_respawnprotect 1 +sv_spawnfarthest 1 +sv_nocrouch 1 " .. + "+viz_respawn_delay 10 +viz_nocheat 1") -- Name your agent and select color -- colors: 0 - green, 1 - gray, 2 - brown, 3 - red, 4 - light gray, 5 - light brown, 6 - light red, 7 - light blue game:addGameArgs("+name AI +colorset 0") -game:setMode(vizdoom.Mode.PLAYER) +game:setMode(vizdoom.Mode.SPECTATOR) --game:setWindowVisible(false) game:init(); @@ -71,7 +71,7 @@ for i = 1, episodes do game:respawnPlayer() end - print("Frags:", game:getGameVariable(vizdoom.GameVariable.FRAGCOUNT)) + --print("Frags:", game:getGameVariable(vizdoom.GameVariable.FRAGCOUNT)) end print("Episode finished.") diff --git a/examples/lua/cig_host.lua b/examples/lua/cig_host.lua index 9e1bfb2d6..3d3883ccd 100755 --- a/examples/lua/cig_host.lua +++ b/examples/lua/cig_host.lua @@ -21,8 +21,13 @@ game:addGameArgs("-host 2 " .. -- This machine will function as a h "+sv_noautoaim 1 " .. -- Autoaim is disabled for all players. "+sv_respawnprotect 1 " .. -- Players will be invulnerable for two second after spawning. "+sv_spawnfarthest 1 " .. -- Players will be spawned as far as possible from any other players. + "+sv_nocrouch 1" .. -- Disables crouching. + "+viz_respawn_delay 10 " ..-- Sets delay between respanws (in seconds). "+viz_nocheat 1") -- Disables depth and labels buffer and the ability to use commands that could interfere with multiplayer game. +-- This can be used to host game without taking part in it (can be simply added as argument of vizdoom executable). +--game:add_game_args("viz_spectator 1") + -- Name your agent and select color -- colors: 0 - green, 1 - gray, 2 - brown, 3 - red, 4 - light gray, 5 - light brown, 6 - light red, 7 - light blue game:addGameArgs("+name AI +colorset 0") @@ -58,7 +63,7 @@ while not game:isEpisodeFinished() do game:respawnPlayer() end - print("Frags:", game:getGameVariable(vizdoom.GameVariable.FRAGCOUNT)) + --print("Frags:", game:getGameVariable(vizdoom.GameVariable.FRAGCOUNT)) end game:close() diff --git a/examples/python/README.md b/examples/python/README.md index ec1f6d791..e81f5c0ef 100644 --- a/examples/python/README.md +++ b/examples/python/README.md @@ -14,10 +14,10 @@ Demonstrates how to use the most basic features of the environment. It configure ###[buffers.py](https://github.com/Marqt/ViZDoom/blob/master/examples/python/buffers.py) ###[cig.py](https://github.com/Marqt/ViZDoom/blob/master/examples/python/cig.py), [cig_host.py](https://github.com/Marqt/ViZDoom/blob/master/examples/python/cig_host.py) -Demonstrates how to configure and play multiplayer game for CIG 2016 competition. +Demonstrates how to configure and play multiplayer game for CIG competition. ###[cig_bots.py](https://github.com/Marqt/ViZDoom/blob/master/examples/python/cig_bots.py) -Demonstrates how to play with bots to simulate multiplayer game. Helpful for developing AI agent for CIG 2016 competition. +Demonstrates how to play with bots to simulate multiplayer game. Helpful for developing AI agent for CIG competition. ###[delta_buttons.py](https://github.com/Marqt/ViZDoom/blob/master/examples/python/delta_buttons.py) Shows how delta buttons work (they may take values other than 0 and 1 and can be used for precise movement). diff --git a/examples/python/cig.py b/examples/python/cig.py index d4320f0a1..e3c30c21a 100755 --- a/examples/python/cig.py +++ b/examples/python/cig.py @@ -3,6 +3,7 @@ from __future__ import print_function from vizdoom import * from random import choice +import sys game = DoomGame() @@ -17,8 +18,9 @@ # Name your agent and select color # colors: 0 - green, 1 - gray, 2 - brown, 3 - red, 4 - light gray, 5 - light brown, 6 - light red, 7 - light blue -game.add_game_args("+name AI +colorset 0") +game.add_game_args("+name AI +colorset 0 +viz_debug 1") +# During the competition, async mode will be forced for all agents. game.set_mode(Mode.ASYNC_PLAYER) #game.set_window_visible(false) @@ -42,6 +44,6 @@ # Use this to respawn immediately after death, new state will be available. game.respawn_player() - print("Frags:", game.get_game_variable(GameVariable.FRAGCOUNT)) + #print("Frags:", game.get_game_variable(GameVariable.FRAGCOUNT)) game.close() diff --git a/examples/python/cig_bots.py b/examples/python/cig_bots.py index e0b79ad0d..bf251137d 100755 --- a/examples/python/cig_bots.py +++ b/examples/python/cig_bots.py @@ -15,7 +15,8 @@ # Start multiplayer game only with your AI (with options that will be used in the competition, details in cig_host example). game.add_game_args("-host 1 -deathmatch +timelimit 1.0 " - "+sv_forcerespawn 1 +sv_noautoaim 1 +sv_respawnprotect 1 +sv_spawnfarthest 1") + "+sv_forcerespawn 1 +sv_noautoaim 1 +sv_respawnprotect 1 +sv_spawnfarthest 1 +sv_nocrouch 1 " + "+viz_respawn_delay 10 +viz_nocheat 1") # Name your agent and select color # colors: 0 - green, 1 - gray, 2 - brown, 3 - red, 4 - light gray, 5 - light brown, 6 - light red, 7 - light blue diff --git a/examples/python/cig_host.py b/examples/python/cig_host.py index b82571d7c..a2b91845e 100755 --- a/examples/python/cig_host.py +++ b/examples/python/cig_host.py @@ -20,12 +20,18 @@ "+sv_noautoaim 1 " # Autoaim is disabled for all players. "+sv_respawnprotect 1 " # Players will be invulnerable for two second after spawning. "+sv_spawnfarthest 1 " # Players will be spawned as far as possible from any other players. + "+sv_nocrouch 1 " # Disables crouching. + "+viz_respawn_delay 10 " # Sets delay between respanws (in seconds). "+viz_nocheat 1") # Disables depth and labels buffer and the ability to use commands that could interfere with multiplayer game. +# This can be used to host game without taking part in it (can be simply added as argument of vizdoom executable). +#game.add_game_args("viz_spectator 1") + # Name your agent and select color # colors: 0 - green, 1 - gray, 2 - brown, 3 - red, 4 - light gray, 5 - light brown, 6 - light red, 7 - light blue game.add_game_args("+name AI +colorset 0") +# During the competition, async mode will be forced for all agents. game.set_mode(Mode.ASYNC_PLAYER) # game.set_window_visible(false) @@ -49,6 +55,6 @@ # Use this to respawn immediately after death, new state will be available. game.respawn_player() - print("Frags:", game.get_game_variable(GameVariable.FRAGCOUNT)) + #print("Frags:", game.get_game_variable(GameVariable.FRAGCOUNT)) game.close() From 2300c2c7311dc14c376437a783ffa8a5ce6f4b89 Mon Sep 17 00:00:00 2001 From: Marqt Date: Fri, 24 Mar 2017 02:58:03 +0100 Subject: [PATCH 7/7] Updated Changelog.md Former-commit-id: ad7971d0a498cc47db15d7cc3c148bbad809f0a4 --- doc/Changelog.md | 11 ++++++++++- examples/python/cig.py | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/doc/Changelog.md b/doc/Changelog.md index 13c0ed708..b3e17f903 100644 --- a/doc/Changelog.md +++ b/doc/Changelog.md @@ -1,9 +1,17 @@ # Changelog +## Changes in 1.1.2 + +#### Multiplayer +- Added `viz_respawn_delay` CVAR, which allows to control delay between respawns in multiplayer game. +- Added `viz_spectator` CVAR which allows to connect to multiplayer game as a spectator. +- Maximum number of connected players raised to 16. + + ## Changes in 1.1.1 #### GameState -- `number` renamed to `id` for clearness. +- Added `tic` field. - `GameVariable.DEATHCOUNT` fixed. #### Lua specific @@ -62,6 +70,7 @@ recording `filePath` argument added to `newEpisode`, `replayEpisode` added. - Bugs associated with paths handling fixed. - Many minor bugs fixed. - Possibility to change scenario wad during runtime (only first map from WAD file). +- Added `viz_debug` CVAR to control some diagnostic massages. #### C++ specific diff --git a/examples/python/cig.py b/examples/python/cig.py index e3c30c21a..44f8af1fb 100755 --- a/examples/python/cig.py +++ b/examples/python/cig.py @@ -18,7 +18,7 @@ # Name your agent and select color # colors: 0 - green, 1 - gray, 2 - brown, 3 - red, 4 - light gray, 5 - light brown, 6 - light red, 7 - light blue -game.add_game_args("+name AI +colorset 0 +viz_debug 1") +game.add_game_args("+name AI +colorset 0") # During the competition, async mode will be forced for all agents. game.set_mode(Mode.ASYNC_PLAYER)