Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vmars improvements and fixes #58

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mateusz
Copy link

@mateusz mateusz commented Nov 16, 2024

  • fixed an issue where setting coresize to less than 8000 would crash vmars on restarts
  • added history-collecting staterecorder
  • optimised sprite handling via buffering
  • decoupled the naughty int coupling between memory values and sprite codes 🙃
  • reimplemented warrior coloring to use hues, which means more interesting sprites can be designed with varying colors (even contrasting). The game will automatically adjust colors based on the HSV hue circle. The initial hues are set in NewGame, but this opens up the way for more than 2 warriors, or configurable colors.
  • feature: PC queue is now visually encoded via sprite transparency, but also orders intelligently
  • feature: PCs (heads) have been updated to hover above the cell, and the tile has been redesigned to look like google maps pin. This makes it possible to see what is the underlying state/op.
  • feature: cause of death is now visible by using the history API
  • feature: updated code and tileset to differentiate between writes: DAT (X) vs non-DAT (library shelf-square with holes)

Review notes

Probably easiest to go commit by commit, I've split things up and added some context.

Demo

demo.webm

g.sim.Reset()
g.sim.SpawnWarrior(0, 0)
g.sim.SpawnWarrior(1, gmars.Address(rand.Intn(7000)+200))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the bug - hardcoded position causes crashes on restarts.

warriorColors[1].Scale(1, 1, 0, 1)
warriorColors[2].Scale(0, 1, 1, 1)
const (
SpriteFirst = iota
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used these markers so that it's easy to add sprites at the beginning and end, without redoing the code.

g.spriteCache[sprnum] = make([]*ebiten.Image, len(g.hues))
for i, hue := range g.hues {
var c colorm.ColorM
c.ChangeHSV(hue/180.0*math.Pi, 1.0, 1.0)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't figure out any other way to vary hue. The color scale thing is RGB, so not that useful.


// cacheColors precomputes colors to use for static display, such as text. This
// color matches dominant color of the sprite tileset.
func (g *Game) cacheColors() {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this isn't really required for performance, more for developer ergonomics, so that it's easy to pick solid colors for e.g. text.

@mateusz mateusz changed the title Trying different vmwars improvements Trying different vmars improvements Nov 16, 2024
@mateusz mateusz changed the title Trying different vmars improvements Vmars improvements and fixes Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant