Dev Blog - Trilarion

Discussion of ongoing programming work.
Forum rules
Posted relevant content can be used under GPL or GFDL (http://www.gnu.org/) for the project. Thanks!
User avatar
Trilarion
Founder
Posts: 820
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

XLIX - Release 0.2.0

Post by Trilarion » Mon Sep 08, 2014 9:58 pm

It's out. It doesn't feature much but will help getting the workflow flowing. Also it enables many more tasks for other programmers. I will now update the tasklists. I update a single screen shoot.
Startscreen-0.2.0.jpg
Startscreen 0.2.0
Startscreen-0.2.0.jpg (216.46 KiB) Viewed 11125 times

User avatar
Trilarion
Founder
Posts: 820
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

L - Minimap again

Post by Trilarion » Sat Sep 13, 2014 11:33 pm

Git (a source code management tool) - I love it and I hate it. My main criticism - it's not easy to understand. I don't want to read a book to just be able to use a tool. Sure, it's mighty but I don't need all the functions and some definitely act a bit weird or have non-obvious behavior.

Anyway I played a bit around with branches and merging and rebasing and what I thought I would do was creating 4 different branches, having each one or two commits, then rebasing three of them towards the fourth, then mergin the fourth with the master branch. What I got as branching diagram instead was this:
Clipboard00.jpg
Clipboard00.jpg (20.13 KiB) Viewed 11110 times
Looks like a tube network of one of the major cities in the world. :shock:

And then anyway I decided to stay with a single branch for now and worked on something productive - the minimap. And here it is, the very first version again. (Editor is the "in progress" programming topic of me - see task board).
Clipboard01.jpg
Clipboard01.jpg (34.3 KiB) Viewed 11110 times
Now I only need to find a way to smooth the borders of each country a bit. For comparison one of the mini maps from the original game.
Clipboard02.jpg
Clipboard02.jpg (20.72 KiB) Viewed 11110 times
If anyone has an idea how they smoothed the border, just say it!

Veneteaou
Posts: 280
Joined: Sat Aug 25, 2012 4:23 am

Re: Dev Blog - Trilarion

Post by Veneteaou » Sun Sep 14, 2014 6:43 am

It's randomization probably. Either that or (sucks to say it) they tiled the whole thing in a similar way to the terrain stuff we've worked on in the past.

Not saying it's what you want to use, but something like this: http://tex.stackexchange.com/questions/ ... hs-in-tikz

User avatar
Trilarion
Founder
Posts: 820
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

LI - First approach failed

Post by Trilarion » Sun Sep 14, 2014 9:27 pm

So had a first try, which unfortunately failed. The starting point was the outline of the area of a nation - which looks square-cut due to the fact that we have tiles.
Clipboard01.jpg
Clipboard01.jpg (21.79 KiB) Viewed 11105 times
Then I had the idea of taking each waypoint of this outline (a polygon/path for those who must know the right term) and replace it by the average of three consecutive waypoints.
Clipboard02.jpg
Clipboard02.jpg (20.9 KiB) Viewed 11105 times
On the one hand it makes the shape of the countries smooth. On the other hand no-mans land territories (painted as ocean) appear between neighbored countries and especially where three countries meet each other. The problem is obvious.

The solution (which I still searching for) must obviously respect the following fact: shared borders between countries must be made smooth in a way that both borders are smoothed the same way, especially 3 border points (where 3 countries meet) should not be smoothed. So back to the blackboard. :)

User avatar
Trilarion
Founder
Posts: 820
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

LII - Better but still not acceptable

Post by Trilarion » Mon Sep 15, 2014 9:17 pm

So I had a more advanced scheme (for every point in the outline get all the neighbours for all countries and average them all and use always the same point in all countries if it occurs and replace by the averaged point). Turns out it still gives large unwanted lakes where three countries met. Reason is that in the outline points are removed if they are on a straight line (convenient) but ... difficult to explain actuallly.

The obvious thing is, it doesn't work yet.
Clipboard01.jpg
Clipboard01.jpg (45.73 KiB) Viewed 11101 times
So I had a look at the original game again and painted a part of the Europe map versus what I have for now but not yet smooth.
Untitled-1.png
Untitled-1.png (9.12 KiB) Viewed 11100 times
I think it is clear what the original made. They left the corners out when drawing, therefore getting a bit smoother representation. Also they had exactly 3x3 pixels for each tile with a staggering of 1 pixel (not exactly half, but good enough). They did no additonal smoothing.

edit: I decided that this is a quite complex topic and deserves more attention. I will come back to it later and move on with other stuff. The next release won't have smooth boundaries of tiles but a later one will.

Veneteaou
Posts: 280
Joined: Sat Aug 25, 2012 4:23 am

Re: Dev Blog - Trilarion

Post by Veneteaou » Tue Sep 16, 2014 9:01 pm

Clever work, good job.

User avatar
Trilarion
Founder
Posts: 820
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

LIII - The future of Python + Qt

Post by Trilarion » Thu Sep 18, 2014 12:36 pm

Today I read about some severe problems of the Qt (graphics framework) binding to Python (efficient multiparadigm language) PyQt. How to shoot yourself in the foot. The reason is incompatible memory management models between Python and C++(the language of Qt). This can lead to sneaky bugs which might be very hard to debug.

