const regex = /(^##.*\n)((?:\s*(?!##).)*)*/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('(^##.*\\n)((?:\\s*(?!##).)*)*', 'gm')
const str = `## Game Engines
> Look at what people did right, and what people did wrong. Then do them from scratch cause "I wanna learn"
<a class="btn disabled btn--warning">Intermediate</a> [Creating a tools pipeline for Horizon Zero Dawn][hzd-engine-tools]<br>
Horizon Zero Dawn is an amazing game, and since they use a custom engine they have to have their own tools. This is the team's talk about those tools.<br>
**fun fact**:*this blog is inspired exactly by their blog, even though it's really different.*
<a class="btn disabled btn--success">Beginner</a> [Musings on cross-platform graphics engine architectures - Pt.1][musings]<br>
This is a blog post talking about engine architecture, mainly about what the goals should be and how to reach them. There's also a [Part 2][musings-pt2] talking about MultiThreading, so check that out too.<br>
The autor said he would do also a part 3 and 4, but they never came out, unfortunately.
<a class="btn disabled btn--success">Beginner</a> [An Analysis of Minecraft-like Engines][minecraft-engine-analysis]<br>
This is a blogpost talking about the common features of Minecraft-like Engines, *aka Voxel Engines*. You can also find some ways to optimize yours, with benchmarks too!
<a class="btn disabled btn--success">Beginner</a> [Modern Game Engine Architectures][modern-game-engine]<br>
This is a quick little post about the main engine architecture (*or at least, the one everyone talks about*). There's also a little tour on Functional Reactive Programming, if you're interested.
<a class="btn disabled btn--warning">Intermediate</a> [Nomad Game Engine][nomad game engine]<br>
This is a little engine, called Nomad. In this blog the author *should have* talked about his engine, but since this blog got abandoned it's just a collection of 8 Articles, mainly centered around ECS. I think this is still a good thing, since I believe this to be the **best** resource about ECS, going from how it works, divind deep into the implementation.
<a class="btn disabled btn--warning">Intermediate</a> [Component Based Engine Design][component-based-engine]<br>
"Component Based Engine" is just another name for the same architecture, the ECS, or Entity-Component-System.<br>
Again, this is a really good resource on that.
<a class="btn disabled btn--success">Beginner</a> [Nick's Voxel Blog: Engine Overview][nick-engine]<br>
This is blogpost about a Voxel Engine implementation. There are other cool resources on that blog, some of them featured in this collection.
<a class="btn disabled btn--success">Beginner</a> [Writing a Game Engine in 2017][engine-2017]<br>
This is a blogpost about writing an engine. As it says it's the state of engine creation in 2017, but I believe some, *if not most*, of the things mentioned here still apply, so definitely check it out!
<a class="btn disabled btn--success">Beginner</a> [Blog Entries: a Voxel Project][blog-entries]<br>
This is a **HUGE** blog mainly about a Voxel Engine, going from basically scratch to a really good Minecraft-like world/engine.
<a class="btn disabled btn--success">Beginner</a> [Scene Graph][scene-graph]<br>
A tutorial about a specific component of an Engine: Scene Graphs
<a class="btn disabled btn--warning">Intermediate</a> [Raycasting Engine in C++][ray-engine-cpp]<br>
A raycasting engine in C++
## Data Structures and Algorithms
> Programming is the art of manipulating data through algorithms, so here's a bunch of them!
<a class="btn disabled btn--danger">Expert</a> [Z-order Curves][z-order]<br>
Z-order curves are a "math tool" to fill space (yes, that's their other name: Space Filling Curves).<br>
You can use these to fill an infinite plane in partitions that you can istantly identify, so you can use these to quickly access a chunk of your terrain.<br>
There are many types of Space Filling Curves, and this is just one of them, but the most famoust is definitely the next one:
<a class="btn disabled btn--danger">Expert</a> [Hilbert Curves][hilbert-curve]<br>
Again, this is just another type of Space Filling Curve, so you can quickly partition an infinite plane with unique IDs.
<a class="btn disabled btn--danger">Expert</a> [Fortune's algorithm - Wikipedia][fortune-wiki]<br>
Fortune's algorithm is an algorithm to quickly create a Voronoi diagram, faster than a simple Naive approach, The general complexity becomes O(n*logn)
<a class="btn disabled btn--danger">Expert</a> [Fortune’s algorithm and implementation][fortune’s algorithm and implementation]<br>
After you've read what Fortune's algorithm is you definitely need an implementation, so here it is.
<a class="btn disabled btn--warning">Intermediate</a> [Fluid Simulation : Unity3D][fluid simulation : unity3d]<br>
Little reddit post about a fluid simulation in Unity3D. You can see in the comments the author saying how it works and giving you a launch point for other resources.
<a class="btn disabled btn--warning">Intermediate</a> [Metaballs and Marching Squares][metaballs and marching squares]<br>
This is a really cool blogpost about how both Metaballs and Marching Squares work. Marching Squares is an algorithm for 2D about mesh creation, but you can also find variations of that for 3D, like Marching Cubes and Marching Tetrahedra. You can find more about those in the next resources.<br>
Metaballs are balls that merge together when close to each other, so they're really useful for fluid simulations
<a class="btn disabled btn--warning">Intermediate</a> [Marching Cubes: Procedural World][marching-cubes]<br>
Here's the most basic version of Marching Squares but in 3D: Marching Cubes.<br>
Little Blogpost about how Marching Cubes Works
<a class="btn disabled btn--warning">Intermediate</a> [Coding Adventure: Marching Cubes][marching-cubes-coding-adventure]<br>
Here's another resource for Marching Cubes, an actual implementation. You can also find the code in the description of this video.
<a class="btn disabled btn--warning">Intermediate</a> [Marching Tetrahedra: Wikipedia][marching-tetrahedra-wiki]<br>
And finally here's another variant of Marching Cubes still for 3D: Marching Tetrahedra
<a class="btn disabled btn--success">Beginner</a> [Algorithm Archive · GitBook][algorithm-archive-gitbook]<br>
This is a currently in developement GitBook Archive of Algorithms. You can also help them build this archive by sending your implementation of an algorithm in a language missing.
<a class="btn disabled btn--danger">Expert</a> [Gamasutra: Chris Simpson's Blog - Behavior trees for AI: How they work][gamasutra: chris simpson's blog - behavior trees for ai: how they work]<br>
This might be the best open resource about Behaviour trees for AI and How they work out there. There's everything from how they work, to adding variations, and code too!
<a class="btn disabled btn--danger">Expert</a> [Water erosion on heightmap terrain][water erosion on heightmap terrain]<br>
This is an article about water erosion on terrains, with implementation too!
<a class="btn disabled btn--danger">Expert</a> [Fast Hydraulic Erosion Simulation and Visualization on GPU][latex8.dvi]<br>
This is a Paper on Hydraulic Erosion Simulation, really awesome stuff.
`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions