Skip to content

Conversation

@pcen
Copy link
Contributor

@pcen pcen commented Jun 30, 2023

edit: I'm using this code as reference for current PRs, but this branch shouldn't be branched off of or used directly

this is a proof of concept based on #377 for save game format

how to try this out

  • start a new game as usual
  • the static save is (temporarily) a GOTM save file converted to C7 json format -> roads everywhere!
  • build carthage
  • command + s to save
  • close the game and start it again -> load game -> load C7/test.json

I've done some previous experiments with save game structure previously attempting to serialise GameData directly and use c# references, but this seems like the most promising way to serialise saves.

  • save files are very hard to edit without custom IDs
  • save files are very hard to edit when the object graph of GameData is serialised automatically - Newtonsoft and Text.Json both cannot consistently determine references
    • with a custom format, there is a single copy of every entity at the top level of the save, and all references are done via EntityIDs serialised as strings
  • loading from SAV and editing saves (ie in a yet-to-be-written C7 map editor) is easier since any object in the C7 json only needs to be updated in one place, and SaveGame is responsible for inflating this structure into the GameData object graph used at runtime

@pcen pcen changed the base branch from Development to godot4 June 30, 2023 21:52
@pcen pcen force-pushed the pcen/save-by-value branch from 30e35e6 to bbb297c Compare July 3, 2023 20:45
@pcen pcen changed the base branch from godot4 to pcen/use-tilemaps-render-cities July 4, 2023 03:03
@pcen pcen force-pushed the pcen/save-by-value branch from d94573f to 0fc645e Compare July 6, 2023 01:19
@pcen pcen mentioned this pull request Jul 9, 2023
pcen added 4 commits July 31, 2023 18:46
add Camera2D

test drawing units in word coordinates

wip

simplify unit sprite test demo - AnimationManager could be simpler but trying to keep diff small

enable pixel snapping - removes world seams

render roads in tilemap

add logic for drawing rails on tilemap - missing separate layer

working rails layer

simple abstraction for loading atlas sources

add resources and clear cells when empty

track net lines changed

working rivers

separate notion of layer and atlas in MapView

add mountains

get rid of incorrect y offsets (tiles are already centered)

offset is necessary for oversized tiles...

add volcanos

single terrain overlay

add full left skirt to terrain layer

detect edges of map in world space

fix bad bounds for forest tiles and use full resource tileset

wip

tile set loader so specific assets can be overwritten in the future

add marsh to tilemap terrain overlay layer

camera can center on tiles

buildings on tilemap

remove ported code

load goodyhut pcx

pixel perfect transforms

dedupe code

enable Y sort for each tilemap layer

kinda working animations

wip

wip

working sprite animations

render best defender on top of unit stack

significantly faster animation loop when only doing visible tiles

draw cursor

remove ported code
test drawing units in word coordinates

wip

simplify unit sprite test demo - AnimationManager could be simpler but trying to keep diff small

enable pixel snapping - removes world seams

render roads in tilemap

add logic for drawing rails on tilemap - missing separate layer

working rails layer

simple abstraction for loading atlas sources

add resources and clear cells when empty

track net lines changed

working rivers

separate notion of layer and atlas in MapView

add mountains

get rid of incorrect y offsets (tiles are already centered)

offset is necessary for oversized tiles...

add volcanos

single terrain overlay

add full left skirt to terrain layer

detect edges of map in world space

fix bad bounds for forest tiles and use full resource tileset

wip

tile set loader so specific assets can be overwritten in the future

add marsh to tilemap terrain overlay layer

camera can center on tiles

buildings on tilemap

remove ported code

load goodyhut pcx

pixel perfect transforms

dedupe code

enable Y sort for each tilemap layer

kinda working animations

wip

wip

working sprite animations

render best defender on top of unit stack

significantly faster animation loop when only doing visible tiles

draw cursor

remove ported code

wip render cities

city labels text renders but at wrong offsets

correct city label offsets

only redraw city label scene when necessary

redraw city scene if production name changes

re-implement insure location is in view using player camera

remove GD.Print statements

emit city built message from engine interaction
@pcen pcen force-pushed the pcen/use-tilemaps-render-cities branch from 3def55d to 5fdd5b3 Compare July 31, 2023 17:02
pcen added 3 commits August 1, 2023 14:10
test drawing units in word coordinates

wip

simplify unit sprite test demo - AnimationManager could be simpler but trying to keep diff small

enable pixel snapping - removes world seams

render roads in tilemap

add logic for drawing rails on tilemap - missing separate layer

working rails layer

simple abstraction for loading atlas sources

add resources and clear cells when empty

track net lines changed

working rivers

separate notion of layer and atlas in MapView

add mountains

get rid of incorrect y offsets (tiles are already centered)

offset is necessary for oversized tiles...

add volcanos

single terrain overlay

add full left skirt to terrain layer

detect edges of map in world space

fix bad bounds for forest tiles and use full resource tileset

wip

tile set loader so specific assets can be overwritten in the future

add marsh to tilemap terrain overlay layer

camera can center on tiles

buildings on tilemap

remove ported code

load goodyhut pcx

pixel perfect transforms

dedupe code

enable Y sort for each tilemap layer

kinda working animations

wip

wip

working sprite animations

render best defender on top of unit stack

significantly faster animation loop when only doing visible tiles

draw cursor

remove ported code

wip render cities

city labels text renders but at wrong offsets

correct city label offsets

only redraw city label scene when necessary

redraw city scene if production name changes

re-implement insure location is in view using player camera

test saving everything with primitive values

compiles

wip

refactor

wip

city loading works

clean up and comment save conversions

import to SaveGame instead of GameData

test loading some actual save files

fix build dev save

remove test save

wip

fix save being broken

clean up

load players, civilizations, and units

only load leaders from .sav

hardcode army flc to load ancient times army graphic

load cities

import hit points remaining correctly

import unit movement

import unit fortification properly

schema script

add grid lines to debug terrain layer

check in grid.png

prevent crash on loading non-wrapped maps, but terrain is flawed

working terrain skirts

working terrain tilemap for horizontally wrapping and non-wrapping maps

most conquest biq files load
@pcen pcen force-pushed the pcen/save-by-value branch 2 times, most recently from a4cf68e to 9f563b4 Compare August 2, 2023 15:20
@pcen pcen mentioned this pull request Aug 7, 2023
@pcen pcen force-pushed the pcen/use-tilemaps-render-cities branch from 5fdd5b3 to b5521ec Compare August 7, 2023 12:24
@pcen pcen changed the title save by value rough prototype code only - save by value Oct 12, 2023
@QuintillusCFC QuintillusCFC added tilemap PRs targeting Tilemaps on Godot 4 save-game PRs/issues related to save games labels Mar 22, 2024
@QuintillusCFC QuintillusCFC deleted the branch pcen/use-tilemaps-render-cities March 22, 2024 22:31
@QuintillusCFC
Copy link
Member

This branch got auto-closed when I deleted the already-merged use-tilemaps-render-cities branch. Not sure why it didn't just change the base to the use-tilemaps branch? At any rate, since it says it's experimental and for reference only, I'll leave it closed - it also helps reduce the confusion around which PRs relate to which other ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

save-game PRs/issues related to save games tilemap PRs targeting Tilemaps on Godot 4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants