-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add basic projects list and hex flower engine project
- Loading branch information
1 parent
99aff53
commit 5bb947e
Showing
20 changed files
with
310 additions
and
65 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
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,24 @@ | ||
--- | ||
title: "Hex Flower Engine" | ||
excerpt: An interactive implementation of Goblin's Henchman's Hex Flower Engine in React, using the better random number generator from our TypeScript dice rolling library for rolls that are more fairly distributed. | ||
coverImage: /assets/blog/hex-flower-engine/hex-flower.png | ||
bannerImage: /assets/blog/hex-flower-engine/hex-flower.gif | ||
ogImage: | ||
url: /assets/blog/hex-flower-engine/hex-flower.gif | ||
date: 2020-07-11 | ||
ctas: | ||
- label: "Run the Engine" | ||
url: "https://dvdagames.github.io/react-hex-flower-engine/" | ||
price: "FREE" | ||
--- | ||
The [Hex Flower Engine](https://goblinshenchman.wordpress.com/2018/10/25/2d6-hex-power-flower/) is an ingenious invention from [Goblin's Henchman](https://goblinshenchman.wordpress.com/) that gives Game Masters (GMs) and Dungeon Masters (DMs) a way to generate random results that are more predictable and feel more realistic than a simple table or a single die roll. | ||
|
||
> A versatile game engine using 2D6 and a 19-Hex Flower (it’s like a random table, but with a memory). | ||
It relies on rolling `2d6` (two six-sided dice) and using the results to decide which direction to move in a grid of 19 hexagons laid out in an even larger hexagon. | ||
|
||
[Goblin's Henchman has written way more than I ever could describing the various use cases for and ideas behind the engine](https://goblinshenchman.wordpress.com/category/hex-flower/), so I'll leave that to them. | ||
|
||
This particular implementation of their ideas is a simple React-based web application hosted on GitHub Pages. The code is entirely open source, so you can easily fork it to tweak to your liking, or submit an Issue or Pull Request for some feature you would like to see. | ||
|
||
This was selfishly created for my own use as a Tempest Cleric in a D&D campaign where I wanted to know if there was ever an existing storm that I could use to power up my Call Lightning spell. The DM generously created a version of the Hex Flower Engine for us to use, so I built the campaign an interactive digital version we could rely on each session. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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,43 @@ | ||
import { type CTA } from "@/interfaces/cta"; | ||
import Link from "next/link"; | ||
import CoverImage from "./cover-image"; | ||
import DateFormatter from "./date-formatter"; | ||
|
||
type Props = { | ||
title: string; | ||
coverImage: string; | ||
releaseDate: string; | ||
excerpt: string; | ||
slug: string; | ||
price: string; | ||
ctas: CTA[]; | ||
}; | ||
|
||
export function ProjectPreview({ title, coverImage, releaseDate, excerpt, slug, price, ctas }: Props) { | ||
return ( | ||
<div className="w-[33%]"> | ||
<h3 className="text-xl mb-3 leading-snug"> | ||
<Link as={`/projects/${slug}`} href="/projects/[slug]" className="hover:underline"> | ||
{title} | ||
</Link> | ||
</h3> | ||
<div className="mb-5"> | ||
<CoverImage slug={slug} title={title} src={coverImage} /> | ||
</div> | ||
<div className="text-lg mb-4"> | ||
<strong>Release Date:</strong> <DateFormatter dateString={releaseDate} /> | ||
</div> | ||
{typeof ctas !== "undefined" && ( | ||
<div className="mb-4"> | ||
{ctas.length > 0 && | ||
ctas.map((cta) => ( | ||
<a key={cta.label} href={cta.url} className="btn"> | ||
{cta.label} | ||
</a> | ||
))} | ||
</div> | ||
)} | ||
<p className="text-lg leading-relaxed mb-4">{excerpt}</p> | ||
</div> | ||
); | ||
} |
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
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 @@ | ||
import { Metadata } from "next"; | ||
import { notFound } from "next/navigation"; | ||
import { getAllProjects, getProjectBySlug } from "../../../lib/api"; | ||
import markdownToHtml from "../../../lib/markdownToHtml"; | ||
import Container from "../../_components/container"; | ||
import Header from "../../_components/header"; | ||
import { PostBody } from "../../_components/post-body"; | ||
import { GameHeader } from "../../_components/game-header"; | ||
|
||
export default async function Project({ params }: Params) { | ||
const project = getProjectBySlug(params.slug); | ||
|
||
if (!project) { | ||
return notFound(); | ||
} | ||
|
||
const content = await markdownToHtml(project.content || ""); | ||
|
||
return ( | ||
<main> | ||
<Container> | ||
<Header /> | ||
<article className="mb-32"> | ||
<GameHeader title={project.title} bannerImage={project.bannerImage} releaseDate={project.date} ctas={project.ctas} /> | ||
<PostBody content={content} /> | ||
</article> | ||
</Container> | ||
</main> | ||
); | ||
} | ||
|
||
type Params = { | ||
params: { | ||
slug: string; | ||
}; | ||
}; | ||
|
||
export function generateMetadata({ params }: Params): Metadata { | ||
const project = getProjectBySlug(params.slug); | ||
|
||
if (!project) { | ||
return notFound(); | ||
} | ||
|
||
const title = `${project.title} | DVDA Games`; | ||
|
||
return { | ||
openGraph: { | ||
title, | ||
images: [project.ogImage.url], | ||
}, | ||
}; | ||
} | ||
|
||
export async function generateStaticParams() { | ||
const projects = getAllProjects(); | ||
|
||
return projects.map((project) => ({ | ||
slug: project.slug, | ||
})); | ||
} |
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,63 @@ | ||
import { Metadata } from "next"; | ||
import { notFound } from "next/navigation"; | ||
import { getAllProjects } from "../../lib/api"; | ||
import Container from "../_components/container"; | ||
import Header from "../_components/header"; | ||
import { ProjectPreview } from "../_components/project-preview"; | ||
|
||
export default async function Projects() { | ||
const projects = getAllProjects(); | ||
|
||
if (!projects) { | ||
return notFound(); | ||
} | ||
|
||
return ( | ||
<main> | ||
<Container> | ||
<Header /> | ||
<h1 className="text-2xl md:text-3xl lg:text-4xl font-bold tracking-tighter leading-tight mb-[20px]">Our Projects</h1> | ||
<p className="text-md mb-[10px]">Some open-source tools we've created for you to use for free.</p> | ||
<article className="mb-32"> | ||
{projects.map((project) => ( | ||
<ProjectPreview | ||
key={project.slug} | ||
title={project.title} | ||
coverImage={project.coverImage} | ||
releaseDate={project.date} | ||
ctas={project.ctas} | ||
excerpt={project.excerpt} | ||
slug={project.slug} | ||
price={project.price} | ||
/> | ||
))} | ||
</article> | ||
</Container> | ||
</main> | ||
); | ||
} | ||
|
||
export function generateMetadata(): Metadata { | ||
const projects = getAllProjects(); | ||
|
||
if (!projects) { | ||
return notFound(); | ||
} | ||
|
||
const title = `Our Projects | DVDA Games`; | ||
|
||
return { | ||
openGraph: { | ||
title, | ||
images: projects.map((project) => project.ogImage.url), | ||
}, | ||
}; | ||
} | ||
|
||
export async function generateStaticParams() { | ||
const projects = getAllProjects(); | ||
|
||
return projects.map((project) => ({ | ||
slug: project.slug, | ||
})); | ||
} |
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,7 @@ | ||
import type { Game } from "./game"; | ||
import type { Post } from "./post"; | ||
import type { Project } from "./project"; | ||
|
||
export type ContentType = "post" | "game" | "project"; | ||
|
||
export type Content = Post | Game | Project; |
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,4 @@ | ||
export type CTA = { | ||
label: string; | ||
url: string; | ||
}; |
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 |
---|---|---|
|
@@ -13,4 +13,5 @@ export type Post = { | |
content: string; | ||
preview?: boolean; | ||
featured?: boolean; | ||
archived?: boolean; | ||
}; |
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,19 @@ | ||
import type { CTA } from "./cta"; | ||
|
||
export type Project = { | ||
slug: string; | ||
title: string; | ||
url: string; | ||
date: string; | ||
price: string; | ||
coverImage: string; | ||
bannerImage: string; | ||
excerpt: string; | ||
ogImage: { | ||
url: string; | ||
}; | ||
ctas: CTA[]; | ||
content: string; | ||
featured?: boolean; | ||
archived?: boolean; | ||
}; |
Oops, something went wrong.