Fantasy-Map-Generator
Fantasy-Map-Generator copied to clipboard
FMG 2.0: Codebase refactoring and modernization
Description
Starting working on a major code refactoring and modernization.
Goals:
- full code decoupling using es6 modules
- removing most of global variables / functions
- codebase modernization
- full Typescript support
- production code minification
- save data format change: https://trello.com/c/IWltiMC2/902-rework-save-data-format
- model / view separation: https://trello.com/c/u7ip0bgD/786-separate-view-from-model
- remove jQuery dependency, to do this need to come up with a custom solution for Dialogs (e.g. Web Component)
- reducing dependency on d3, using d3 only when needed
Contract changes as of today
Regiments:
-
state.military
is renamed tostate.regiments
- regiments contract is reworked
Routes:
-
pack.cells.road
is renamed topack.cells.route
-
pack.cells.route
values are repurposed, now 1 meansroad
, 2 -trail
, 3 -seaRoute
-
pack.routes
now stores all relevant routes data
Diplomacy:
- Ongoing wars are not longer stored in
pack.states[0].diplomacy
- Historical campaigns are not longer stored in
pack.states[x].campaigns
=> Both are now stored as an array inpack.events.conflicts
Provinces:
-
pack.states[x].provinces
is removed. Now states don't store info about their provinces
Labels:
-
text-anchor
for '#labels' element is changed from 'start' tomiddle
. All childtspan
elements now should have attributex
equal to0
instead of a calculated value
Type of change
- [x] Other (architecture change)
Versioning
- [ ] Version is updated
- [ ] Changed files hash is updated
Wow, wow, wow... that's quite a change. :-O I already did some of these changes (very small subset of it) I have to catch up now.
Vite seems to be a cool stuff, but is it strictly necessary?
netlify[bot] @.***> ezt írta (időpont: 2022. jún. 24., Pén 23:52):
✅ Deploy Preview for afmg ready! Name Link 🔨 Latest commit bc65e0e https://github.com/Azgaar/Fantasy-Map-Generator/commit/bc65e0e20719635e96046fd6ee6e2399e0697a04 🔍 Latest deploy log https://app.netlify.com/sites/afmg/deploys/62b631e6bac4b00008014869 😎 Deploy Preview https://deploy-preview-842--afmg.netlify.app/ 📱 Preview on mobile Toggle QR Code...
Use your smartphone camera to open QR code link.
To edit notification comments on pull requests, go to your Netlify site settings https://app.netlify.com/sites/afmg/settings/deploys#deploy-notifications.
— Reply to this email directly, view it on GitHub https://github.com/Azgaar/Fantasy-Map-Generator/pull/842#issuecomment-1165968486, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUMDVNIHDP4V4UD3JQOXVTVQYUYBANCNFSM5ZZCTPXA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
It's not necessary at all. But that is one-time action that will allow a lot of cool things in the future. It also forces to write a better code and think a lot about the structure
This change is really welcome! Thanks for your hard work, that must be painful.
I'm interested in vite's on demand refresh feature. How can I kick in easily ? (Which template to use if any, are there any pitalls to avoid?)
Azgaar @.***> ezt írta (időpont: 2022. jún. 26., Vas 11:12):
It's not necessary at all. But that is one-time action that will allow a lot of cool things in the future. It also forces to write a better code and think a lot about the structure
— Reply to this email directly, view it on GitHub https://github.com/Azgaar/Fantasy-Map-Generator/pull/842#issuecomment-1166463345, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUMDVONUGBMHYIPMYBWTWDVRANJJANCNFSM5ZZCTPXA . You are receiving this because you commented.Message ID: @.***>
Do you mean hot module replacement? If so, it works just fine out of the box.
The template I used is a very basic vanilla-js + typescript: https://stackblitz.com/edit/vitejs-vite-epqe9h?file=index.html&terminal=dev
Yes, that one.
Azgaar @.***> ezt írta (időpont: 2022. jún. 26., Vas 11:53):
Do you mean hot module replacement? If so, it works just fine out of the box.
The template I used is a very basic vanilla-js + typescript: https://stackblitz.com/edit/vitejs-vite-epqe9h?file=index.html&terminal=dev
— Reply to this email directly, view it on GitHub https://github.com/Azgaar/Fantasy-Map-Generator/pull/842#issuecomment-1166475264, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUMDVJZFY2KYZXJNVCCEJ3VRASCBANCNFSM5ZZCTPXA . You are receiving this because you commented.Message ID: @.***>
Is it largely finished? Can I test and use this branch?
Nope, it's very far from completion. It's not yet working and also probably I'm introducing ton of bugs.
Since we've discussed it in #902 I thought I'd ask, is there some way we can help with this migration work?
Since we've discussed it in #902 I thought I'd ask, is there some way we can help with this migration work?
Yes, the UI part if not refactored at all. There are multiple elements to work on.
With regards to human readable remark - I don't see how a human readable format could be structured. BUT, SVG supports metadata which means that maps could be exported as a simplified rendered SVG with current JSON stored in minified format as embedded data.
Benefit of doing that would be that saved maps would have proper thumbnails on certain OSs and could be previewed so the user knows a general layout of the map they're about to open.
With regards to human readable remark - I don't see how a human readable format could be structured. BUT, SVG supports metadata which means that maps could be exported as a simplified rendered SVG with current JSON stored in minified format as embedded data.
Benefit of doing that would be that saved maps would have proper thumbnails on certain OSs and could be previewed so the user knows a general layout of the map they're about to open.
There is no intention to store map data in svg. SVG can stay for a while, but the ultimate goal is to separate data from view, so the .map file can be even potentially rendered in other systems outside of FMG.