Gameplay Foundations: First Build and Early Enemy Encounters
IMPORTANT UPDATE
This week, I’ll be releasing the first build of the game. You’ll be able to explore procedurally generated levels, move the character using WASD, and attack with the left mouse click. In this version, you can only walk through the level; there’s no goal or objective yet. To see a new level, you’ll need to reload the page. Some issues remain, like misplaced walls that block progression or don’t align properly. Any feedback or suggestions are welcome!
Enemies
This week, I focused on developing enemies to give players opponents in the level. Enemies are implemented with state machines, representing the different states they can be in. For more information on how these agents work, I recommend checking out this project.
public class EnemyStateMachine {
public IState CurrentState { get; private set; }
public EnemyIdleState IdleState { get; private set; }
public EnemyFollowingState FollowingState { get; private set; }
public EnemyAttackState AttackState { get; private set; }
public EnemyStateMachine(BaseAgent t_baseAgent) {
IdleState = new EnemyIdleState(this, t_baseAgent);
FollowingState = new EnemyFollowingState(this, t_baseAgent);
AttackState = new EnemyAttackState(this, t_baseAgent);
}
public void Initialize(IState t_startingState) {
CurrentState = t_startingState;
t_startingState.Enter();
}
public void TransitionTo(IState t_nextState) {
CurrentState.Exit();
CurrentState = t_nextState;
t_nextState.Enter();
}
public void Execute() {
CurrentState?.Execute();
}
}
This state system is also applied to the player, who is managed with states as well. In addition, the player character now has animations to avoid moving in a T-pose and to show an attack animation.
private void Start() {
m_playerInputHandler = GetComponent<PlayerInputHandler>();
m_playerStateMachine = new PlayerStateMachine(this);
m_playerStateMachine.Initialize(m_playerStateMachine.IdleState);
}
private void Update() {
m_playerStateMachine.Execute();
}
Ghosts
The first type of enemy is the ghosts. They chase the player and attack with melee strikes when close.
Skeletons
The second type of enemy is skeletons that throw bones at the player from a safe distance. When the player gets close, they try to move away, though they’re fairly slow.
ACTUALIZACIÓN IMPORTANTE
Esta semana lanzaré el primer build del juego. Podrán explorar niveles generados proceduralmente, mover al personaje con las teclas WASD y atacar con clic izquierdo. En esta versión, solo se puede caminar por el nivel; aún no hay una meta u objetivo. Si desean ver un nuevo nivel, tendrán que recargar la página. Todavía persisten algunos errores, como paredes mal colocadas que impiden avanzar o que no siguen la dirección correcta. Agradezco cualquier comentario o sugerencia para mejorar.
Enemigos
Esta semana trabajé en desarrollar enemigos para que el jugador tenga con quién enfrentarse en el nivel. Los enemigos están implementados con máquinas de estados, representando los diferentes estados en los que pueden encontrarse. Para más información sobre cómo funcionan los agentes, recomiendo revisar este proyecto.
public class EnemyStateMachine {
public IState CurrentState { get; private set; }
public EnemyIdleState IdleState { get; private set; }
public EnemyFollowingState FollowingState { get; private set; }
public EnemyAttackState AttackState { get; private set; }
public EnemyStateMachine(BaseAgent t_baseAgent) {
IdleState = new EnemyIdleState(this, t_baseAgent);
FollowingState = new EnemyFollowingState(this, t_baseAgent);
AttackState = new EnemyAttackState(this, t_baseAgent);
}
public void Initialize(IState t_startingState) {
CurrentState = t_startingState;
t_startingState.Enter();
}
public void TransitionTo(IState t_nextState) {
CurrentState.Exit();
CurrentState = t_nextState;
t_nextState.Enter();
}
public void Execute() {
CurrentState?.Execute();
}
}
Este sistema de estados también se aplica al jugador, quien también se gestiona mediante estados. Además, el personaje ya tiene animaciones, evitando que se desplace en pose T y mostrando una animación de ataque.
private void Start() {
m_playerInputHandler = GetComponent<PlayerInputHandler>();
m_playerStateMachine = new PlayerStateMachine(this);
m_playerStateMachine.Initialize(m_playerStateMachine.IdleState);
}
private void Update() {
m_playerStateMachine.Execute();
}
Fantasmas
El primer tipo de enemigo son los fantasmas. Estos persiguen al jugador y atacan con golpes cuando se encuentran muy cerca.
Esqueletos
El segundo enemigo son esqueletos que lanzan huesos desde una distancia segura. Cuando el jugador se acerca, intentan alejarse, aunque son bastante lentos.
Files
Get Dungeon of the Forgotten Cycle
Dungeon of the Forgotten Cycle
Status | In development |
Author | Lorenz Equihua |
Genre | Action |
More posts
- Small Details, Big Reveal: The Demo is Ready for Action26 days ago
- Health Systems and Treasure Rooms: Enhancing Player Interaction33 days ago
- From Graph to Map: Procedural Room Design in Action47 days ago
- From Graphs to Gameplay: A Deep Dive into Cyclic Dungeon Generation56 days ago
- Development Roadmap: Planning the Journey Ahead57 days ago
- Thesis Project: Exploring Procedural Dungeon Design57 days ago
Leave a comment
Log in with itch.io to leave a comment.