The go language version developed based on hashlips_art_engine. Added and deleted some functions

golips_art_engine

The inspiration for this tool is based on HashLips Art Engine.

Our official links

🐦 Twitter

💄 Discord

💄 NFT

Why building a new tool?

JS is very general, but there are still some dependency problems (especially canvas-related libraries), we believe many people will face the same problems as we do.

Also, when making our own NFT project, we also encountered many new requirements, some of which can be achieved by modifying the existing code, but some are difficult to achieve.

So in the end, we decided to rewrite a tool in a language we were familiar with.

And our goal is: efficient and sustainable use (only use official libraries).

Feature Differences

Unsupported

  • canvas blend mode
    • If canvas blend mode is necessary for your project, please keep using HashLips Art Engine
    • It takes 50 seconds for a single thread to generate 100 images, but it can be shortened to 20 seconds after multi-threading is enabled. (Complete test on our computer)
  • SOL metadata (Supported in v0.0.2)
  • static background
  • extra metadata (Supported in v0.0.2)
  • pixel or gif output

New

  • Multi-threaded generation
    • Spawns 50% faster on our computer compare to single thread
  • Colorsets for multi-component color combinations
  • Limited component collocation
    • for example: this hair may only appears on that head
  • Conflict elements (v0.0.3)
    • for example: this necklace will not match this dress
  • Set start id
  • Set custom 'none' property name
  • More metadata output options
    • show 'none' property or not, show dna or not, etc.
  • Save and load DNA history (coming soon)
  • Numerical attributes generation (coming soon)

Conflict Elements

For example, let's assume layer A is rendered before layer B, and there is an element named cloth1 in layer A, which is conflict with the element named necklace1 in layer B, before this, maybe you need to manually check these conditions, but now, you can directly add the following settings to config.json to achieve this goal:

When the random algorithm selects cloth1 in layer A, necklace1 in layer B will be ignored directly, instead, it will select one of the other elements.

Also, if cloth1 is also conflict with necklace2, you can change the line to below style:

"cloth1": "necklace1,necklace2"

i.e.: you can use commas , to connect multiple upper-level elements that conflict with the same underlying element

Note: you should always use the name of the underlying element as the key

Installation

Use Release

Put the file of the your operating system to the folder to generate the image, and ensure that the directory of the file contains the following structure

- Your folder
  - golips_art_engine_XXX (The executable file corresponding to your computer system)
  - conf/config.json (Configuration file, create a 'conf' folder and put the 'config.json' file in it)
  - layers/your_layers_for_generating (Your layer files)

Examples of conf and layers folders you can find in this project

After making sure that the config file and layer files have been configured, go into the folder and run golips_art_engine_XXX

Code

Please make sure to install the official environment of the go language. (>= go 1.16) Official Go: https://go.dev

Then run:

git clone https://github.com/LipConqueror/golips_art_engine.git

Enter the folder you just cloned, then run:

go run .

And DONE! Like mentioned above, this tool relay on no third-party library, so you don't need to do anything else. You can find your NFT and metadata files in builds

Config

You can find config.json in golips_art_engine/conf/, which decided how the NFT series will be generated. And here are some descriptions about some fields in config.json

fields description
dnaSettings.startId what the first nft's id will be
metadataSettings.saveDnaInMetadata save dna in metadata or not
metadataSettings.showNoneInMetadata save none attribute in metadata or not
metadataSettings.noneAttributeName specify your own 'none' file name
processCount how many threads used to generate at the same time, Recommended 2 ~ 3
layersOrder.options.hideInMetadata hide this layer from metadata
layersOrder.options.colorSet which colorset should this layer belong
layersOrder.options.isColorBase if set to 'true', colors will come from this layer for that colorset

Hope you create some awesome artworks with this code 💄

中文

本工具的灵感与基础来源于 HashLips Art Engine.

我们的官方链接

🐦 Twitter

💄 Discord

💄 NFT

为什么要打造一个新的工具?

JS 非常通用, 但仍然会有一些依赖方面的问题(尤其是涉及到canvas相关库的安装与使用时), 我们相信很多人面临着和我们一样的问题。

同时,在制作我们自己的NFT项目时,我们也遇到了许多的新的需求,其中一些可以通过修改已有的代码来解决,但也有一些很难实现。

所以最终,我们决定用我们熟悉的语言(Go)来重写整个工具。

并且我们的目标是:高效且持续可用(通过只使用官方库来实现)。

功能差异

