League of legends counters and builds
We are going to develop a case study base on the videogame League of Legends. League of Legends is a MOBA, (acronym of: Multiplayer Online Battle Arena), where players fight each other using unique characters called champions. In this game it’s really important to select the right champion to fight against the particular enemy you will find, and buy the best 'weapons' to have more chances to win the game; our Model is planned to easily get usefull inforthis usefull informations that will help a player before starting a game. The weapons are called ITEMS, we’ve created them as nodes, a group of weapons bought from a player on a champion are called BUILD, them are nodes too. A champion that’s weak against another champion is COUNTERED by that champion, so we say he HAS_COUNTER, we save this as a relation.
MATCH (n)
RETURN n
So, you are ready to chose your champion, the enemy has picked Xerath, the magus ascendant; and you’re in problem, what to do?
Ask NEO4J!
"Magic mirror in my hand, who is the fairest in the land?"
no wait… "neo, give me top 3 level 1 xerath counters"
MATCH (enemy:Champion)-[c:HAS_COUNTER]->(pick:Champion)
WHERE c.level = 1 AND enemy.name = 'Xerath'
RETURN pick.name as Pick
LIMIT 3
Those are all top three level 1 counters of xerath
(levels reflect the relevance of the HAS_COUNTER relation)
"I like to play Fizz"
wich spells should I take?
neo give me the top 2 used spells for fizz
MATCH (myPick:Champion)-[c:HAS_POPULAR_SPELL]->(spell:Spell)
WHERE myPick.name = 'Fizz'
RETURN spell.name as Spell
LIMIT 2
Now I’m playing Fizz, but I don’t know what are the best items I could buy?
This time I know that "Faker", one of best League of Legends player, had surely played this champion, so try with a specific query: "Neo give me items bought in the most recent build faker has done for Fizz" (we have saved the build name as DateTIMESTAMP, this way we can order by name and get the most recent one. It should be done by software, to get the most recent items by Cypher we added the milleseconds date as a property of the build too)
MATCH (myPick:Champion)-[c:HAS_BUILD]->(build:ChampionBuild)-[:HAS_ITEM]->(item:Item),(build:ChampionBuild)-[:DONE_BY]->(p:Player)
WHERE myPick.name = 'Fizz' AND p.name = 'Faker'
WITH max(build.milliseconds) AS maxDate
MATCH (myPick:Champion)-[c:HAS_BUILD]->(build:ChampionBuild)-[:HAS_ITEM]->(item:Item),(build:ChampionBuild)-[:DONE_BY]->(p:Player)
WHERE myPick.name = 'Fizz' AND p.name = 'Faker' AND build.milliseconds = maxDate
RETURN item.name AS item
Statistic information
Get all the champions played by 'xPeke'
MATCH (champions:Champion)-[c:HAS_BUILD]->(build:ChampionBuild)-[:DONE_BY]->(p:Player)
WHERE p.name = 'xPeke'
RETURN DISTINCT champions.name as ChampionName
Get the most popular spell above all champions
MATCH (champions:Champion)-[c:HAS_POPULAR_SPELL]->(spell:Spell)
RETURN spell.name as SpellName, count(spell.name) AS SpellCount
ORDER BY SpellCount DESC
LIMIT 1
Get the most used spell in all builds of the champion 'Fizz'
MATCH (champions:Champion)-[c:HAS_BUILD]->(build:ChampionBuild)-[:HAS_SPELL]->(spell:Spell)
WHERE champions.name = 'Fizz'
RETURN spell.name AS SpellName, count(spell.name) AS SpellCount
ORDER BY SpellCount DESC
LIMIT 1
Is this page helpful?