Skip to content

Commit 11f6432

Browse files
committed
Merge branch 'release/1.6.2'
2 parents a8d490c + dbe5836 commit 11f6432

Some content is hidden

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

42 files changed

+204
-20
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ If applicable, add screenshots to help explain your problem.
2424

2525
**Desktop (please complete the following information):**
2626
- OS: [e.g. mac/linux/windows]
27-
- Version [e.g. 1.6.1]
27+
- Version [e.g. 1.6.2]
2828

2929
**Additional context**
3030
Add any other context about the problem here.

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.18.0)
22
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version")
3-
project(Griddly VERSION 1.6.1)
3+
project(Griddly VERSION 1.6.2)
44

55
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWERCASE)
66

bindings/python.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace griddly {
1212

1313
PYBIND11_MODULE(python_griddly, m) {
1414
m.doc() = "Griddly python bindings";
15-
m.attr("version") = "1.6.1";
15+
m.attr("version") = "1.6.2";
1616

1717
#ifndef NDEBUG
1818
spdlog::set_level(spdlog::level::debug);

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
author = 'Chris Bamford'
2323

2424
# The full version, including alpha/beta/rc tags
25-
release = '1.6.1'
25+
release = '1.6.2'
2626

2727

2828
# -- General configuration ---------------------------------------------------

docs/reference/GDY/Actions/items/Trigger/Offset/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Offset
2525

2626
* - **Type**
2727
- **Description**
28-
* - :ref:`Offset Coordinate<#/properties/Objects/items/properties/Observers/properties/Isometric/properties/Offset/item>`
28+
* - :ref:`Offset Coordinate<#/properties/Objects/items/properties/Trigger/properties/Offset/item>`
2929
- Offset Coordinate
3030

3131

docs/reference/GDY/Actions/items/Trigger/Offset/items/index.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
.. _#/properties/Objects/items/properties/Observers/properties/Isometric/properties/Offset/item:
1+
.. _#/properties/Objects/items/properties/Trigger/properties/Offset/item:
22

3-
.. #/properties/Objects/items/properties/Observers/properties/Isometric/properties/Offset/item
3+
.. #/properties/Objects/items/properties/Trigger/properties/Offset/item
44
55
Offset Coordinate
66
=================

docs/tutorials/Custom Shaders/Global Lighting/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ We calculate the lighting level in the vertex shader (so we don't need to calcul
145145
layout(std140, binding = 1) uniform EnvironmentData {
146146
mat4 projectionMatrix;
147147
mat4 viewMatrix;
148+
vec4 globalObserverAvatarHighlightColor;
148149
vec2 gridDims;
149150
int playerCount;
150151
int playerId;

docs/tutorials/Custom Shaders/Health Bars/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ How this ties in with the explanation of the normalized health calculations can
193193
layout(std140, binding = 1) uniform EnvironmentData {
194194
mat4 projectionMatrix;
195195
mat4 viewMatrix;
196+
vec4 globalObserverAvatarHighlightColor;
196197
vec2 gridDims;
197198
int playerCount;
198199
int playerId;

docs/tutorials/Custom Shaders/Object Lighting/index.rst

+2
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ Vertex
183183
layout(std140, binding = 1) uniform EnvironmentData {
184184
mat4 projectionMatrix;
185185
mat4 viewMatrix;
186+
vec4 globalObserverAvatarHighlightColor;
186187
vec2 gridDims;
187188
int playerCount;
188189
int playerId;
@@ -264,6 +265,7 @@ Fragment
264265
layout(std140, binding = 1) uniform EnvironmentData {
265266
mat4 projectionMatrix;
266267
mat4 viewMatrix;
268+
vec4 globalObserverAvatarHighlightColor;
267269
vec2 gridDims;
268270
int playerCount;
269271
int playerId;

docs/tutorials/Custom Shaders/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ The full shader layout is shown below.:
7777
layout(std140, binding = 1) uniform EnvironmentData {
7878
mat4 projectionMatrix;
7979
mat4 viewMatrix;
80+
vec4 globalObserverAvatarHighlightColor;
8081
vec2 gridDims;
8182
int playerCount;
8283
int playerId;

js/griddlyjs-app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "griddlyjs-app",
3-
"version": "1.6.1",
3+
"version": "1.6.2",
44
"private": true,
55
"dependencies": {
66
"@fortawesome/fontawesome-svg-core": "^6.1.1",

python/examples/Custom Shaders/Global Lighting/shaders/triangle-textured.vert

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct ObjectData{
3636
layout(std140,binding=1)uniform EnvironmentData{
3737
mat4 projectionMatrix;
3838
mat4 viewMatrix;
39+
vec4 globalObserverAvatarHighlightColor;
3940
vec2 gridDims;
4041
int playerCount;
4142
int playerId;

python/examples/Custom Shaders/Health Bars/shaders/triangle-textured.vert

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct ObjectData{
3636
layout(std140,binding=1)uniform EnvironmentData{
3737
mat4 projectionMatrix;
3838
mat4 viewMatrix;
39+
vec4 globalObserverAvatarHighlightColor;
3940
vec2 gridDims;
4041
int playerCount;
4142
int playerId;

python/examples/Custom Shaders/Object Lighting/shaders/triangle-textured.frag

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ struct ObjectData{
3434
layout(std140,binding=1)uniform EnvironmentData{
3535
mat4 projectionMatrix;
3636
mat4 viewMatrix;
37+
vec4 globalObserverAvatarHighlightColor;
3738
vec2 gridDims;
3839
int playerCount;
3940
int playerId;

python/examples/Custom Shaders/Object Lighting/shaders/triangle-textured.vert

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ struct ObjectData{
2424
layout(std140,binding=1)uniform EnvironmentData{
2525
mat4 projectionMatrix;
2626
mat4 viewMatrix;
27+
vec4 globalObserverAvatarHighlightColor;
2728
vec2 gridDims;
2829
int playerCount;
2930
int playerId;

python/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def griddly_package_data(config='Debug'):
7171

7272
setup(
7373
name='griddly',
74-
version="1.6.1",
74+
version="1.6.2",
7575
author_email="chrisbam4d@gmail.com",
7676
description="Griddly Python Libraries",
7777
long_description=long_description,

resources/gdy-schema.json

+32-2
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,21 @@
185185
"default": "NONE",
186186
"enum": ["NONE", "GRAYSCALE", "DARKEN", "REMOVE"],
187187
"description": "The type of trigger to use."
188+
},
189+
"ObserverAvatarHighlightColor": {
190+
"$id": "#/properties/Environment/properties/Observers/properties/Shader/properties/ObserverAvatarHighlightColor",
191+
"type": "array",
192+
"title": "Color",
193+
"description": "The color of the highlighting to use",
194+
"additionalItems": false,
195+
"minItems": 3,
196+
"maxItems": 3,
197+
"items": {
198+
"$id": "#/properties/Objects/items/properties/Observers/properties/BackgroundColor/item",
199+
"type": "number",
200+
"title": "Color value",
201+
"description": "A float value for RGB"
202+
}
188203
}
189204
}
190205
},
@@ -210,6 +225,21 @@
210225
}
211226
]
212227
},
228+
"BackgroundColor": {
229+
"$id": "#/properties/Environment/properties/Observers/properties/BackgroundColor",
230+
"type": "array",
231+
"title": "Color",
232+
"description": "The color of the background of the game",
233+
"additionalItems": false,
234+
"minItems": 3,
235+
"maxItems": 3,
236+
"items": {
237+
"$id": "#/properties/Objects/items/properties/Observers/properties/BackgroundColor/item",
238+
"type": "number",
239+
"title": "Color value",
240+
"description": "A float value for RGB"
241+
}
242+
},
213243
"BackgroundTile": {
214244
"$id": "#/properties/Environment/properties/Observers/properties/BackgroundTile",
215245
"type": "string",
@@ -666,7 +696,7 @@
666696
"type": "boolean",
667697
"title": "Relative",
668698
"description": "If the Offset of the collision detector should be relative to the direction that the object is facing."
669-
},
699+
},
670700
"Offset": {
671701
"$id": "#/properties/Actions/items/properties/Trigger/properties/Offset",
672702
"type": "array",
@@ -676,7 +706,7 @@
676706
"maxItems": 2,
677707
"minItems": 2,
678708
"items": {
679-
"$id": "#/properties/Objects/items/properties/Observers/properties/Isometric/properties/Offset/item",
709+
"$id": "#/properties/Objects/items/properties/Trigger/properties/Offset/item",
680710
"title": "Offset Coordinate",
681711
"description": "Coordinate for rendering offset of isometric tiles",
682712
"type": "integer"
4.58 KB
Loading

resources/shaders/default/block/triangle-textured.frag

+12-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ struct ObjectData{
2727
layout(std140,binding=1)uniform EnvironmentData{
2828
mat4 projectionMatrix;
2929
mat4 viewMatrix;
30+
vec4 globalObserverAvatarHighlightColor;
3031
vec2 gridDims;
3132
int playerCount;
3233
int playerId;
@@ -96,7 +97,17 @@ void main()
9697
outFragColor=texture(samplerArray,inFragTextureCoords)*inColor;
9798
}
9899

99-
if(environmentData.globalObserverAvatarMode==3){
100+
if(environmentData.globalObserverAvatarMode==4){
101+
if(isInPlayerView()){
102+
103+
// outFragColor=vec4(mix(outFragColor.rgb,environmentData.globalObserverAvatarHighlightColor.rgb,0.7),1.);
104+
outFragColor=vec4(
105+
min(1.,outFragColor.x+environmentData.globalObserverAvatarHighlightColor.x),
106+
min(1.,outFragColor.y+environmentData.globalObserverAvatarHighlightColor.y),
107+
min(1.,outFragColor.z+environmentData.globalObserverAvatarHighlightColor.z),
108+
outFragColor.w);
109+
}
110+
}else if(environmentData.globalObserverAvatarMode==3){
100111
if(!isInPlayerView()){
101112
outFragColor=vec4(0);
102113
}

resources/shaders/default/block/triangle-textured.vert

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct ObjectData {
3636
layout(std140, binding = 1) uniform EnvironmentData {
3737
mat4 projectionMatrix;
3838
mat4 viewMatrix;
39+
vec4 globalObserverAvatarHighlightColor;
3940
vec2 gridDims;
4041
int playerCount;
4142
int playerId;

resources/shaders/default/isometric/triangle-textured.frag

+11-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct PlayerInfo{
1717
vec4 playerObservableGrid;
1818
};
1919

20-
struct ObjectData {
20+
struct ObjectData{
2121
mat4 modelMatrix;
2222
vec4 color;
2323
vec4 gridPosition;
@@ -30,6 +30,7 @@ struct ObjectData {
3030
layout(std140,binding=1)uniform EnvironmentData{
3131
mat4 projectionMatrix;
3232
mat4 viewMatrix;
33+
vec4 globalObserverAvatarHighlightColor;
3334
vec2 gridDims;
3435
int playerCount;
3536
int playerId;
@@ -79,7 +80,15 @@ void main()
7980
outFragColor=texture(samplerArray,inFragTextureCoords)*inColor;
8081
}
8182

82-
if(inIsInView == 0){
83+
if(inIsInView==1){
84+
if(environmentData.globalObserverAvatarMode==4){
85+
outFragColor=vec4(
86+
min(1.,outFragColor.x+environmentData.globalObserverAvatarHighlightColor.x),
87+
min(1.,outFragColor.y+environmentData.globalObserverAvatarHighlightColor.y),
88+
min(1.,outFragColor.z+environmentData.globalObserverAvatarHighlightColor.z),
89+
outFragColor.w);
90+
}
91+
}else{
8392
if(environmentData.globalObserverAvatarMode==3){
8493
outFragColor=vec4(0);
8594
}else if(environmentData.globalObserverAvatarMode==2){

resources/shaders/default/isometric/triangle-textured.vert

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ struct ObjectData {
3838
layout(std140, binding = 1) uniform EnvironmentData {
3939
mat4 projectionMatrix;
4040
mat4 viewMatrix;
41+
vec4 globalObserverAvatarHighlightColor;
4142
vec2 gridDims;
4243
int playerCount;
4344
int playerId;

resources/shaders/default/sprite/triangle-textured.frag

+10-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ struct ObjectData{
2828
layout(std140,binding=1)uniform EnvironmentData{
2929
mat4 projectionMatrix;
3030
mat4 viewMatrix;
31+
vec4 globalObserverAvatarHighlightColor;
3132
vec2 gridDims;
3233
int playerCount;
3334
int playerId;
@@ -97,7 +98,15 @@ void main()
9798
outFragColor=texture(samplerArray,inFragTextureCoords)*inColor;
9899
}
99100

100-
if(environmentData.globalObserverAvatarMode==3){
101+
if(environmentData.globalObserverAvatarMode==4){
102+
if(isInPlayerView()){
103+
outFragColor=vec4(
104+
min(1.,outFragColor.x+environmentData.globalObserverAvatarHighlightColor.x),
105+
min(1.,outFragColor.y+environmentData.globalObserverAvatarHighlightColor.y),
106+
min(1.,outFragColor.z+environmentData.globalObserverAvatarHighlightColor.z),
107+
outFragColor.w);
108+
}
109+
}else if(environmentData.globalObserverAvatarMode==3){
101110
if(!isInPlayerView()){
102111
outFragColor=vec4(0);
103112
}

resources/shaders/default/sprite/triangle-textured.vert

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ struct ObjectData {
3535
layout(std140, binding = 1) uniform EnvironmentData {
3636
mat4 projectionMatrix;
3737
mat4 viewMatrix;
38+
vec4 globalObserverAvatarHighlightColor;
3839
vec2 gridDims;
3940
int playerCount;
4041
int playerId;

src/Griddly/Core/GDY/GDYFactory.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,9 @@ BlockObserverConfig GDYFactory::parseNamedBlockObserverConfig(std::string observ
383383
config.highlightPlayers = resolveObserverConfigValue<bool>("HighlightPlayers", observerConfigNode, playerCount_ > 1, !isGlobalObserver);
384384
config.rotateAvatarImage = resolveObserverConfigValue<bool>("RotateAvatarImage", observerConfigNode, config.rotateAvatarImage, !isGlobalObserver);
385385

386+
auto backgroundColorNode = observerConfigNode["BackgroundColor"];
387+
config.backgroundColor = parseColorNode(observerConfigNode["BackgroundColor"]);
388+
386389
if (objectNames_.size() == 0) {
387390
return config;
388391
}
@@ -473,6 +476,8 @@ void GDYFactory::parseNamedObserverShaderConfig(VulkanObserverConfig& config, YA
473476
return;
474477
}
475478

479+
config.globalObserverAvatarHighlightColor = parseColorNode(shaderConfigNode["ObserverAvatarHighlightColor"]);
480+
476481
auto globalObserverAvatarMode = shaderConfigNode["ObserverAvatarMode"];
477482
if (globalObserverAvatarMode.IsDefined()) {
478483
auto avatarMode = globalObserverAvatarMode.as<std::string>();
@@ -482,6 +487,8 @@ void GDYFactory::parseNamedObserverShaderConfig(VulkanObserverConfig& config, YA
482487
config.globalObserverAvatarMode = GlobalObserverAvatarMode::DARKEN_INVISIBLE;
483488
} else if (avatarMode == "REMOVE") {
484489
config.globalObserverAvatarMode = GlobalObserverAvatarMode::REMOVE_INVISIBLE;
490+
} else if (avatarMode == "HIGHLIGHT") {
491+
config.globalObserverAvatarMode = GlobalObserverAvatarMode::HIGHLIGHT_VISIBLE;
485492
} else {
486493
std::string error = fmt::format("No avatar mode called {0} exists.", avatarMode);
487494
throwParserError(error);

src/Griddly/Core/GDY/YAMLUtils.hpp

+16
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,20 @@ inline YAML::iterator validateCommandPairNode(YAML::Node& commandPairNodeList) {
5353
return commandPairNodeList.begin();
5454
}
5555

56+
inline glm::vec3 parseColorNode(YAML::Node colorNode) {
57+
if (colorNode.IsDefined()) {
58+
if (!colorNode.IsSequence() || colorNode.size() != 3) {
59+
auto error = fmt::format("Color node misconfigured, must contain 3 values but contains {0}.", colorNode.size());
60+
throwParserError(error);
61+
} else {
62+
return glm::vec3{
63+
colorNode[0].as<float>(0),
64+
colorNode[1].as<float>(0),
65+
colorNode[2].as<float>(0)};
66+
}
67+
}
68+
69+
return glm::vec3{};
70+
}
71+
5672
} // namespace griddly

src/Griddly/Core/Observers/BlockObserver.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const std::map<std::string, SpriteDefinition> BlockObserver::blockSpriteDefiniti
1212
{"square", {{"block_shapes/square.png"}}},
1313
{"pentagon", {{"block_shapes/pentagon.png"}}},
1414
{"hexagon", {{"block_shapes/hexagon.png"}}},
15+
{"fill", {{"block_shapes/fill.png"}}},
1516
};
1617

1718
BlockObserver::BlockObserver(std::shared_ptr<Grid> grid, BlockObserverConfig& config)
@@ -32,6 +33,16 @@ void BlockObserver::updateObjectSSBOData(PartialObservableGrid& observableGrid,
3233
const auto& objects = grid_->getObjects();
3334
const auto& objectIds = grid_->getObjectIds();
3435

36+
vk::ObjectDataSSBO backgroundTiling;
37+
backgroundTiling.modelMatrix = glm::translate(backgroundTiling.modelMatrix, glm::vec3(gridWidth_ / 2.0 - config_.gridXOffset, gridHeight_ / 2.0 - config_.gridYOffset, 0.0));
38+
backgroundTiling.modelMatrix = glm::scale(backgroundTiling.modelMatrix, glm::vec3(gridWidth_, gridHeight_, 1.0));
39+
backgroundTiling.gridPosition = {0, 0, -10, 0};
40+
backgroundTiling.color = glm::vec4(config_.backgroundColor, 1.0);
41+
backgroundTiling.textureMultiply = {gridWidth_, gridHeight_};
42+
backgroundTiling.textureIndex = device_->getSpriteArrayLayer("fill");
43+
backgroundTiling.objectTypeId = 1000;
44+
frameSSBOData_.objectSSBOData.push_back({backgroundTiling});
45+
3546
for (auto& object : objects) {
3647
auto location = object->getLocation();
3748

src/Griddly/Core/Observers/BlockObserver.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ struct BlockDefinition {
1717

1818
struct BlockObserverConfig : public SpriteObserverConfig {
1919
std::map<std::string, BlockDefinition> blockDefinitions;
20+
glm::vec3 backgroundColor{};
2021
};
2122

2223
class BlockObserver : public SpriteObserver {

0 commit comments

Comments
 (0)