不支持

  • canvas blend mode
    • 如果canvas blend mode对你项目来说是必须的,那么请继续使用HashLips Art Engine
  • SOL metadata (v0.0.2已支持)
  • 静态背景
  • 额外的metadata (v0.0.2已支持)
  • 像素化和生成动图

新增

  • 多线程生成
    • 生成速度在我们的电脑上提高了50%以上,对比单线程生成
    • 同样生成100张图片,单线程需要50秒,开启多线程后可以缩短到20秒(在我们的电脑上完成测试)
  • 色彩集合-跨组件/层级的多组件/层级颜色统一方案
  • 限定组件搭配
    • 举个 🌰 :只有这个头型能顶那个特殊发型
  • 冲突元素(v0.0.3)
    • 举个 🌰 :当穿了这件衣服,就不能搭配那条项链了
  • 设定起始ID
  • 设置自定义的‘空’组件名称
  • 更多元数据自定义选项
    • 是否展示‘空’组件, 是否展示DNA, 等等
  • 保存和读取DNA历史 (即将到来)
  • 数值属性生成 (即将到来)

冲突元素

举个例子,我们假设layer A会在layer B之前渲染,在layer A中呢,有一个元素叫cloth1,但这个元素与layer B中的元素necklace1冲突了,在这之前,也许你需要手动检查找出这种情况,但现在,你可以直接在config.json加入如下配置来实现这个效果:

当随机算法在layer A中选择了cloth1之后,算法将直接无视layer B中的necklace1元素,而从其他元素中选择一个。

同时,如果cloth1同时还与necklace2冲突,那么你可以修改这一行代码为如下的形式:

"cloth1": "necklace1,necklace2"

即:你可以使用英文逗号,来连接与同一个底层元素冲突的多个上层元素

注意:应该永远用底层元素的名称作为key来使用

安装使用

使用可执行文件(Release)

将对应系统的可执行文件放到要生成图片的文件夹下,并确保文件的目录包含以下结构

- 你的文件夹
  - golips_art_engine_XXX(对应你电脑系统的可执行文件)
  - conf/config.json (配置文件,创建一个conf文件夹,再将config.json文件放入其中)
  - layers/your_layers_for_generating (你的图层文件们)

关于conflayers文件夹的示例,你都可以在本项目中找到

在确保配置文件和图层文件都已经配置完毕后,进入文件夹,运行golips_art_engine_XXX

代码

请先确保你已经安装了官方的go语言环境。(>= go 1.16)

官方Go: https://go.dev

然后运行:

git clone https://github.com/LipConqueror/golips_art_engine.git

进入你刚刚clone的文件夹, 然后运行:

go run .

然后就没了!

就像我们上面提到的那样,这个工具完全没有依赖任何第三方库,所以你不需要再做任何其他的事情。

你可以在builds文件夹中找到NFT和元数据。

配置文件

你可以在golips_art_engine/conf/文件夹下找到config.json,其中包含了所有生成NFT的相关配置。

下面是config.json中的一些属性及其解释

字段 解释
dnaSettings.startId 生成的NFT的起始ID
metadataSettings.saveDnaInMetadata 是否要在元数据中保存DNA
metadataSettings.showNoneInMetadata 是否要在元数据中保存属性为‘空’的图层
metadataSettings.noneAttributeName 设定你自己的‘空’属性名
processCount 同时进行生成的线程数,推荐是2~3
layersOrder.options.hideInMetadata 是否在元数据中隐藏这一图层
layersOrder.options.colorSet 这一图层属于哪个色彩集合
layersOrder.options.isColorBase 如果这个字段为'true', 那么这个色彩集合的颜色名,将出自此图层

希望大家可以用我们的工具创造出更多优秀的作品! 💄

也希望国产项目能更多得走向世界!

Similar Resources

About An instrumented microservice in Go - it'll give you some Honeycomb data to play with.

Intro to Observability: OpenTelemetry in Go This application is here for you to try out tracing. It consists of a microservice that calls itself, so y

Dec 5, 2022

The repository intent is store some Go Lang codes.

⚠️ Go programming course ⚠️ This repository was created to share the Learn How To Code: Google's Go (golang) Programming Language code created by Todd

Jan 16, 2022

Mastering-go-exercises - Some code examples from Mihalis Tsoukalos book titled Mastering GO

Mastering go exercises This is a training repository. Here are some code example

Feb 16, 2022

