GitLab's annual major release is around the corner. Along with a lot of new and exciting features, there will be a few breaking changes. Learn more here.

Commit 105d8dc4 authored by Callum Bugajski's avatar Callum Bugajski
Browse files

Merge branch 'develop' into 'master'

v0.1 release

See merge request !115
parents b5cac03b 3404d133
Pipeline #206867352 passed with stages
in 39 minutes and 49 seconds
......@@ -46,6 +46,7 @@ Traffic3D/fourways/four/[Aa]ssets/Plugins/Editor/JetBrains*
# Traffic3D specific
*.csv
*.csv.meta
# Visual Studio cache directory
.vs/
......
image: gableroux/unity3d:2018.3.11f1
variables:
# Use a shallow clone depth to speed up the CI build.
# See: https://docs.gitlab.com/ee/ci/large_repositories/
BUILD_NAME: Traffic3D
GIT_DEPTH: 10
# Use a shallow clone depth to speed up the CI build.
# See: https://docs.gitlab.com/ee/ci/large_repositories/
BUILD_NAME: Traffic3D
GIT_DEPTH: 10
cache:
key: "$CI_PROJECT_NAMESPACE-$CI_PROJECT_NAME-$CI_COMMIT_REF_SLUG-$BUILD_TARGET"
paths:
- $BUILD_NAME/Library/
key: "$CI_PROJECT_NAMESPACE-$CI_PROJECT_NAME-$CI_COMMIT_REF_SLUG-$BUILD_TARGET"
paths:
- $BUILD_NAME/Library/
stages:
- test
- build
- prepare
- lint
- test
- build
- benchmark
workflow:
rules:
- if: $CI_MERGE_REQUEST_ID
when: never
- when: always
meta-build-image:
stage: prepare
image: docker:stable
variables:
DOCKER_TLS_CERTDIR: ""
services:
- docker:dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- cd .meta
- docker build -t $CI_REGISTRY/traffic3d/traffic3d/buildimage:latest .
- docker push $CI_REGISTRY/traffic3d/traffic3d/buildimage:latest
rules:
- changes:
- .meta/Dockerfile
when: always
- when: never
tags:
- dind
.unity_before_script: &unity_before_script
before_script:
- apt-get update -qq -y
- apt-get install -y moreutils
- chmod +x ./ci/before_script.sh && ./ci/before_script.sh
before_script:
- chmod +x ./ci/before_script.sh && ./ci/before_script.sh
lint:
stage: lint
image: ruby:2.5
before_script:
- gem install mdl
script:
- git ls-files -z '*.md' | xargs -0 mdl --style .mdl.rb
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
when: never
- when: always
tags:
- shared
.test: &test
except:
- tags
stage: test
<<: *unity_before_script
script:
- chmod +x ./ci/test.sh && ./ci/test.sh
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-$TEST_PLATFORM-results"
when: always
paths:
- $(pwd)/$TEST_PLATFORM-results.xml
image: registry.gitlab.com/traffic3d/traffic3d/buildimage
stage: test
<<: *unity_before_script
script:
- chmod +x ./ci/test.sh && ./ci/test.sh
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-$TEST_PLATFORM-results"
when: always
paths:
- $(pwd)/$TEST_PLATFORM-results.xml
rules:
- if: $CI_COMMIT_TAG
when: never
- when: always
tags:
- test
test-playmode:
<<: *test
variables:
TEST_PLATFORM: playmode
<<: *test
variables:
TEST_PLATFORM: playmode
.build: &build
except:
- tags
stage: build
<<: *unity_before_script
script:
- chmod +x ./ci/build.sh && ./ci/build.sh
artifacts:
paths:
- ./$BUILD_NAME/Builds/
image: registry.gitlab.com/traffic3d/traffic3d/buildimage
stage: build
<<: *unity_before_script
script:
- chmod +x ./ci/build.sh && ./ci/build.sh
artifacts:
paths:
- ./$BUILD_NAME/Builds/
rules:
- if: $CI_COMMIT_TAG
when: never
- when: always
tags:
- build
build-StandaloneLinux64:
<<: *build
variables:
BUILD_TARGET: StandaloneLinux64
<<: *build
variables:
BUILD_TARGET: StandaloneLinux64
build-StandaloneWindows64:
<<: *build
variables:
BUILD_TARGET: StandaloneWindows64
<<: *build
variables:
BUILD_TARGET: StandaloneWindows64
build-StandaloneOSX:
<<: *build
variables:
BUILD_TARGET: StandaloneOSX
<<: *build
variables:
BUILD_TARGET: StandaloneOSX
benchmark:
stage: benchmark
image: registry.gitlab.com/traffic3d/traffic3d/buildimage:latest
<<: *unity_before_script
dependencies:
- build-StandaloneLinux64
script:
- chmod +x ./ci/benchmark.sh && ./ci/benchmark.sh
rules:
- when: manual
allow_failure: true
tags:
- benchmark
# Enable all rules by default
all
# Extend line length, since each sentence should be on a separate line.
rule 'MD013', :line_length => 99999
# Allow multiple headers with same content.
exclude_rule 'MD024'
# The first line in a file does not have to be a top-level header.
# This is important for GitLab resource templates, etc.
exclude_rule 'MD002'
exclude_rule 'MD041'
# Allow trailing punctuation (e.g. question marks) in headers.
exclude_rule 'MD026'
# Allow in-line HTML
exclude_rule 'MD033'
# Nested lists should be indented with four spaces.
rule 'MD007', :indent => 4
FROM gableroux/unity3d:2018.3.11f1
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y autoconf moreutils && \
wget https://github.com/ltratt/multitime/archive/multitime-1.4.tar.gz && \
tar -xvzf multitime-1.4.tar.gz && \
rm multitime-1.4.tar.gz && \
cd multitime-multitime-1.4 && \
make -f Makefile.bootstrap && \
./configure && \
make && \
make install && \
cd .. && rm -Rf multitime-multitime-1.4 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
......@@ -16,6 +16,46 @@ git clone git@gitlab.com:traffic3d/traffic3d.git
cd traffic3d
```
## Documentation
All documents should be in [Markdown format](https://about.gitlab.com/handbook/product/technical-writing/markdown-guide/) in a directory called `docs`.
Images should go in a `figures` subdirectory.
All Markdown documents should follow the rule of **one sentence per line** (i.e. a line break should follow every full stop).
This makes it *much* easier to view `git diff`s and review merge requests.
### Ensuring that your Markdown syntax is valid
To make sure that your Markdown is valid, please use [the mdl Markdown lint](https://github.com/markdownlint/markdownlint).
To install the lint on Debian-like machines, use the [Rubygems](https://rubygems.org/) package manager:
```sh
sudo apt-get install gem
sudo gem install mdl
```
Because we keep each sentence on a separate line, you will want to suppress spurious `MD013 Line length` reports by configuring `mdl`.
The file [.mdl.rb](/.mdl.rb) contains styles that deal with `MD013` and other tweaks we want to make to the lint.
To use the style configuration, pass it as a parameter to `mdl` on the command line:
```sh
mdl -s .mdl.rb DOCUMENT.md
```
If you want to run `mdl` from your IDE or editor, you will either need to configure it, or find a plugin, such as [this one for Sublime Text](https://github.com/SublimeLinter/SublimeLinter-mdl).
### Setting up a git hook
This repository provides a [git hook](https://githooks.com/) that will run `mdl` each time the developer commits their code, and refuse to perform the commit if the changes do not pass the lint.
To install the hook, first ensure that you have `mdl` installed correctly (see above).
Next, run the hook install script:
```sh
./bin/create-hook-symlinks
```
## Installation and set-up
The project runs on Unity 2018.3.11f1 and up.
......@@ -24,6 +64,83 @@ Or download Unity 2018.3.11f1 from the following link: [https://unity3d.com/get-
Use a preferred C# IDE or download Visual Studio using the following link: [https://visualstudio.microsoft.com/vs/](https://visualstudio.microsoft.com/vs/)
## Unity activation for the CI/CD environment
Install [docker](https://www.docker.com/) on your development machine, for example on Ubuntu 20.04:
```sh
sudo apt-get install docker.io
```
Pull the `gableroux/unity3d` docker image and run Bash inside, passing your unity username and password in to the environment:
```sh
UNITY_VERSION=2019.3.7f1
docker run -it --rm \
-e "UNITY_USERNAME=username@example.com" \
-e "UNITY_PASSWORD=example_password" \
-e "TEST_PLATFORM=linux" \
-e "WORKDIR=/root/project" \
-v "$(pwd):/root/project" \
gableroux/unity3d:$UNITY_VERSION \
bash
```
_hint: you should write this to a shell script and execute the shell script so you don't have your credentials stored in your bash history_.
Also make sure you use your Unity3d _email address_ for `UNITY_USERNAME` environment variable.
If your password contains a `!`, you can escape it like this (`example_pass!word`):
```sh
...
-e "UNITY_PASSWORD=example_pass"'!'"word" \
...
```
In the Docker container, run Unity once like this, it will try to activate the license:
```sh
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
/opt/Unity/Editor/Unity \
-logFile /dev/stdout \
-batchmode \
-username "$UNITY_USERNAME" -password "$UNITY_PASSWORD"
```
Wait for output that looks like this:
```sh
LICENSE SYSTEM [2017723 8:6:38] Posting <?xml version="1.0" encoding="UTF-8"?><root><SystemInfo><IsoCode>en</IsoCode><UserName>[...]
```
If you get the following error:
> Can't activate unity: No sufficient permissions while processing request HTTP error code 401
Make sure your credentials are valid.
You may try to disable 2FA in your account and try again.
Once done, you should enable 2FA again for security reasons.
See [this issue](https://gitlab.com/gableroux/unity3d-gitlab-ci-example/-/issues/11) from the Unity3d [CI example repository](https://gitlab.com/gableroux/unity3d-gitlab-ci-example/) for more details.
Next:
1. Copy the XML content and save in a file called `unity3d.alf`.
1. Open [https://license.unity3d.com/manual](https://license.unity3d.com/manual) and answer the questions.
1. Upload `unity3d.alf` for manual activation.
1. Download `Unity_v2018.x.ulf` (`Unity_v2019.x.ulf` for 2019 versions).
1. Copy the content of `Unity_v2018.x.ulf` license file to your CI's environment variable `UNITY_LICENSE_CONTENT`.
Note: if you are doing this on windows your [line endings will be wrong as explained here](https://gitlab.com/gableroux/unity3d-gitlab-ci-example/issues/5#note_95831816).
[`.gitlab-ci.yml`](.gitlab-ci.yml) solves this by removing `\r` character from the environment variable so you do not need to edit the license files manually.
[`.gitlab-ci.yml`](.gitlab-ci.yml) will then place the `UNITY_LICENSE_CONTENT` to the right place before running tests or creating the builds.
## Density Measurements
On new scenes, the density measure points need setting up to allow for correct density per km calculations.
To set these points up, on the paths, select the node that needs to be used as the density measure point (normally just after exiting a junction) and add the `DensityMeasurePoint.cs` script to the node.
Then add a `BoxCollider` to the node, check `Is Trigger` and resize where vehicles on that path will pass through the box.
## Further documentation
Detailed documentation, including how to use the Unity editor, how to extend Traffic3D with new assets and scenes, can be found in the [Traffic3D documentation](https://traffic3d.org).
# Traffic 3D
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3460497.svg)](https://doi.org/10.5281/zenodo.3460497)
[![pipeline status](https://gitlab.com/traffic3d/traffic3d/badges/develop/pipeline.svg)](https://gitlab.com/traffic3d/traffic3d/commits/develop)
[![pipeline status](https://gitlab.com/traffic3d/traffic3d/badges/develop/pipeline.svg)](https://gitlab.com/traffic3d/traffic3d/-/commits/develop)
Traffic3D is a new traffic simulation paradigm, built to push forward research in human-like learning (for example, based on photo-realistic visual input).
It provides a fast, cheap and scalable proxy for real-world traffic environments, based on the [Unity 3d](https://unity3d.com/unity) platform.
......@@ -14,6 +14,14 @@ For more details please see [https://traffic3d.org](https://traffic3d.org).
Please report issues via the [issue tracker](https://gitlab.com/traffic3d/traffic3d/issues).
## Developers
Current developers:
* Callum Bugajski - @callumbugajski via [Beautiful Canoe](https://beautifulcanoe.com/)
Based on original code by Deepeka Garg (@gargd03).
## License
This software is licensed under the [Mozilla Public License Version 2.0](/LICENSE).
......@@ -23,6 +31,45 @@ Copies of the license can also be obtained [directly from Mozilla](https://mozil
Please read [CONTRIBUTING.md](/CONTRIBUTING.md) before you start working on this repository.
## CLI Options
Traffic3D has custom command line options using following flag:
`-executeMethod CustomCommandLineArguments.Run`
The custom options are:
* `-JSONConfigFile "filename.json"` - Import settings from a JSON file (see below for config details)
* `-OpenScene "Scenes/sceneName.unity"` - Open a scene
* `-RunBenchmark true|false` - Run Benchmark
### Examples
```sh
# Using all custom options.
${UNITY_EXECUTABLE:-xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' /opt/Unity/Editor/Unity} \
-projectPath $(pwd)/Traffic3D \
-testPlatform playmode \
-testResults $(pwd)/playmode-results.xml \
-CacheServerIPAddress 172.17.0.1:8126 \
-executeMethod CustomCommandLineArguments.Run \
-JSONConfigFile "config.json" \
-OpenScene "Scenes/NightDemo.unity" \
-RunBenchmark true \
-logFile \
-batchmode
```
## Config
Configuration is used to bulk import initialisation values into the Traffic3D system.
Normally the values are direct mappings of the values that can be changed within the Unity UI.
For example the `vehicleFactoryConfig` object within the config example below allows us to pass data directly to the specified fields.
e.g. The `highRangeRespawnTime` field in the config maps to the `highRangeRespawnTime` field in the game object.
### Examples
See [test_config.json](/Traffic3D/Assets/Tests/TestFiles/test_config.json) for an example of how to structure the file.
## Citing the Traffi3D software
Please see the [CITATION](/CITATION) file.
......
fileFormatVersion: 2
guid: d47602877b3c2de46b60199bda795d55
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Welcome to AllSky Free!
This is a small sample edition of the full version of Allsky.
It contains a set of 10 skyboxes for use in your environments.
I hope you find them useful!
You can Buy the full version of AllSky here :
https://assetstore.unity.com/packages/2d/textures-materials/sky/allsky-200-sky-skybox-set-10109
The full version has 200 skies for Unity! Provided as 6 sided cubemaps sized from x1024 to x2048 per-side along with an equirectangular cubemap texture ranging from 4k to 16k in size. Each has an example lighting setup scene!
Various styles: Day, Night, Cartoon, Fantasy, Hazy, Epic, Space, Sunless and Moonless!
For lighting artists, environment artists and indie developers looking for a wide suite of skies to light their environments.
Lighting from day to night: Twilight, sunset, multiple times of day, multiple times of night, skyglow.
Many weather and cloud types: Clear, overcast, summery, stormy, autumnal, hazy, epic, foggy, cumulus.
TECHNICAL
Texture format: Each sky is a 6 sided cubemap. Source PNG texture resolution per-side ranges from x1024 to x2048. Equirectangular images vary in size up to 16k textures.
Skies are sorted by time of day or style in folders.
Each individual sky has a folder which contains the textures and a material with those textures assigned.
There is also a demo scene with example lighting and fog pass for reference.
Each sky has its own 6 sided skybox material which you can set to your scene's current skybox.
Please consult the Unity documentation if you are unsure how to do this.
http://docs.unity3d.com/Manual/HOWTO-UseSkybox.html
There is also an equirectangular material. Some users report that this is preferable in their use-case or build platform.
The materials are mostly set as /mobile/skyboxes shaders - which should be fastest - but you can change them to the other skybox shaders that ship with Unity and set the required textures. Some add tint, exposure and rotation controls.
The import resolution and type of compression used on the sky textures is entirely up to you. It should be set at a level which you feel utilises appropriate amounts of memory for your game amd platform, taking into account the amount of compression artifacts that you feel are acceptable.
DEMO SCENE
Each sky folder also has a demo scene. This shows a simple low-poly environment to demonstrate lighting and fog settings for that sky.
It was lit in the Forward Lighting Rendering Path with Linear lighting Color Space.
For intended demo scene lighting values and fog to be visible you will need a project with those settings.
(Under Edit->Project Settings->Player)
If you have to change these settings it may be necessary to re-import the sky textures.
The demo scene can benefit from increasing the Pixel light count in quality settings, and the Shadow Distance.
WHO
This asset pack is by Richard Whitelock.
A game developer, digital artist & photographer.
15+ years in the games industry working in a variety of senior art roles on 20+ titles.
Particularly experienced in environment art, lighting & special FX.
Currently working on various indie game & personal projects.
http://www.richardwhitelock.com
fileFormatVersion: 2
guid: b5443709c18b745a19a0a71636938ca9
timeCreated: 1557590039
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:
MIT License
Copyright (c) 2020 rpgwhitelock
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
fileFormatVersion: 2
guid: 248e72bd19c16ee4c8984a5d2fac5add
guid: 0e8a7a6b384013247b50991eb0d78a0d
DefaultImporter:
externalObjects: {}
userData:
......
fileFormatVersion: 2
guid: 26e352704e0b94af78a547c6d44125d9
folderAsset: yes
timeCreated: 1557586146
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: AllSky_Night_MoonBurst Equirect
m_Shader: {fileID: 103, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}