Come on we need some sprite

OK so i decide that the color cube had to go.

It’s time to integrate some sprite sheet and to have a basic animation system inside the application.

All the code for the animation and sprite sheet are gonna recide in the client code so the server will spawn the entity and the client will have code to react and apply the texture and sprite to the entity.

[WORKING]

Yeah it took me a little while but i was able to implement a basic animation system for the character , that i will have to open a little bit to use the same component and system for the zombie but it will not work for now because it’s to mutch user centric.

I don’t really like the way i handle my weapons , it’s hard to get the equip weapon and it’s configuration.

But what i have is a file to configure the animations of my user, i will be able to use the same for the animation configuration of the zombies.

[WORKING]

Yes , i think i’m starting to do things better, the entity component system is really fun to use.

I was able to use the same code for both the sprite animation and for the sprite rotation using component to target the item.

So for now all the code to manage the sprite and animation is control on system on the client but all the event management for the animation are manage in the server code.

What i have is the following new component:

  • CharacterMouvementState

This component is use of the enemy and the player to store, information about any entity that move in the world, it contains for now only it’s state , but in the future i should also save information like velocity, direction and blah blah blah. To be able to split the code between the actual translation of the entities and the modification to the value. If i want at some point to have to server do the state modification and the client only performing the visual (apply the transform to the entity)

  • AnimationTimer

This is a component for the animation state and the timer to change the sprite in the sheet. I work along side the CharacterAnimationConfiguration that contains the loaded informations about the animation.

So CharacterMouvementState and AnimationTimer are working together to handle the animation on the client. The server code do the state change and the client react (i really love the entity and the query wow)

And for the rotation of the sprite i added the following component:

  • LookingAt

This component contains a Vec2 that tell a what location the character is looking at. With this information a system system_looking_at is in charge of rotating all of the character sprite , with what the are looking at. For the player it’s always the mouse location and for the zombie it’s the window he target at the beginning and after it switches to the player.

So that’s it , it’ funny because at first i did something only for the user that had more code to handle and afterword i reworki it to target any entity and only use the shared component.

This is the pattern i need to continue on. It’s like OOP with inherithance but another way. Sometime i’m wondering how not to split to mutch in component to have acces to all the other. Like for my weapon system , the player is the main entity and after the weapon bundle is add as a child to the player so when you query the player you cannot directly access is weapon, you need to query it’s child and look for the one your want (the active one) This is way to mutch calculation that sometime need to be redone on each frame so i save the entity in a component to easily fetch them back with the specific entity query.

I would have prefer at first to add and remove component to my entities but from what i understand it cannot be done… I would have love to have a ActiveWeapon component that tell that this weapon entity is the active one , for an easy query, but i cant.

This is the end for this interlude. Back to the animation the last thing that i need to do for now is to support the reloading of animation. It’s teadious work to support the live reload of entity data, i need a more efficient way like for the fucking asset loaded boilerplate with the fucking state. Maybe i could do something with a generic plugin that add universal loaded configure with the tempate type. But i don’t want start playing in generic type in rust, i know it can get complicated compared to Typescript.

And on another topic i think it’s time to setup a roadmap for my game and the next step and restablish my goals.

Do i want to polish the gameplay right now or continue adding feature ?

Because i think that i could do a round of pollishing before continuing with something else to have a ‘fun’ playing game.

The point that need pollishing:

  • Have a starting menu and game menu (very basic) but to support.
    • .Not having the game starting right when the software load.
    • .Be able to restart the game , quit the game and restart a new one.
  • Adding health to my character to be able to died and lose the game
  • Add better collider for the zombie and the character. now i have the following issue
    • The zombie go straight to the target (like window) but they should keep there distance when the hit. (The should have a range on their melee attack) and stop when the distance is met.
    • Also the use should collide with the zombie and vice-versa , they should never be all together in the same space (they still are colliding together)
  • Finish a little map with a floor and wall , and current sprite for the wall gonna be only for the collider the tiled map gonna do all the visual.
  • Add more distance where i can trigger the action for the window panel reparation and add a ui to display that the action can be trigger. (easy would be with the ammo more hard would be the have a text attach as a child to the player entity to display action message when available , maybe i should just do the right way now , because i’m gonna need this to buy weapons)

Those point would made the game a little more pleasant to play and present to others.

Afterward i should continue integrating the rest of the game logic and features.

For the game logic :

  • Add money and kill stats
  • Add weapon that we can buy on the wall
  • Add a second room that i can unlock for more space
  • Add the ability for the player to scoop ( will increase the precision at the cost of sspeed )
  • Add the ability for the player to run.
  • Add the dog round maybe (i dont really want it but i have the sprite lol)

For the game fonctionnality:

  • Add support for controller or mouse.
  • Add support for local multiplayer
  • Add support for online cross-plateform multiplayer
  • Add support for audio track on action