Skip to content

Commit 0ba237e

Browse files
committed
feat(social): add social media
1 parent 63100c9 commit 0ba237e

5 files changed

Lines changed: 53 additions & 9 deletions

File tree

.github/workflows/documentation.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
if [ "${{ secrets.GH_SQUID_TOKEN }}" != '' ]; then
6262
pip install git+https://${{ secrets.GH_SQUID_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
6363
else
64-
pip install mkdocs-material==9.2.0b3
64+
pip install mkdocs-material
6565
fi
6666
6767
# - name: Configure

blog/posts/MazeDataStructure/MazeDataStructures.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ In this version, WallData will use 1 byte per room(40x improvement). But we will
8484
vector<bool> topWalls, rightWals, bottomWalls, leftWalls;
8585
```
8686

87-
For vector, depending on the implementation, it needs to store the size of it, the capacity, and the pointer to the data, which will use 24 bytes per vector. It can reaches 32 if it stores the reference count to it as a smart pointer.
87+
For vector, depending on the implementation, it needs to store the size of it, the capacity, and the pointer to the data, which will use 24 bytes per vector. If can reach 32 if it stores the reference count to it as a smart pointer.
8888

8989
So what we are going to do next? Reduce the number of vectors used to reduce overhead. If you want to go deeper, you can use only one vector<bool> where every bit is a wall. So we will have only 4 bits per room and do some math to get the right bit(80x improvement).
9090

courses/artificialintelligence/readings/spatial-quantization.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ int index = x + y * width; // index of the cell at x,y
2626
There is a catch here, given we usually represent points as X and Y coordinates, we need to be careful with the order of the coordinates. While you are iterating over all the matrix, you need to iterate over the Y coordinate first, and then the X coordinate. This is because the Y coordinate is the one that changes the most, so it is better to have it in the inner loop. By doing that, you will have better cache locality and effectively the index will be sequential.
2727

2828
```c++
29+
vector<YourStructure> data; // data is filled with some data elsewhere
2930
for(int y = 0; y < height; y++) {
30-
for(int x = 0; x < width; x++) {
31-
int index = x + y * width;
32-
// do something with the cell at index
31+
for(int x = 0; x < width; x++) {
32+
// do something with the cell at index x,y
33+
data[y * width + y] = yourstrucure;
34+
// it is the same as: data[y][x] = yourstructure;
3335
}
3436
}
3537
```
@@ -69,6 +71,12 @@ std::vector<Vector2int> get_neighbors(Vector2int index) {
6971
}
7072
```
7173

74+
We already understood the idea of matrix flattening to improve efficiency, we can use it to represent a maze. But in a maze, we have walls to
75+
76+
Imagine that you are willing to be as memory efficient and more cache friendly as possible. You can use a single array to store the maze, and you can use the following formula to convert from matrix indexes to the index of the cell in the array.
77+
78+
```c++
79+
7280
## Hexagonal Grid
7381

7482
Hexagonal grid is an extension of a square grid, but the cells are hexagons. It feels nicer to human eyes because we have more equally distant neighbors. If used as subtract for pathfinding, it can be more efficient because the path can be more straight.
@@ -276,4 +284,3 @@ namespace std {
276284
Pay attention that the hashing function above generates collisions, so you have to use a data structure that can handle collisions. You will use datastructures like `unordered_map<Vector2D, unordered_set<DATATYPE>>` or `unordered_map<Vector2D, vector<DATATYPE>>`. The first one is better for insertion and query, but it is not cache friendly.
277285
278286
To avoid having one bucket per every possible position, you have to setup properly the dimension of the bucket, a good sugestion is to alwoys floor the position and have buckets dimension of 1.0f. That would be good enough for most cases.
279-

mkdocs.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ reveal:
153153

154154
edit_uri: edit/main/
155155

156-
copyright: Copyright &copy; 2023 Tolstenko and Others
156+
copyright: Copyright &copy; 2023 Tolstenko, Game Guild Community and Others
157157

158158
markdown_extensions:
159159
- abbr
@@ -195,6 +195,10 @@ markdown_extensions:
195195
- pymdownx.tilde
196196

197197
plugins:
198+
- social:
199+
cards: true
200+
cards_layout: default
201+
enabled: true
198202
- blog:
199203
# blog_toc: true
200204
blog_authors: true
@@ -221,8 +225,6 @@ plugins:
221225
docs_path: ./
222226
cache_dir: /tmp/cache/awesome-gamedev-resources
223227
# - git-authors
224-
- social:
225-
cards_layout: default/accent
226228
- git-revision-date-localized:
227229
enable_creation_date: true
228230
fallback_to_build_date: true

overrides/main.html

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{% extends "base.html" %}
2+
3+
{% block extrahead %}
4+
<!--<meta property="og:type" content="website">-->
5+
<!--<meta property="og:title" content="Awesome Gamedev Guild">-->
6+
<!--<meta property="og:description" content="Game Guild">-->
7+
<!--<meta property="og:url" content="https://gameguild.gg/">-->
8+
<!--<meta property="og:image" content="https://gameguild.gg/overrides/favicon/apple-touch-icon.png">-->
9+
{% endblock %}
10+
11+
12+
{% block scripts %}
13+
<!-- Add scripts that need to run before here -->
14+
{{ super() }}
15+
<!-- Add scripts that need to run afterwards here -->
16+
<!-- Smartlook tag (recorder.js) -->
17+
<script type='text/javascript'>
18+
window.smartlook||(function(d) {
19+
var o=smartlook=function(){ o.api.push(arguments)},h=d.getElementsByTagName('head')[0];
20+
var c=d.createElement('script');o.api=new Array();c.async=true;c.type='text/javascript';
21+
c.charset='utf-8';c.src='https://web-sdk.smartlook.com/recorder.js';h.appendChild(c);
22+
})(document);
23+
smartlook('init', '2f5d1221ea7a962d4adf10180eedd4eab3e00fc4', { region: 'eu' });
24+
</script>
25+
<!--SEMRUSH-->
26+
<!--<script>-->
27+
<!-- ;(function() {-->
28+
<!-- var script = document.createElement('script');-->
29+
<!-- script.id = 'e07e28c9-2f81-4614-9daa-dcc86fab2401';-->
30+
<!-- script.type = 'module';-->
31+
<!-- script.src = 'https://pageimprove.io';-->
32+
<!-- document.head.appendChild(script);-->
33+
<!-- })()-->
34+
<!--</script>-->
35+
{% endblock %}

0 commit comments

Comments
 (0)