This tutorial walks you through using the Cloud Functions minimal instances feature to mitigate cold starts.

This tutorial walks you through using the Cloud Functions minimal instances feature to mitigate cold starts.

Tutorial This tutorial walks you through using the Cloud Functions minimal instances feature to mitigate cold starts. Let’s take a deeper look at min

Jun 1, 2022

A complete guide to undersatnd golang programming language, web requests, JSON and creating web APIs with mongodb

Golang series A complete guide to undersatnd golang programming language, web requests, JSON and creating web APIs with mongodb LearnCodeonline.in 01

Jan 1, 2023

Tutorial and sample codes for Go language

Tutorial and sample codes for Go language

Jan 4, 2022

Go programming language secure coding practices guide

You can download this book in the following formats: PDF, Mobi and ePub. Introduction Go Language - Web Application Secure Coding Practices is a guide

Jan 9, 2023

The Little Go Book is a free introduction to Google's Go programming language

The Little Go Book is a free introduction to Google's Go programming language

The Little Go Book is a free introduction to Google's Go programming language. It's aimed at developers who might not be quite comfortable with the idea of pointers and static typing. It's longer than the other Little books, but hopefully still captures that little feeling.

Jan 2, 2023

Crash Course about the programming language Go / Golang.

Crash Course about the programming language Go / Golang.

Crash Course about the programming language Go / Golang. In this course I have covered some important concepts and topics in programming.

Oct 10, 2022
Comments
  • Generating Duplicates

    Generating Duplicates

    Hello,

    First of all, good job on the code! I'm having issues using your generator - it generates duplicates. I checked the metadata and DNA is the same for the duplicates. I'm using lots of traits for conflicts - I'm not sure if this could be the issue. I actually thought it might be because I was using multiple processes/threads, but I get duplicates even with only 1 process.

    Am I missing a setting somewhere?

Practice codes developed while practicing Go

Getting started with Go Programming Language - Oreilly Course Practice codes developed while practicing Go. This is my first encounter with Go Program

Oct 3, 2021
A repository for showcasing my knowledge of the Google Go (2009) programming language, and continuing to learn the language.

Learning Google Golang (programming language) Not to be confused with the Go! programming language by Francis McCabe I don't know very much about the

Nov 6, 2022
A repository for showcasing my knowledge of the Go! (2003) programming language, and continuing to learn the language.
A repository for showcasing my knowledge of the Go! (2003) programming language, and continuing to learn the language.

Learning Go! (programming language) Not to be confused with Google Golang (2009) I don't know too much about the Go! programming language, but I know

Oct 22, 2022
Q Language : A script language for Go
Q Language : A script language for Go

Q Language - A script language for Go 语言特色 与 Go 语言有最好的互操作性。可不进行任何包装即可直接使用 Go 语言的函数、类及其成员变量和方法。 有赖于 Go 语言的互操作性,这门语言直接拥有了一套非常完整且您十分熟悉的标准库,无额外学习成本。 与 Go

Sep 5, 2022
I will be uploading some basic programming in Golang so if you want to contribute please Fork this repo and contriute.
I will be uploading some basic programming in Golang so if you want to contribute please Fork this repo and contriute.

Go-language I will be uploading some basic programming in Golang so if you want to contribute please Fork this repo and contriute. This repo is for pr

Jan 21, 2022
This is a brief tutorial I created for a couple friends to show how to do some stuff in go and ethereum. Feel free to do any PRs with suggestions

golang-tutorial This is a brief tutorial I created for a couple friends to show how to do some stuff in Go and Ethereum. Milestones Create the environ

Aug 29, 2022
Markdown version of Reverse Engineering the source code of the BioNTech/Pfizer SARS-CoV-2 Vaccine

The big BNT162b2 archive All vaccine data here is sourced from this World Health Organization document. This describes the RNA contents of the BNT162b

Dec 2, 2022
Axon (spiking) version of the sims

Computational Cognitive Neuroscience Simulations This repository contains the neural network simulation models for the CCN Textbook, managed on a GitH

Jan 18, 2022
A basic module for understanding functions, error handling, arrays, maps, unit testing, and compiling

Learning Go Basics Concepts A basic module for understanding functions, error handling, arrays, maps, unit testing, and compiling go mod init download

Dec 15, 2021
Binaryscarf generates double-knitting patterns for some corpus of input text.

binaryscarf binaryscarf generates double-knit patterns for some corpus of input text. The layout follows the same style as described here. Output is s

Dec 31, 2022