The Gene of Bitizens
1. Summary
The document is about the general idea of the architecture design of the Bitizens game, the detail logic is more complicated than what is documented here, and the actual logic will be somewhat different from what is documented here. For details and the acurate logic, please refer to the code.
2. Face
2.1. UI
2.2. Data Structure
The actual structure is far more complicated than what is demoed below, for details, please refer to the code in the project.
{
"GenePool": {
"Face": {
"00": "3DModel00",
"01": "3DModel01",
"02": "3DModel02"
},
"Eyes": {
"00": {
"Eye_L_1": { "PX": 0, "PY": 0, "PZ": 0 },
"Eye_R_1": { "PX": 0, "PY": 0, "PZ": 0 },
"Eye_L_2": { "PX": 0, "PY": 0, "PZ": 0 },
......
},
"01": {
},
"02": {
}
},
"Nose": {
"00": {
"Nose": { "SX": 0, "SY": 0, "SZ": 0 },
"Nose_1": { "SX": 0, "PY": 0, "PZ": 0 },
"Nose_2": { "SX": 0, "PY": 0, "PZ": 0 },
"Nose_3": { "SX": 0, "PY": 0, "PZ": 0 }
}
},
"Mouth": {
"00": {
"Mouth_L": { "PX": 0, "PY": 0, "PZ": 0 },
"Mouth_R": { "PX": 0, "PY": 0, "PZ": 0 },
"Mouth_T": { "SX": 0, "PY": 0, "PZ": 0 },
"Mouth_B": { "SX": 0, "PY": 0, "PZ": 0 }
}
},
"Eyebrow": {
"00": {
"Brow_L_1": { "PX": 0, "PY": 0, "PZ": 0 },
"Brow_R_1": { "PX": 0, "PY": 0, "PZ": 0 }
}
},
"Cheeks": {
"00": {
"Cheek_L_1": { "PX": 0, "PY": 0, "PZ": 0 },
"Cheek_R_1": { "PX": 0, "PY": 0, "PZ": 0 }
}
},
"Jaw": {
"00": {
"Jaw_L": { "PX": 0, "PY": 0, "PZ": 0 },
"Jaw_R": { "PX": 0, "PY": 0, "PZ": 0 }
}
},
"Chin": {
"00": {
"Chin": { "SX": 0, "PY": 0, "PZ": 0 }
}
},
"Brow": {
"00": {
"Brow_L_1": { "PX": 0, "PY": 0, "PZ": 0 },
"Brow_R_1": { "PX": 0, "PY": 0, "PZ": 0 }
}
}
}
}
2.3. Description
The data structure is in JSON format.
2.3.1. Face DNA
Each face part has a gene, which is a 2-digit number, so we have 100 possibilities for each part (Considering that we can have more than one 3D models, the number of possibilities for each face part is actually 100 x number of models). The whole DNA for an avatar face is a combination of each gene from each face part.
Face DNA is a 30-digit number, we may use the first say 18 digits for the moment, and the left 12 digits will be reserved for future extension. The last 12 digits that are not used should be placed with twelve 0s.
So the DNA for an avatar face may be like: 000201902214296466 + twelve 0s
Face00Eyes02Nose01Mouth90Eyebrow22Cheeks14Jaw29Chin64Brow66 + twelve 0s
2.3.2. Gene Pool
Our artists need to list out all the possible genes for each face part in a data file using the above structure.
On the UI, each gene for a face part is represented by an icon. We can name the image file of an icon to be “face part name plus a 2-digit”. For example: Nose99.jpg
"Nose_2": The name of a specific bone.
"PX", "PY", "PZ": XYZ values for each axis of the bone position.
"SX", "SY", "SZ": XYZ values for each axis of the bone scale.
2.3.3. Main Workflow
- Loading
○ User hasn’t created an avatar before
First we generate a random DNA number, then find the corresponding settings in our gene pool file. Finally we use the settings to update the UI and the avatar.
Note: Say we may have only 7 different types of noses as designed (even though 2 digits allow 100 possible options), and suppose that the 2 digits generated randomly for the nose gene are 83. To map 83 to a nose type, we do 83 % 7 = 6. So this avatar would have the 06 gene for the nose.
○ User has created an avatar before
First, we access Blockchain for the data of the current user, and then use the DNA number from Blockchain to find the corresponding settings in our gene pool file. Finally we use the settings to update the UI and the avatar.
- Customizing
When user click on a face part icon on the UI, first we find the icon name, say Nose09.jpg, then we strip out the gene number 09, finally we look up the gene pool file to find the 09 gene data, and use the data to update the corresponding bones in the face model.
- Save
Find out all the gene numbers for all face parts user has selected on the UI, then combine them to be a complete DNA and save it on Blockchain.
2.4. Whole DNA
The whole DNA of an avatar will be a 76-digit number, which consists of 4 parts: Face DNA, Body DNA, Skin DNA, Gender DNA.
DNA of an avatar will be stored on Blockchain.
2.4.1. Face DNA
Face DNA is a x-digit number.
2.4.2. Body DNA
Body DNA is a y-digit number.
2.4.3. Skin DNA
Skin DNA is a z-digit number.
2.4.4. Gender DNA
Gender DNA is represented by 1-digit. 0 represents female, 1 represents male.
3. MVC Pattern
The Gene of Bitizens的更多相关文章
- KEGG and Gene Ontology Mapping in Bioinformatic Method
使用KOBAS进行KEGG pathway和Gene Ontology分析 Article from Blog of Alfred-Feng http://blog.sina.com.cn/u/170 ...
- 合并基因表达水平(merge gene expression levels, FPKM)
使用tophat和cufflinks计算RNA-seq数据的表达水平时,当一个基因在一个样本中有多个表达水平时需要合并它们的表达水平. This code is a solution to colla ...
- augustus, gene prediction, trainning
做基因组注释 先用augustus训练,然后再用maker做基因注释 augustus提供一些训练好的,如果有和你的物种非常接近的,直接用提供的,没有的话再自己训练. 网址: http://bioin ...
- gene框架文档 - 路由类 gene_router
路由类 Gene\Router 介绍 Gene\Router 是gene框架的核心类之一,本框架区别于其他常见框架的最大地方就是独特.强大.简单的路由定义等.路由强大灵活,支持回调.类方法:支持res ...
- gene框架文档 - 概述
欢迎使用Gene框架 最新版本:V1.2.2 开源地址:https://github.com/sasou/php-gene 作者:sasou 文档地址:http://php-gene.com/doc ...
- Human Gene Functions
Human Gene Functions Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 18053 Accepted: 1004 ...
- POJ 1080 Human Gene Functions -- 动态规划(最长公共子序列)
题目地址:http://poj.org/problem?id=1080 Description It is well known that a human gene can be considered ...
- poj1080--Human Gene Functions(dp:LCS变形)
Human Gene Functions Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 17206 Accepted: ...
- 杭电20题 Human Gene Functions
Problem Description It is well known that a human gene can be considered as a sequence, consisting o ...
随机推荐
- 2018-10-13 21:30:51 conversion of number systems
2018-10-13 21:30:51 c language 二进制.八进制和十六进制: 1) 整数部分 十进制整数转换为 N 进制整数采用“除 N 取余,逆序排列”法. 十进制数字 36926 转 ...
- 【Java】多线程
class RunnableDemo implements Runnable { private Thread t; private String threadName; RunnableDemo( ...
- 动态修改JDBC数据源配置
因项目需要能动态修改数据源的配置,及修改后不用重启整个应用.使用的数据源是apache的BasicDataSource,网上千篇一律的是如下实现: BasicDataSource bds=getDat ...
- Entity Framework工具POCO Code First Generator的使用
在使用Entity Framework过程中,有时需要借助工具生成Code First的代码,而Entity Framework Reverse POCO Code First Generator是一 ...
- 程序员减少代码BUG的7种方法,拒绝编程5分钟,查代码2小时!
0.别对警告视而不见 相信不少的程序员会使用IDEA,使用它敲代码,有时候会出现警告,那么这时你对警告就不能视而不见了. 我们的目标是,写干净的代码,做风一样的男子! 1.编程习惯 种瓜得瓜种豆得豆, ...
- (1)网络编程的常识 (2)基于tcp协议的编程模型 (3)tcp协议和udp协议的比较 (4)基于udp协议的编程模型
1.网络编程的常识 目前主流的网络通讯软件有:微信.QQ.YY.陌陌.探探.飞信.阿里旺旺.... 在吗? 1.1 七层网络模型(熟悉) 为了保证数据传递的可靠安全等等,ISO(国际标准委员会组织)将 ...
- php中查询时间
在做查询过程中,例如要实现查上个月从第一天到最后一天的佣金(提成),那我们在程序实现过程中就要让程序在上个月的范围内查询,第一天是比较好办,但最后一天就不定,要去写段函数进行月份及年份判断来得出上个月 ...
- 第二次项目冲刺(Beta版本) 合集
小组成员 [组长]金盛昌(201421122043).刘文钊(20142112255).陈笑林(201421122042) 张俊逸(201421122044).陈志建(201421122040).陈金 ...
- [T-ARA][I'm so bad]
歌词来源:http://music.163.com/#/song?id=22704433 作曲 : 김태현 , 조영수 [作曲 : k/gim-Tae-hyeon , c/jo-yeong-su] 作 ...
- gp数据库停止
greenplum是2(master)+7(segment)的集群规模 系统刚准备上线,是用来做统计数据库的,正在帮忙一个hadoop集群核对其数据的准确性,在这个greenplum库中入了清单数据 ...