I personally don't like this at all and wish I had known this before. However it seems that we might be lucky and get around (although now with hindsight I can say I had this already once).

It might be that at some point we have to switch to C++ completely. This is not what I intend. Coding in Python is definitely faster and more efficient. However converting something to another language is considerably easier to to programm from the start, also conversion from Python to C++ is probably not that difficult.

Summary: There might be some problems in the future, however they haven't occured yet for us and in case it happens we know what to do.

Bismark
Posts: 1
Joined: Thu Sep 18, 2014 4:39 pm

Mini Map Borders: a casual thought

Post by Bismark » Thu Sep 18, 2014 6:30 pm

Hi! Retired EE here, with some, but not a lot of programming. Long time lover of the game as well...in fact I still have my original CD!

I was puzzling over your discussion of the mini map border issue, and I think I understand the basic problem in a programming sense. You have tried mathematical solutions. So maybe I thought that for a simple game a simple solution might work, and also make the 'Gods' of programming happy ?

OK: Today, compared to 1997 and CRT displays, we have an enormous number of pixels available. Why not, on the mini map, break each tile "square" into four mini "squares", by bisecting the original tile from top-to-bottom and from side-to-side. This would give you four times the options. (So Tile 10-E becomes 10-E-1, 10-E-2, 10-E-3 and 10-E-4. Each one has one of the original "corners"...but now you have 5 additional reference points. You have increased from 4 fixed points to 9 points.)

Now from a computer standpoint, instead of creating an "average" mathematically (and therefore a brand new "point" in cyber space), you have simply quadrupled the number of fixed points available. You would then need to come up with a border programming routine that would go from "key" border Tile "corner" start point down to "key" border Tile "corner" end point, moving along point-to-point, along the straight lines between these points on the many, many more smaller squares that were there. This would allow, for example, where a border between two nations was essentially straight from North to South...but the Tiles are "half" overlapping first from East then from West...an easy division and a straight line. With 4 little squares, you simply bisect the overlapping parts while still keeping the computer on fixed points and straight lines.

If this were to work, and you have a programming routine on hand that keeps the border "line" from wandering too far into one country or another, you could increase the amount of "smoothing" where you do have corners. Assuming that the number of pixels allow it, you could again Quarter each of the 4 little squares within each original Tile so that you have 16 very small "micro squares" inside each original Tile. Each "quartering" adds 5 new fixed points per square, so the four original small squares, would add 20 new fixed points, minus a few that were common between the new micro squares. For easy figuring, the original "tile" gives you 4 points, the small "squares" give you 9 points, and going to 16 "micro-squares" gives you around 12 more for a total with the micro-squares of 21 fixed points.

My guess is that just quartering alone would achieve the desired result...and it would also have the "Retro" look and feel of the original game. That's my uneducated idea...hope that my "two cents' worth" proves useful and programmable!

User avatar
Trilarion
Founder
Posts: 820
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

LIV - Productive main map evening

Post by Trilarion » Thu Sep 18, 2014 11:06 pm

I will definitely come back to the very nice and good post by Bismarck. Now I want to go to bed. So only a short message from a productive evening. I incorporated many things from the java version back in the game. Have a look here. Of course I programmed in an quick and dirty way requiring internal clean up later on. And one sees that the smoothness problem of the tiles is also an issue on the main map. But we will deal with it.
Clipboard01.jpg
Clipboard01.jpg (46.61 KiB) Viewed 11070 times
However, before dealing with the corners of the tiles I want to add rivers, hills, mountains and resources.

User avatar
Trilarion
Founder
Posts: 820
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

Re: Mini Map Borders: a casual thought

Post by Trilarion » Fri Sep 19, 2014 12:35 pm

Bismark wrote:...OK: Today, compared to 1997 and CRT displays, we have an enormous number of pixels available. Why not, on the mini map, break each tile "square" into four mini "squares", by bisecting the original tile from top-to-bottom and from side-to-side....
If this were to work, and you have a programming routine on hand that keeps the border "line" from wandering too far into one country or another, you could increase the amount of "smoothing" where you do have corners. Assuming that the number of pixels allow it, you could again Quarter each of the 4 little squares within each original Tile so that you have 16 very small "micro squares" inside each original Tile. ...
Hallo Bismarck,

First I want to welcome you to the project and the forum. Thanks for the very nice input. I think you touch a valid point. We could easily tile the map on a much finer grid. We could even carry the idea further and abolish tiles altogether. Nations would then only have a border defined by a polygon and neighbored nations share parts of it, and each province is defined by a border that is defined by a polygon and neighbored provinces share the border. The only problem is the tile-wise improvement of the infrastructure that took place in the original game. So if a tile would be sub-divided into 4 (or 9,16,..) smaller tiles than how would you improve a tile where some sub-tiles belong to another nation or are sea (which will occur when you bisect)? I imagine that the game rules might get more complicated as a result.

But I like the idea very much and still don't know how to solve this problem really. I decided for the moment to concentrate on getting the map to work with non-smooth tiles and come back to this issue later and collect ideas in the mean time.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest