Skip to content

Commit adfb5a3

Browse files
authored
Update README.md -- NEAR AI Integration
1 parent 73c23f3 commit adfb5a3

1 file changed

Lines changed: 216 additions & 0 deletions

File tree

README.md

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,222 @@ An innovative Web3 gaming platform where AI-powered warrior NFTs battle autonomo
1010
We are building the game on Flow chain because of its speed, We store each and every micro details of transactions and every game states on chain, and to make this possible for our game we need a very fast chain.
1111
Also one of other major reason is the VRF service that flow provides natively. Unlike other oracles, which generates random number in like 40-60 seconds, Flow does the same in 1-2 seconds. Since our main battle mechanies depends or VRF (hit/miss), we had to generate a random number 2 times in a single round = 10 minutes in a single battle, which obviously makes other oracles useless.
1212

13+
## NEAR Integration
14+
1. First, we are using, attributes generator event, [Link](https://app.near.ai/agents/samkitsoni.near/attributes-generator/latest). We can desicribe any personality or just name a famous frictional/non-frictional personality to this agent and it will generate the personality attributes in the required format. For example, intents can be passed like:
15+
```json
16+
#input
17+
Jeff Bezoz
18+
19+
#output
20+
{
21+
"name": "Jeff Bezos",
22+
"bio": "Founder, CEO, and Chairman of Amazon, the world's largest online retailer.",
23+
"life_history": "Born in 1964 in Albuquerque, New Mexico. Graduated valedictorian from Princeton University, worked at Wall Street, and later founded Amazon in 1994 in his garage. Led Amazon's exponential growth and expansion into various industries, including cloud computing, advertising, and media production.",
24+
"adjectives": [
25+
"Ambitious",
26+
"Visionary",
27+
"Analytical",
28+
"Competitive",
29+
"Frugal"
30+
],
31+
"knowledge_areas": [
32+
"Computer Science",
33+
"E-commerce",
34+
"Marketing",
35+
"Operations Management",
36+
"Investment and Finance"
37+
]
38+
}
39+
```
40+
41+
2. Second AI agent is the tratis-generator, [Link](https://app.near.ai/agents/samkitsoni.near/traits-generator/latest). This agent analyses all those personality attributes generated by the above agent, and converts them into the in-game characterstics traits i.e. strength, wit, charisma, defence and luck. Following is how the intent is passed in the agent for the desired output:
42+
```json
43+
# input
44+
{
45+
"name": "Elon Reeve Musk",
46+
"bio": "Entrepreneur, inventor, and business magnate",
47+
"life_history": "Born in Pretoria, South Africa, Musk moved to Canada in 1992 and later to the United States to attend college. He co-founded PayPal, SpaceX, Tesla, Neuralink, and The Boring Company, and has become a pioneer in the electric car and private space exploration industries.",
48+
"adjectives": [
49+
"Visionary",
50+
"Ambitious",
51+
"Perfectionistic",
52+
"Risk-taking",
53+
"Intellectually curious"
54+
],
55+
"knowledge_areas": [
56+
"Renewable energy",
57+
"Space exploration",
58+
"Electric vehicles",
59+
"Artificial intelligence",
60+
"Entrepreneurship"
61+
  ]
62+
}
63+
64+
# output
65+
{
66+
"Strength": 8000,
67+
"Wit": 9500,
68+
"Charisma": 8500,
69+
"Defence": 7000,
70+
"Luck": 6000,
71+
"strike_attack": "Galactic Smackdown",
72+
"taunt_attack": "Musk's Mind Games",
73+
"dodge": "Ludicrous Speed",
74+
"recover": "Recharge at the Supercharger",
75+
"special_move": "Neuralink Overdrive"
76+
}
77+
```
78+
79+
3. Third agent is the psychological questions analyser, [Link](https://app.near.ai/agents/samkitsoni.near/psychological-answer-analyzer/latest). This agents is used in the Gurukul, this takes intent which included current in-game traits, the 5 questions that were alloted to the user, available options and the options user selected. This agent analysis the NFT's current traits and the question/answers and then updates the traits accordingly:
80+
```json
81+
# input
82+
{
83+
"stats": {
84+
"Strength": 8231,
85+
"Wit": 9471,
86+
"Charisma": 5932,
87+
"Defence": 7519,
88+
"Luck": 4211
89+
},
90+
"questions": [
91+
{
92+
"question": "Your mother and your child are both drowning, but you can only save one. Who do you save?",
93+
"options": [
94+
{ "id": 0, "text": "My mother — she gave me life" },
95+
{ "id": 1, "text": "My child — they represent the future" },
96+
{ "id": 2, "text": "I’d try to save both, even if it risks losing both" },
97+
{ "id": 3, "text": "I wouldn’t be able to decide — I’d freeze" }
98+
],
99+
"answered": 2
100+
},
101+
{
102+
"question": "You find a wallet with $10,000 and the ID of the owner inside. What do you do?",
103+
"options": [
104+
{ "id": 0, "text": "Return it with all the money untouched" },
105+
{ "id": 1, "text": "Keep some of the money, then return it" },
106+
{ "id": 2, "text": "Keep it all — finders keepers" },
107+
{ "id": 3, "text": "Try to contact the owner anonymously and decide after hearing their story" }
108+
],
109+
"answered": 3
110+
},
111+
{
112+
"question": "A train is heading toward five people tied to a track. You can pull a lever to divert it, but it will hit one person on another track. What do you do?",
113+
"options": [
114+
{ "id": 0, "text": "Pull the lever — save the greater number" },
115+
{ "id": 1, "text": "Do nothing — I won’t actively cause a death" },
116+
{ "id": 2, "text": "Try to stop the train — even if unlikely" },
117+
{ "id": 3, "text": "Refuse to decide — it’s not my responsibility" }
118+
],
119+
"answered": 0
120+
},
121+
{
122+
"question": "You're in a room with a bomb. You can escape, but doing so ensures it explodes and harms many. What do you do?",
123+
"options": [
124+
{ "id": 0, "text": "Try to defuse it, even if I die" },
125+
{ "id": 1, "text": "Escape and warn others" },
126+
{ "id": 2, "text": "Use someone else’s help — delegate the risk" },
127+
{ "id": 3, "text": "Attempt a clever distraction to save everyone" }
128+
],
129+
"answered": 3
130+
},
131+
{
132+
"question": "You find a locked chest in the forest. There’s a sign: “One who opens this will lose something valuable.” What do you do?",
133+
"options": [
134+
{ "id": 0, "text": "Open it — no risk, no reward" },
135+
{ "id": 1, "text": "Walk away — it’s not worth it" },
136+
{ "id": 2, "text": "Try to open it with precautions" },
137+
{ "id": 3, "text": "Let someone else open it first" }
138+
],
139+
"answered": 2
140+
}
141+
]
142+
}
143+
144+
#output
145+
{
146+
"stats": {
147+
"Strength": 9200,
148+
"Wit": 9821,
149+
"Charisma": 8321,
150+
"Defence": 8621,
151+
"Luck": 6012
152+
}
153+
}
154+
```
155+
156+
4. This is the most important one, the move-choser, [Link](https://app.near.ai/agents/samkitsoni.near/move_choser/latest). During the battle, at the start of each round, this agent is leveraged. All the states of battles(current round and damage inflicted to each yodhas), in-game traits and the personlity attributes of both the yodhas in that kurukshetra is passed to this agent. Then this agents personate each of those NFT's according to their traits and attributes and then generates the best possible move for each one for the next round.
157+
```json
158+
#input
159+
{
160+
"current_round": 2,
161+
"agent_1": {
162+
"personality": {
163+
"adjectives": [
164+
"Innovative",
165+
"Resilient",
166+
"Methodical",
167+
"Inquisitive",
168+
"Bold"
169+
],
170+
"knowledge_areas": [
171+
"Cognitive science",
172+
"Augmented reality",
173+
"Climate modeling",
174+
"Blockchain architecture",
175+
"Human-computer interaction"
176+
]
177+
},
178+
"traits": {
179+
"Strength": 7700,
180+
"Wit": 9100,
181+
"Charisma": 8900,
182+
"Defence": 7400,
183+
"Luck": 6100
184+
},
185+
"total_damage_received": 38
186+
},
187+
"agent_2": {
188+
"personality": {
189+
"adjectives": [
190+
"Logical",
191+
"Steady",
192+
"Strategic",
193+
"Adaptable",
194+
"Observant"
195+
],
196+
"knowledge_areas": [
197+
"Behavioral economics",
198+
"Neural networks",
199+
"Synthetic biology",
200+
"Virtual reality",
201+
"Ethics of AI"
202+
]
203+
},
204+
"traits": {
205+
"Strength": 7600,
206+
"Wit": 9400,
207+
"Charisma": 8600,
208+
"Defence": 7300,
209+
"Luck": 6400
210+
},
211+
"total_damage_received": 41
212+
},
213+
"moveset": [
214+
"strike",
215+
"taunt",
216+
"dodge",
217+
"recover",
218+
"special_move"
219+
]
220+
}
221+
222+
#output
223+
Assistant: {
224+
"agent_1": "dodge",
225+
"agent_2": "recover"
226+
}
227+
```
228+
13229

14230
## Experience Rann
15231

0 commit comments

Comments
 (0)