Example Projects
This section provides complete example projects using Casino of Life. Each example demonstrates different aspects of the framework and can serve as a starting point for your own projects.
Project 1: Basic Liu Kang Trainer
Create a basic agent that learns to play as Liu Kang with an aggressive style.
from casino_of_life.agents import DynamicAgent, CaballoLoko
from casino_of_life.environment import RetroEnv
from casino_of_life.reward_evaluators import BasicRewardEvaluator, SpecialMoveRewardEvaluator, MultiObjectiveRewardEvaluator
# Initialize environment
env = RetroEnv(
game='MortalKombatII-Genesis',
state='tournament',
players=2,
character='LiuKang'
)
# Create custom reward system
basic_rewards = BasicRewardEvaluator(
health_reward=1.0,
damage_penalty=-1.0,
hit_reward=0.5
)
# Encourage special moves
special_moves = SpecialMoveRewardEvaluator(
moves={
"fireball": 1.0,
"flying_kick": 1.5,
"bicycle_kick": 2.0
},
successful_hit_multiplier=2.0
)
# Combine reward evaluators
reward_system = MultiObjectiveRewardEvaluator([
basic_rewards,
special_moves
])
# Create agent
agent = DynamicAgent(
env=env,
reward_evaluator=reward_system,
policy='PPO',
learning_rate=0.0003,
frame_stack=4
)
# Train the agent
agent.train(timesteps=100000)
# Save the trained agent
agent.save("liu_kang_aggressive")
# Test the agent
agent.evaluate(episodes=10)Project 2: Natural Language Training Assistant
This example demonstrates how to use CaballoLoko to guide your training with natural language.
Project 3: Web Dashboard for Training Visualization
This project sets up a complete web dashboard for monitoring your agent's training progress.
Project 4: Multi-Character Tournament
This project trains multiple character agents and pits them against each other in a tournament.
Project 5: Advanced Self-Play Training with Curriculum
This project implements a sophisticated self-play training regime with curriculum learning.
Each of these examples demonstrates different aspects of the Casino of Life framework. You can use them as starting points and modify them to suit your specific needs. Remember to check the relevant documentation sections for more details on each component.
Last updated