Some ideas on how magic in videogames work.
blog.knolif.com