Skip to content

Commit 31fe629

Browse files
DeepMind Lab Teamtkoeppe
authored andcommitted
Update
1 parent b48ce63 commit 31fe629

File tree

769 files changed

+47850
-8207
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

769 files changed

+47850
-8207
lines changed

BUILD

Lines changed: 209 additions & 284 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# <img src="docs/logo.png" alt="DeepMind Lab">
1+
# <img src="/docs/template/logo.png" alt="DeepMind Lab">
22

33
*DeepMind Lab* is a 3D learning environment based on id Software's
44
[Quake III Arena](https://github.com/id-Software/Quake-III-Arena) via
@@ -43,7 +43,7 @@ You can reach us at [[email protected]](mailto:[email protected]).
4343

4444
## Getting started on Linux
4545

46-
* Get [Bazel from bazel.io](http://bazel.io/docs/install.html).
46+
* Get [Bazel from bazel.io](https://docs.bazel.build/versions/master/install.html).
4747

4848
* Clone DeepMind Lab, e.g. by running
4949

@@ -52,24 +52,21 @@ $ git clone https://github.com/deepmind/lab
5252
$ cd lab
5353
```
5454

55-
* For a live example of a random agent, run
56-
57-
```shell
58-
lab$ bazel run :random_agent --define headless=false -- \
59-
--length=10000 --width=640 --height=480
60-
```
61-
62-
Here is some [more detailed build documentation](docs/build.md),
55+
Here is some [more detailed build documentation](/docs/users/build.md),
6356
including how to install dependencies if you don't have them.
6457

6558
### Play as a human
6659

6760
To test the game using human input controls, run
6861

6962
```shell
70-
lab$ bazel run :game -- --level_script tests/demo_map
63+
lab$ bazel run :game -- --level_script=test_levels/empty_room_test --level_setting=logToStdErr=true
64+
# or:
65+
lab$ bazel run :game -- -l test_levels/empty_room_test -s logToStdErr=true
7166
```
7267

68+
Leave the `logToStdErr` setting off to disable most log output.
69+
7370
### Train an agent
7471

7572
*DeepMind Lab* ships with an example random agent in
@@ -78,15 +75,15 @@ which can be used as a starting point for implementing a learning agent. To let
7875
this agent interact with DeepMind Lab for training, run
7976

8077
```shell
81-
lab$ bazel run :random_agent
78+
lab$ bazel run :python_random_agent
8279
```
8380

84-
The Python API for the agent-environment interaction is described
85-
in [docs/python_api.md](docs/python_api.md).
81+
The [Python API](/docs/users/python_api.md)
82+
is used for agent-environment interactions.
8683

8784
*DeepMind Lab* ships with different levels implementing different tasks. These
88-
tasks can be configured using Lua scripts,
89-
as described in [docs/lua_api.md](docs/lua_api.md).
85+
tasks can be configured using Lua scripts, as described in the
86+
[Lua API](/docs/developers/reference/lua_api.md).
9087

9188
-----------------
9289

@@ -104,14 +101,14 @@ with those projects are best fixed upstream and then merged into *DeepMind Lab*.
104101

105102
* *q3map2* is taken from
106103
[github.com/TTimo/GtkRadiant](https://github.com/TTimo/GtkRadiant),
107-
revision 8557f1820f8e0c7cef9d52a78b2847fa401a4a95. A few minor local
104+
revision 69972f94582f0723c9ceaabf6751a911bf1fdcc3. A few minor local
108105
modifications add synchronization and use C99 constructs to replace
109106
formerly non-portable or undefined behaviour. We also expect this code to be
110107
stable.
111108

112109
* *ioquake3* is taken from
113110
[github.com/ioquake/ioq3](https://github.com/ioquake/ioq3),
114-
revision 0672905ef1b8f6ca219341e7252044dd727753dd. The code contains extensive
111+
revision 690c5a4dac3c3d0d59ee271aadd8f19a29a9f338. The code contains extensive
115112
modifications and additions. We aim to merge upstream changes occasionally.
116113

117114
We are very grateful to the maintainers of these repositories for all their hard

RELEASE_NOTES.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# DeepMind Lab Release Notes
2+
3+
## Current Release
4+
5+
### New Features:
6+
7+
1. Lua customizable themes.
8+
2. String observations.
9+
3. Add ability for script to generate events visible to the EnvCApi.
10+
4. Updated EnvCApi to propagate error messages.
11+
5. Added customization point to enable reading files from external sources.
12+
13+
### Minor Improvements:
14+
15+
1. Fixed ramp jump velocity in level lt_space_bounce_hard.
16+
2. Fixed Lua function 'addScore' from module 'dmlab.system.game' to allow
17+
negative scores added to a player.
18+
3. Minor removal of undefined behaviour in the engine.
19+
4. Change LuaSnippetEmitter methods to use table call conventions.
20+
5. Added config variable for monochromatic lightmaps ('r_monolightmaps').
21+
Enabled by default.
22+
6. Python module 'observation_spec' now returns current observation spec.
23+
7. Added config variable to limit texture size ('r_textureMaxSize').
24+
8. Increased score range to include all 32 bit integers.
25+
9. api:modifyTexture must now return whether the texture was modified.
26+
10. Internal engine events are propagated to the script via gameEvent.
27+
11. Added ability to adjust rewards.
28+
12. Added ability to raycast between different points on the map.
29+
13. Reduced inaccuracies related to angle conversion and normalization.
30+
14. Added flag "sv_rateLimit" to disable rate limiting for networked games.
31+
32+
## release-2016-12-06 Initial release

WORKSPACE

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
workspace(name = "org_deepmind_lab")
22

3-
new_git_repository(
4-
name = "googletest",
5-
build_file = "googletest.BUILD",
6-
commit = "d8fe70f477d8a99745b69f7650f75eacf96866f9",
7-
remote = "https://github.com/google/googletest.git",
3+
http_archive(
4+
name = "com_google_googletest",
5+
strip_prefix = "googletest-master",
6+
urls = ["https://github.com/google/googletest/archive/master.zip"],
7+
)
8+
9+
http_archive(
10+
name = "com_google_absl",
11+
strip_prefix = "abseil-cpp-master",
12+
urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"],
813
)
914

1015
new_http_archive(
@@ -18,8 +23,8 @@ new_http_archive(
1823
new_http_archive(
1924
name = "glib_archive",
2025
build_file = "glib.BUILD",
21-
strip_prefix = "glib-2.38.2",
2226
sha256 = "056a9854c0966a0945e16146b3345b7a82562a5ba4d5516fd10398732aea5734",
27+
strip_prefix = "glib-2.38.2",
2328
url = "http://ftp.gnome.org/pub/gnome/sources/glib/2.38/glib-2.38.2.tar.xz",
2429
)
2530

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
local colors = require 'common.colors'
2+
local game = require 'dmlab.system.game'
3+
local image = require 'dmlab.system.image'
4+
5+
local SINGLE_BOT_SKIN_TEXTURE = 'models/players/crash_color/skin_base.tga'
6+
local SATURATION = 1.0
7+
local VALUE = 1.0
8+
9+
local color_bots = {}
10+
11+
color_bots.BOT_NAMES = {
12+
'Cygni',
13+
'Leonis',
14+
'Epsilon',
15+
'Cephei',
16+
'Centauri',
17+
'Draconis',
18+
}
19+
20+
color_bots.BOT_NAMES_COLOR = {
21+
'CygniColor',
22+
'LeonisColor',
23+
'EpsilonColor',
24+
'CepheiColor',
25+
'CentauriColor',
26+
'DraconisColor',
27+
}
28+
29+
local characterSkinData = nil
30+
31+
local function characterSkins()
32+
if not characterSkinData then
33+
local playerDir = game:runFiles() .. '/baselab/game_scripts/player/'
34+
characterSkinData = {
35+
image.load(playerDir .. 'dm_character_skin_mask_a.png'),
36+
image.load(playerDir .. 'dm_character_skin_mask_b.png'),
37+
image.load(playerDir .. 'dm_character_skin_mask_c.png'),
38+
}
39+
end
40+
return characterSkinData
41+
end
42+
43+
--[[ Returns a list of bots compatible with the addBot API.
44+
45+
Keyword arguments:
46+
47+
* count - Number [0, #color_bots.BOT_NAMES] - Number of bots to create.
48+
* color - Boolean (false) - Whether to create the bots with custom colors.
49+
* skill - Number - Skill level of bot. In range [1, 5]
50+
]]
51+
function color_bots:makeBots(kwargs)
52+
assert(kwargs.count, 'Missing count')
53+
local bots = {}
54+
local botNames = kwargs.color and self.BOT_NAMES_COLOR or self.BOT_NAMES
55+
for i, name in ipairs(botNames) do
56+
if i == kwargs.count + 1 then
57+
break
58+
end
59+
bots[#bots + 1] = {name = name, skill = kwargs.skill or 4.0}
60+
end
61+
return bots
62+
end
63+
64+
local playerSkin = nil
65+
66+
-- Required to inform bot api of the skin texture used by the bots. Call
67+
-- from modifyTexture API if color bots are desirded.
68+
function color_bots:findSkin(name, texture)
69+
if name == SINGLE_BOT_SKIN_TEXTURE then
70+
playerSkin = texture:clone()
71+
end
72+
end
73+
74+
-- Required to set the color of the bots. Call from call mapLoaded API.
75+
function color_bots:colorizeBots(hue)
76+
assert(playerSkin, 'findSkin must be called during modifyTexture.')
77+
local skin = playerSkin:clone()
78+
local skins = characterSkins()
79+
local hueAngle = 360 / #skins
80+
local shape = skin:shape()
81+
for i, charachterSkin in ipairs(skins) do
82+
local r, g, b = colors.hsvToRgb(hue, SATURATION, VALUE)
83+
local skinC = charachterSkin:clone()
84+
skinC:select(3, 1):mul(r / 255.0)
85+
skinC:select(3, 2):mul(g / 255.0)
86+
skinC:select(3, 3):mul(b / 255.0)
87+
skin:cadd(skinC)
88+
hue = (hue + hueAngle) % 360
89+
end
90+
game:updateTexture(SINGLE_BOT_SKIN_TEXTURE, skin)
91+
collectgarbage()
92+
collectgarbage()
93+
end
94+
95+
return color_bots

assets/game_scripts/common/colors.lua

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
-- Utilities for color conversion.
2+
3+
local colors = {}
4+
5+
--[[ Converts an HSV color value to RGB.
6+
7+
Conversion formula adapted from
8+
http://en.wikipedia.org/wiki/HSV_color_space. Assumes h in [0, 360), s and v are
9+
contained in the set [0, 1].
10+
11+
Returns r, g, b each in the set [0, 255].
12+
]]
13+
function colors.hsvToRgb(h, s, v)
14+
local i = math.floor(h / 60)
15+
local f = h / 60 - i
16+
local p = v * (1 - s)
17+
local q = v * (1 - f * s)
18+
local t = v * (1 - (1 - f) * s)
19+
20+
i = i % 6
21+
local r, g, b
22+
if i == 0 then r, g, b = v, t, p
23+
elseif i == 1 then r, g, b = q, v, p
24+
elseif i == 2 then r, g, b = p, v, t
25+
elseif i == 3 then r, g, b = p, q, v
26+
elseif i == 4 then r, g, b = t, p, v
27+
elseif i == 5 then r, g, b = v, p, q
28+
end
29+
30+
return r * 255, g * 255, b * 255
31+
end
32+
33+
34+
--[[ Converts an HSL color value to RGB.
35+
36+
Based on formula at https://en.wikipedia.org/wiki/HSL_and_HSV#From_HSL.
37+
Assumes h ∈ [0°, 360°), s ∈ [0, 1] and v ∈ [0, 1].
38+
39+
Returns r, g, b each in the set [0, 255].
40+
]]
41+
function colors.hslToRgb(h, s, l)
42+
local c = (1 - math.abs(2 * l - 1)) * s
43+
local hprime = h / 60
44+
local x = c * (1 - math.abs(hprime % 2 - 1))
45+
46+
local m = l - 0.5 * c
47+
c = c + m
48+
x = x + m
49+
local r, g, b
50+
if hprime <= 1 then r, g, b = c, x, m
51+
elseif hprime <= 2 then r, g, b = x, c, m
52+
elseif hprime <= 3 then r, g, b = m, c, x
53+
elseif hprime <= 4 then r, g, b = m, x, c
54+
elseif hprime <= 5 then r, g, b = x, m, c
55+
elseif hprime < 6 then r, g, b = c, m, x
56+
end
57+
58+
return r * 255, g * 255, b * 255
59+
end
60+
61+
return colors

0 commit comments

Comments
 (0)