-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
769 changed files
with
47,850 additions
and
8,207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# <img src="docs/logo.png" alt="DeepMind Lab"> | ||
# <img src="/docs/template/logo.png" alt="DeepMind Lab"> | ||
|
||
*DeepMind Lab* is a 3D learning environment based on id Software's | ||
[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]). | |
|
||
## Getting started on Linux | ||
|
||
* Get [Bazel from bazel.io](http://bazel.io/docs/install.html). | ||
* Get [Bazel from bazel.io](https://docs.bazel.build/versions/master/install.html). | ||
|
||
* Clone DeepMind Lab, e.g. by running | ||
|
||
|
@@ -52,24 +52,21 @@ $ git clone https://github.com/deepmind/lab | |
$ cd lab | ||
``` | ||
|
||
* For a live example of a random agent, run | ||
|
||
```shell | ||
lab$ bazel run :random_agent --define headless=false -- \ | ||
--length=10000 --width=640 --height=480 | ||
``` | ||
|
||
Here is some [more detailed build documentation](docs/build.md), | ||
Here is some [more detailed build documentation](/docs/users/build.md), | ||
including how to install dependencies if you don't have them. | ||
|
||
### Play as a human | ||
|
||
To test the game using human input controls, run | ||
|
||
```shell | ||
lab$ bazel run :game -- --level_script tests/demo_map | ||
lab$ bazel run :game -- --level_script=test_levels/empty_room_test --level_setting=logToStdErr=true | ||
# or: | ||
lab$ bazel run :game -- -l test_levels/empty_room_test -s logToStdErr=true | ||
``` | ||
|
||
Leave the `logToStdErr` setting off to disable most log output. | ||
|
||
### Train an agent | ||
|
||
*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 | |
this agent interact with DeepMind Lab for training, run | ||
|
||
```shell | ||
lab$ bazel run :random_agent | ||
lab$ bazel run :python_random_agent | ||
``` | ||
|
||
The Python API for the agent-environment interaction is described | ||
in [docs/python_api.md](docs/python_api.md). | ||
The [Python API](/docs/users/python_api.md) | ||
is used for agent-environment interactions. | ||
|
||
*DeepMind Lab* ships with different levels implementing different tasks. These | ||
tasks can be configured using Lua scripts, | ||
as described in [docs/lua_api.md](docs/lua_api.md). | ||
tasks can be configured using Lua scripts, as described in the | ||
[Lua API](/docs/developers/reference/lua_api.md). | ||
|
||
----------------- | ||
|
||
|
@@ -104,14 +101,14 @@ with those projects are best fixed upstream and then merged into *DeepMind Lab*. | |
|
||
* *q3map2* is taken from | ||
[github.com/TTimo/GtkRadiant](https://github.com/TTimo/GtkRadiant), | ||
revision 8557f1820f8e0c7cef9d52a78b2847fa401a4a95. A few minor local | ||
revision 69972f94582f0723c9ceaabf6751a911bf1fdcc3. A few minor local | ||
modifications add synchronization and use C99 constructs to replace | ||
formerly non-portable or undefined behaviour. We also expect this code to be | ||
stable. | ||
|
||
* *ioquake3* is taken from | ||
[github.com/ioquake/ioq3](https://github.com/ioquake/ioq3), | ||
revision 0672905ef1b8f6ca219341e7252044dd727753dd. The code contains extensive | ||
revision 690c5a4dac3c3d0d59ee271aadd8f19a29a9f338. The code contains extensive | ||
modifications and additions. We aim to merge upstream changes occasionally. | ||
|
||
We are very grateful to the maintainers of these repositories for all their hard | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# DeepMind Lab Release Notes | ||
|
||
## Current Release | ||
|
||
### New Features: | ||
|
||
1. Lua customizable themes. | ||
2. String observations. | ||
3. Add ability for script to generate events visible to the EnvCApi. | ||
4. Updated EnvCApi to propagate error messages. | ||
5. Added customization point to enable reading files from external sources. | ||
|
||
### Minor Improvements: | ||
|
||
1. Fixed ramp jump velocity in level lt_space_bounce_hard. | ||
2. Fixed Lua function 'addScore' from module 'dmlab.system.game' to allow | ||
negative scores added to a player. | ||
3. Minor removal of undefined behaviour in the engine. | ||
4. Change LuaSnippetEmitter methods to use table call conventions. | ||
5. Added config variable for monochromatic lightmaps ('r_monolightmaps'). | ||
Enabled by default. | ||
6. Python module 'observation_spec' now returns current observation spec. | ||
7. Added config variable to limit texture size ('r_textureMaxSize'). | ||
8. Increased score range to include all 32 bit integers. | ||
9. api:modifyTexture must now return whether the texture was modified. | ||
10. Internal engine events are propagated to the script via gameEvent. | ||
11. Added ability to adjust rewards. | ||
12. Added ability to raycast between different points on the map. | ||
13. Reduced inaccuracies related to angle conversion and normalization. | ||
14. Added flag "sv_rateLimit" to disable rate limiting for networked games. | ||
|
||
## release-2016-12-06 Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
local colors = require 'common.colors' | ||
local game = require 'dmlab.system.game' | ||
local image = require 'dmlab.system.image' | ||
|
||
local SINGLE_BOT_SKIN_TEXTURE = 'models/players/crash_color/skin_base.tga' | ||
local SATURATION = 1.0 | ||
local VALUE = 1.0 | ||
|
||
local color_bots = {} | ||
|
||
color_bots.BOT_NAMES = { | ||
'Cygni', | ||
'Leonis', | ||
'Epsilon', | ||
'Cephei', | ||
'Centauri', | ||
'Draconis', | ||
} | ||
|
||
color_bots.BOT_NAMES_COLOR = { | ||
'CygniColor', | ||
'LeonisColor', | ||
'EpsilonColor', | ||
'CepheiColor', | ||
'CentauriColor', | ||
'DraconisColor', | ||
} | ||
|
||
local characterSkinData = nil | ||
|
||
local function characterSkins() | ||
if not characterSkinData then | ||
local playerDir = game:runFiles() .. '/baselab/game_scripts/player/' | ||
characterSkinData = { | ||
image.load(playerDir .. 'dm_character_skin_mask_a.png'), | ||
image.load(playerDir .. 'dm_character_skin_mask_b.png'), | ||
image.load(playerDir .. 'dm_character_skin_mask_c.png'), | ||
} | ||
end | ||
return characterSkinData | ||
end | ||
|
||
--[[ Returns a list of bots compatible with the addBot API. | ||
Keyword arguments: | ||
* count - Number [0, #color_bots.BOT_NAMES] - Number of bots to create. | ||
* color - Boolean (false) - Whether to create the bots with custom colors. | ||
* skill - Number - Skill level of bot. In range [1, 5] | ||
]] | ||
function color_bots:makeBots(kwargs) | ||
assert(kwargs.count, 'Missing count') | ||
local bots = {} | ||
local botNames = kwargs.color and self.BOT_NAMES_COLOR or self.BOT_NAMES | ||
for i, name in ipairs(botNames) do | ||
if i == kwargs.count + 1 then | ||
break | ||
end | ||
bots[#bots + 1] = {name = name, skill = kwargs.skill or 4.0} | ||
end | ||
return bots | ||
end | ||
|
||
local playerSkin = nil | ||
|
||
-- Required to inform bot api of the skin texture used by the bots. Call | ||
-- from modifyTexture API if color bots are desirded. | ||
function color_bots:findSkin(name, texture) | ||
if name == SINGLE_BOT_SKIN_TEXTURE then | ||
playerSkin = texture:clone() | ||
end | ||
end | ||
|
||
-- Required to set the color of the bots. Call from call mapLoaded API. | ||
function color_bots:colorizeBots(hue) | ||
assert(playerSkin, 'findSkin must be called during modifyTexture.') | ||
local skin = playerSkin:clone() | ||
local skins = characterSkins() | ||
local hueAngle = 360 / #skins | ||
local shape = skin:shape() | ||
for i, charachterSkin in ipairs(skins) do | ||
local r, g, b = colors.hsvToRgb(hue, SATURATION, VALUE) | ||
local skinC = charachterSkin:clone() | ||
skinC:select(3, 1):mul(r / 255.0) | ||
skinC:select(3, 2):mul(g / 255.0) | ||
skinC:select(3, 3):mul(b / 255.0) | ||
skin:cadd(skinC) | ||
hue = (hue + hueAngle) % 360 | ||
end | ||
game:updateTexture(SINGLE_BOT_SKIN_TEXTURE, skin) | ||
collectgarbage() | ||
collectgarbage() | ||
end | ||
|
||
return color_bots |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
-- Utilities for color conversion. | ||
|
||
local colors = {} | ||
|
||
--[[ Converts an HSV color value to RGB. | ||
Conversion formula adapted from | ||
http://en.wikipedia.org/wiki/HSV_color_space. Assumes h in [0, 360), s and v are | ||
contained in the set [0, 1]. | ||
Returns r, g, b each in the set [0, 255]. | ||
]] | ||
function colors.hsvToRgb(h, s, v) | ||
local i = math.floor(h / 60) | ||
local f = h / 60 - i | ||
local p = v * (1 - s) | ||
local q = v * (1 - f * s) | ||
local t = v * (1 - (1 - f) * s) | ||
|
||
i = i % 6 | ||
local r, g, b | ||
if i == 0 then r, g, b = v, t, p | ||
elseif i == 1 then r, g, b = q, v, p | ||
elseif i == 2 then r, g, b = p, v, t | ||
elseif i == 3 then r, g, b = p, q, v | ||
elseif i == 4 then r, g, b = t, p, v | ||
elseif i == 5 then r, g, b = v, p, q | ||
end | ||
|
||
return r * 255, g * 255, b * 255 | ||
end | ||
|
||
|
||
--[[ Converts an HSL color value to RGB. | ||
Based on formula at https://en.wikipedia.org/wiki/HSL_and_HSV#From_HSL. | ||
Assumes h ∈ [0°, 360°), s ∈ [0, 1] and v ∈ [0, 1]. | ||
Returns r, g, b each in the set [0, 255]. | ||
]] | ||
function colors.hslToRgb(h, s, l) | ||
local c = (1 - math.abs(2 * l - 1)) * s | ||
local hprime = h / 60 | ||
local x = c * (1 - math.abs(hprime % 2 - 1)) | ||
|
||
local m = l - 0.5 * c | ||
c = c + m | ||
x = x + m | ||
local r, g, b | ||
if hprime <= 1 then r, g, b = c, x, m | ||
elseif hprime <= 2 then r, g, b = x, c, m | ||
elseif hprime <= 3 then r, g, b = m, c, x | ||
elseif hprime <= 4 then r, g, b = m, x, c | ||
elseif hprime <= 5 then r, g, b = x, m, c | ||
elseif hprime < 6 then r, g, b = c, m, x | ||
end | ||
|
||
return r * 255, g * 255, b * 255 | ||
end | ||
|
||
return colors |
Oops, something went wrong.