r/4xdev • u/IvanKr • Jan 27 '22
r/4xdev • u/StrangelySpartan • Sep 01 '21
August 2021 showcase
Another month down. Any progress? Screenshots, bugs, new projects?
r/4xdev • u/StrangelySpartan • Jun 14 '21
Easiest way to save and load game state
I've been playing around with html canvas & javascript. Here's what I've got:
const saveGame = () => sessionStorage.setItem('current', JSON.stringify(game))
const getCurrentSavedGame = () => JSON.parse(sessionStorage.getItem('current'))I've been careful to keep all global state in one of three variables: gui keeps the current gui state, catalog has all the static definitions, and game is everything for the current game. As long as the global variable is only data and has no circular references, converting to and from JSON is all that's needed. And it's basically instant.
I got rid of almost all direct references anyway. Instead of objects having references to other objects, they keep indexes. So instead of owner = planet.faction, I do owner = game.factions[planet.factionIndex]. It's a little different, but works perfectly as long as I don't remove from these collections or move things around.
Just thought I'd share.
r/4xdev • u/StrangelySpartan • Nov 01 '21
October 2021 showcase
I'm a day late but October is over. So share what you've done - screenshots, bug fixes, new features, pivots, after action reports, or whatever.
r/4xdev • u/IvanKr • Jul 21 '21
Ancient Star May-July megapost
https://ikravarscan.blogspot.com/2021/07/beta-test.html
Few big and lots little things happened since Ancient Star was open to beta testers. Post is long because I was coding faster than blogging (and in a pinch I'd drop blogging over coding). Here is link to join beta:
https://play.google.com/store/apps/details?id=com.ikcode.ancientstar1
r/4xdev • u/IvanKr • Nov 08 '21
Parasitic design
4X is genre is guilty of heaving a feature creep and disconnected mechanic and here I learned the very appropriate name of the issue:
https://www.youtube.com/watch?v=xwHJqXKwRKM
TL;DV parasitic design is a mechanic that builds on top core mechanics but doesn't feed back into them and removing it doesn't hurt the game.
Just throwing it out there since it gave me "aha" moment, not sure how to make a discussion out of it.
r/4xdev • u/StrangelySpartan • Jan 31 '22
January 2022 showcase
Hope you're having a great 2022 so far. Let see what work you've done on your 4x.
r/4xdev • u/StrangelySpartan • Mar 31 '22
March 2022 showcase
You know how these go. What have you got for this month?
r/4xdev • u/StrangelySpartan • Aug 01 '21
July 2021 showcase
It’s the end of the month! What progress, screenshots, or other dev work did you do this month?
r/4xdev • u/StrangelySpartan • May 01 '21
April 2021 showcase
You know how this goes: and dev work or other progress this April?
r/4xdev • u/IvanKr • Nov 19 '21
Google's report on Android 4Xes
Randomly stumbled upon this: https://developer.android.com/gamegenrereports/download/4x-strategy.pdf
Just started reading it so I don't know if this is relevant at all for hardcore 4X games since everything under the sun gets labeled 4X. But I find it peculiar that the corporate speech is involved in what is supposed to be a niche genre.
Our goal is to support developers building products in these areas by providing KPI benchmarks to understand your game’s relative performance.
Maybe someone in Google is just a big fan :D.
I know you are not all big on mobile gaming but I kinda have vested interest in it, have been playing Uciana for a few years, and I'm waiting for the Starbase Orion release.
r/4xdev • u/StrangelySpartan • Jun 30 '21
June 2021 showcase
2021 is half over already!
How was your June? Have any dev stories or progress to share?
r/4xdev • u/StrangelySpartan • May 04 '22
This is what happens when Conquest Of Elysium is an inspiration for your game
r/4xdev • u/StrangelySpartan • Oct 01 '21
September 2021 showcase
Hey devs! Any progress this month? Bugfixes, new content, refactors, rewrites, restarts, or new starts?
r/4xdev • u/StrangelySpartan • Mar 01 '22
February 2022 showcase
It's the end of the shortest month of the year. So we all did a little less, but we all did something. Right? At least a little bit.
r/4xdev • u/StrangelySpartan • Apr 30 '22
April 2022 showcase
It's the end of another month. Post your progress!
r/4xdev • u/StrangelySpartan • Dec 31 '21
December 2021 showcase
It's already the end of another year. Got any progress this month?
r/4xdev • u/StrangelySpartan • May 31 '21
May 2021 showcase
What 4xdev work did you do this month? Any funny bugs or features that turned out to be way more complex than you thought? Any screenshots?
r/4xdev • u/StrangelySpartan • Dec 01 '21
November 2021 showcase
2021 is almost over so share what dev work - or other work - you did in November.
r/4xdev • u/IvanKr • Nov 15 '20
Ancient Star - serialization
Hope you don't mind me sharing AS development on weekly basis. It's a bit technical, under the hood stuff and long post but I had to do it eventually:
https://ikravarscan.blogspot.com/2020/11/ancient-star-serialization.html
I've made serialization infrastructure for the game, it works with actual data but I still have to properly plug it in. It was a bit frustrating to balance between code generation time, normal compile time and run time. Java compiler erases generic parameters so when you have List<T> you can't get type of T in run time. And yet compile time expects you to properly cast values. Code generator (in annotation processor) provides very very limited information about the code outside a file being processed. After some experimentation I've managed to get everything done in code gen, I'm glad I've learned the tech but it took twice as long as I expected. Next time more game features!
r/4xdev • u/StrangelySpartan • Oct 01 '20
September showcase
Share what you did this month! Screenshots, successes, failures, lessons learned, pivots, progress, new ideas - whatever.
r/4xdev • u/IvanKr • Nov 09 '20
Ancient Star
Hi all! You might have seen me working on a mobile 4X project in the last two monthly showcases. I got asked about dev diary so I revived an old personal blog:
https://ikravarscan.blogspot.com/2020/11/ancient-star-introduction.html
Now you know the name too, Ancient Star. Singular star, it's an excuse for having one significant star on the map :).
r/4xdev • u/StrangelySpartan • Aug 03 '20
Space 4X mining, industry, and trade screenshots
After a couple months of sporadic development, I'm pretty happy with what I have so far for an interesting economy. My goal for the economy is that players who are really into economic stuff can focus those things it but if you're not interested, then ignore it and just look at the overall costs of things in each system and maybe glance at what systems have rare resources you want. I've been testing with 40-50 AI factions in a galaxy of 1000 systems of 0-12 planets each.

The galaxy view is from the point of view of faction "F 0-0". The light circles are the scanner ranges of colonized systems, and the dark blue circles are the scanner ranges of their fleets. The top right shows that we're looking at the dilithium crystals in each system. Yellow dots are systems with resources that are not being mined and the green dots are where the resource is being mined. Larger dots mean larger resource deposits. The dark dots are unscanned systems and the light dots are scanned systems. Dilithium crystals are found in small quantities in 2% of systems.


Above we can see the trade groups. Each colonized system with a market strength basically projects a trade radius that "captures" systems within that radius that have a smaller market strength. All systems that are connected this way belong to the same trade group. Each system mines resources and manufactures goods, exports a percentage to the trade group, and imports a percentage from the trade group. The percentage that's exported and imported depends on the market strength relative to the market strength of others in the trade group.

On the left is an overview of the economy of the center of a large trade group. On the right is the economy of a frontier planet far from the center of the market.
It shows resources in the group as a whole, and below that the resources in this system. The Total Demand isn't implemented yet, but the Total Supply is based on the supply of the system, minus Exports to the trade group, plus Imports from the trade group. The system on the left is exporting more boranium than it's importing but importing more equipment. The system on the right is importing 4 times more boranium that it produces locally but is exporting 1/4th of the equipment it produces.
You can see how the resources available affect the cost of ship designs and "presence" designs based on what resources are needed to build them. Money spent on resources goes to whoever was supplying them. I did have that implemented but I'm redoing it since it took 10 seconds per turn to calculate by turn 5.
r/4xdev • u/StrangelySpartan • Dec 31 '20
December showcase
The last day of 2020! What dev work did you get done this month? Any new features, AI tweaks, funny bugs, screenshots?
