Intelligent Emotes from Text: Module/Animation Library [Open Source]

This is an algorithm designed to find the best emote given the input text from the library of emotes.
The code is a module that you require, fire the function with a string and temperature, and it returns an animation if any from the library.
Model/Animation Library: IntelligentEmotes - Creator Store (roblox.com)

Bulk Animation Importer --Needed to Import all the animations in the library

Alternatively, you can implement this module to load animations without importing them all.
Custom LoadAnimation (Load any Animation) - Resources / Community Resources - Developer Forum | Roblox

Demonstration

–Code

local AnimationEngine = {}
local AnimationLibrary=script.AnimationsLibrary:GetChildren()
local SearchArray={}


local function splitString(str)
	local words = {}
	--  str=cm.Duplicates(str)
	-- print(str)
	if str~=nil then	
		if str:gmatch("%w+") then
			for word in str:gmatch("%w+") do
				word=word:lower() 
				table.insert(words, word)                      			                              
			end                
		end
	end    
	if #words==0 then 
		return {str} 
	end			
	return words		
end	

for i,v in AnimationLibrary do
	SearchArray[v]={splitString(v.Value.Value),math.random(75,125)/100}--assign random weight to each animation 
end

--local RunService=game:GetService("RunService")
--local isLocal = RunService:IsClient()
--local proccessor=nil
--if isLocal then
--	proccessor=game.Players.LocalPlayer.PlayerGui:WaitForChild("Chatbot"):WaitForChild("LocalProcessor")
--else 
--	proccessor=game.ReplicatedStorage.GlobalSpells.BindableFunction
--end
function AnimationEngine.Emotes(str,temperature)
	--local synoms
	local words=splitString(str)
	--if proccessor  then
	--local synoms=--proccessor:Invoke("GetSynomArray",{words,true,false})
--	end	
	local count=0
	local match=nil
	local maximum=#words
	local threshold=1/temperature
	local noise=.1*temperature
	local address=nil
	if threshold>0 then
		--for y,wordsg in synoms do --words of the npc
			local rew=1	
		--	if string.find(y:lower(),"antonym") then
			--	rew=-.5
		--	end
		for r,f in words do--for r,f in wordsg[1] do --words of the npc
			for i,v in SearchArray do 
				local c=0
				for t,o in v[1] do
					if string.find(f,o) then
							c+=rew+(noise*(math.random(75,100)/100*v[2]))
							break -- only one match per synom group
					end		
				end
				if c>count and c>threshold then
					count=c
					match=i
					address=i
				end
		end
			end
	--	end
	end
	if address~=nil then
		SearchArray[address][2]=SearchArray[address][2]/1.2--adjust the weights to reduce chance of repetition 
	--guess it can learn the least used animation	
	end	
	return address -- return the animation object
end
--local iemotes=require(game.ServerScriptService.DeterminantAI.IntelligentEmotes)
return AnimationEngine

Backported from my most recent version.

Understanding Emotes: A Labeled Dataset Exploration

Introduction

Emotes play a crucial role in creating engaging and interactive experiences for players in Roblox games. As a developer, you want to provide a wide range of expressive animations that resonate with your audience. In this post, we’ll delve into an exciting dataset called “IntelligentEmotes,” which contains labeled emotes based on specific words or phrases.

The IntelligentEmotes Dataset

  1. Source: The IntelligentEmotes dataset is available in the Roblox Creator Store. It’s a treasure trove of character animations that can enhance your game’s emotional depth.
  2. Bulk Animation Importer: To make the most of this dataset, you’ll need the “Bulk Animation Importer.” This tool allows you to efficiently import all the animations from the library. You can configure it here.
  3. Randomly Weighted Animations: Each animation in the library has a random weight assigned to it. These weights influence the selection process when matching input text to emotes. The higher the weight, the more likely an animation will be chosen.

How the Algorithm Works

The heart of this system is the AnimationEngine. Let’s break down its functionality:

  1. Input Text Processing:
  • The algorithm takes input text (such as chat messages) and splits it into individual words.
  • It converts all words to lowercase for consistency.
  1. Matching Process:
  • For each word in the input, the algorithm searches the AnimationLibrary.
  • The SearchArray contains pairs of animation names and their associated split words.
  • A threshold (based on temperature) determines how closely a word must match to trigger an animation.
  • Noise (controlled by temperature) introduces randomness to the selection process.
  1. Selecting the Best Emote:
  • The algorithm accumulates weights for matching animations.
  • If the accumulated weight surpasses the threshold, the corresponding animation becomes a candidate.
  • The final emote is chosen from the candidates.

Conclusion

By leveraging the IntelligentEmotes dataset and the AnimationEngine, you can create dynamic and context-aware emotes for your Roblox game. Experiment with different thresholds and noise levels to fine-tune the system and provide an immersive experience for your players!

3 Likes

This is really nice, good job on this! But, sorry to say, but, this does NOT seem intelligent at all!


Why briefcase icon?

image
Milk bottle?

And a few more, some are indeed quite good but some are just, weird. Isn’t it also better to just use the emojis directtly in text? This seems to be a pre programmed conversattion so technically a developer would already use the needed emojis won’t they?

2 Likes

its not a pre programmed conversation it’s text generation api from zephyr 7b. I have it set up so a local chatbot handles short form queries, recognizes commands, math, search queries and or it uses ChatGPT-4 with a heavy arsenal of tools.

Uh huh? That seems cool but the emotes from text is just a bit too weird and not really accurate.

The video is not recent I might add. It’s from an earlier version. Which had no keywords in the dataset and was just matching the emoji directly. I thought it was good enough to share as a demonstration. It’s completely interpretable and any issues can be patched. But this post is about the Emotes System so if you have questions about the Emojis their’s a seperate thread for that too. :slight_smile:
The Emotes dataset was hand written with no AI because it was visual interpretation.

If it’s not recent then you should provide a recent video now shouldn’t you?

Either way I figured this would be pretty cool to share, you can pick it apart but I like it a lot and it works wonders for me. It’s a bit of a hassle to import all the animations so whoever does it deserves the prize. :slight_smile:
The method can be applied to other animations and tuned to your specifications. at it’s simplest you could not have a bag of words for a certain emote and just use trigger words like a library.

This is optimized by pre measuring certain things and can be optimized further by baking the data formatting output.

I see, cool. I noticed one thing that the “Bulk Animation Importer” link leads to the configure page for it which ultimately leads to access denied.

1 Like

Thanks for pointing that out! I have fixed the link.

You can now skip the importing process and implement this module instead to use this animation llibrary
Custom LoadAnimation (Load any Animation) - Resources / Community Resources - Developer Forum | Roblox

Introducing my a Template utilizing this module and the above LoadAnimation implementation to load the animations from this library for everyone to use!
Introducing my Demo demonstrating all these components of the Chatbot resources I open sourced all implemented into a neat and user friendly package! API endpoint is interchangeable with Zephyr 7b
Mistral 7b Chatbot Demo: Aware, Emojis, Emote, Memory, Music, Wiki, 32k Context [Open Sourced] Place file

1 Like