Changelog - picture heavy

Started by Andy ONeill, January 02, 2018, 02:08:07 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Andy ONeill

Map Editor

Disable input on map until drawing option is selected.
Refactor of map save and reload.
This is both to improve code quality and a step towards enabling separate save of design map and game maps.

bayonetbrant

Are there options to change the font if someone's got hard time reading some of the period-appropriate fonts?

I'm a big fan of them b/c of the atmosphere they provide, but I'm just thinking of accessibility issues.
The key to surviving this site is to not say something which ends up as someone's tag line - Steelgrave

"their citizens (all of them counted as such) glorified their mythology of 'rights'...and lost track of their duties. No nation, so constituted, can endure." Robert Heinlein, Starship Troopers

Andy ONeill

#92
There will be.
You'll be able to change font in all the modules.
You can already in the scenario editor, I've just not done that in the map editor yet.
Incidentally,   
If you don't install the font files then it won't fall over or anything, it'll fall back to segoe ui.

I think this is one of those user preferences you probably have for all modules. 
I'll probably let the user set this in the menu module. 
When I get round to writing it :^)
 

Andy ONeill

#93
Map Editor

Added load map background option.
This gives you a file picker which is looking in the appdatalocal/GeneralStaff/Backgrounds folder.
At the moment, this background will be included in the png created by saving the map and so would be used in scenario edtor. And the game if I'd written it. 
This will be changed so the user can pick background in any of the suite.
One option will be a hypsometric representation of elevation.

Google Maps API

I am currently writing a proof of concept which gets elevation data from google maps. 
I get the data and I'm exploring the practicality of filling the 2 dimensional array which is used for our maps.
Looks like it'll work. So far.

You will input the two co-ordinates ( lattitude and longitude ) for the top left and right corners of your map area.
These can be obtained externally by any means you like but you can just use google maps. Right click the map and choosing "what's here" gives you the data.
Current elevation will of course include some "anomalies" like eg the mound at waterloo but some battlefields remain pretty much like they were during our time of interest.
Users will need to register for a key. The map API is free for up to 2,500 calls a day. 
Since it's limited to a certain size of data returned you will use this up with two calls. 
It is also throttled and will block your IP if too many calls are made in a second.
So it's a bit slow.

Anyone with a google account will find the process of registration almost trivial. You just click and it gives you a key which looks rather like a GUID to me.

This is just an option and you will still be able to translate the grey scale of a graphics file.
Once you have the data you will then still be able to edit it later.
Even if you're not doing a specific historical battle you could pick some random bit of the world and use the data from there to get you started.

Cyrano

The Google Maps option is very exciting.

There's a great thread somewhere here on the fora pointing to a bunch of GMaps battlefields.
Sergeant at Arms of La Fraternite des Boutons Carres

One mustachioed, cigar-chomping, bespectacled deity, entirely at your service.

You didn't know? My Corps has already sailed to Berlin. We got there 3 days ago and we've been in the Tiergarten on the piss ever since. -- Marshal Soult, October 1806

Andy ONeill

Google Maps proof of concept

Gets data successfully.   
In order to cut down on the number of web calls I get every other px elevation. 
Hence the map is 1155x805 and I get elevation data for  578 x 403.
This is 578 calls which return the data for a line on the Y or "vertical" axis. 90 degrees relative to your two co-ordinates.
I will be able to use these to set the metres per pixel as well so you don't need to go measuring points against a legend.

Since you can rotate a google map and put persistent "favourite" pins in it you can potentially use a screen dump to trace from.
That would then give you consistent scaling which I think can be an issue in historical sketch maps.

I will show the  co-ordinates for the "bottom" left and right corners so you can put pins in for those as well.

Andy ONeill

Map Editor

Rotating buildings. 
There are now two buttons in the edit tab which allow you to rotate a building by 5 degrees each click clockwise or counter clockwise.
This is limited to 30 degrees because the shading would look weird if you rotated more.
The drop shadow also rotates as the building does.

Google maps integration.
I started the first iteration adding this to the map editor.
This is quite fiddly because if you push too many requests through google's elevation api it does weird stuff first and then locks your ip for a while.

Andy ONeill

Google Map Data

I have the first iteration working. 
Beat several bugs out of it and it seems stable. 
It has to be throttled back to wait between each call to the API and there are 578 calls to make so it takes a while.
 
I'll give some thought to how I could let a user carry on working in the map editor whilst it trundles along.   
We need some UI for the user to input co-ordinates, initiate the calls and see progress.   
I will probably put that into another tab in the left panel.
The calls are threaded, so you will be able to carry on working whilst this does it's thing. 

Currently, the hills and valleys can be checked in the scenario editor because it shows you the elevation where the cursor is. 
What's needed is some sort of visualisation background or layer that shows you the "big picture".
This will be a hypsometric background.
That's a fancy name for those colours you see on larger scale maps or atlasses where they work up from green valleys through browns, greys and eventually white on mountain tops. 
This is more readily understandable and prettier than contours which would in any case be harder to automate.

That in turn should make it easier to understand which bits you want to do some more work on. 
For a "quick" game ironing out a motorway is probably not worth the effort. 
For a more serious game you may want to flatten those out. 

Andy ONeill

Google Map Data

The new panel is now there and working, with a couple of superficial issues. 
The green rectangle is a progress bar which creeps along... fairly slowly.
Maybe not slowly enough since the api will still occasionally decide you're not getting anything and you then have to leave it a while or you've had it for 24 hours.  I have no idea what criteria they use but it's inconsistent.
You're best advised being quite careful about where you want your two points to be as the first run will almost always work whilst a second is more likely to crash and burn.



Font size needs reducing on the bottom locations and the number of decimal places rounded to 6.
The average variance needs rounding.

I think I'll probably also add a button to calculate the two bottom corners without doing a "run".
That way you can put pins in the (google) map, take a screen shot and compare to another map or whatever.

Andy ONeill

#99
Map Editor

First iteration of Hypsometric background. 
In case you're thinking Hippo what? 
This is using colour to denote elevation, an approach which is more usual in large scale maps like atlasses.
Green is low, working up through brown to sort of sandy.

And this is a chunk of France.



How this works is I take the minimum and maximum elevation.
Any value will be between them and I translate this into a colour somewhere on a gradient where 0 is the left hand value and minimum and 1 the right and maximum.
The colours used are fixed at the moment but could in theory be made configurable.
The gradient looks like this:



The whole process of first grabbing elevations and processing them needs a good bit of testing to ensure what I get makes real world sense.


Andy ONeill

#100
Map Editor

Tidying up the google maps elevation api process.
If you don't have the file set up when you navigate to the obtain elevation panel you will just see the message:

In order to use the Google map data API you need to provide a key for Google.
Register with Google for the maps API key.
Put the key provided in a file called googlekey.txt in %localappdata%/GeneralStaff/
Close and re-start the GeneralStaff Map Editor.


Registration with Google is entirely separate from the GeneralStaff suite. 
Creation of the file to place your key in is intentionally manual as a reminder to emphasise this.

Although the process is as smooth as I can make it, calls to their elevation data API are subject to whatever drives Google's decisions.
If you run the process more than once in a day then you're likely to see a message saying:

Google rejected call.
You can probably save and resume later.


Presumably to stop denial of service attacks, they have a mechanism which will block an IP for several hours if they decide it's being used to "automate calls".  Quite why anyone would want to use that API in any way that wasn't automated I don't really know.  In any case, despite having to register to use the api they still have this mechanism in place. 
There's absolutely nothing I can do about that other than work round it.

If you get this message but you can see the process has got some data you can save what you have.   
When you reload the save file you'll see a "Resume" button appears.
Don't just try this again straight away.   
I get the impression this increases the time you can't use it for.
All this could change because the registration process just got rather more involved and logically you might imagine they're way less likely to suffer DoS attacks from people who registered with credit card details.



If you leave it long enough then the process will complete and you've got a full map's worth of data.

Despite the hoops you need to jump though I think most people who want more than a few manually drawn contours will find this way easier than the alternatives. 


Andy ONeill

Obtain Elevation Data

Option to set 0 as minimum elevation.
Google returns negative values for seabed which you're probably not going to want.
On the other hand.... Some areas of the world have land which is below sea level.
Hence you can switch this on or off.

Scenario & Map Editor
Allow toggle visibilty of elevation map
Optimised generation of elevation map to avoid it freezing the UI.

Grecco

There are several sources of elevation data out there that are free and allow bulk downloading. You might want to take a look at USGS's earth explorer website (https://earthexplorer.usgs.gov/) for bulk downloading 1 arcsec elevation data (around 30m resolution) with nearly world-wide coverage.

Another website with good free elevation data is this one: http://viewfinderpanoramas.org. Here you can find a full earth-covering elevation dataset at 3 arcsec resolution (around 90m at temperate latitudes).

I would suggest processing these and shipping the battlefield elevation with your game, the google API's sound a bit too restrictive to me (I don't like waiting)  :) .

Andy ONeill

Thanks, I'm aware of the alternatives.

The google api is fairly easy to use and flexible.
You can pick any two co-ordinates and it "just copes" with any angle between them and reconciles whatever scale the elevation is held at internally.

Of course, buying a pre built scenario will be even easier.
These will also have excellent graphics.

We won't be using google's elevation data for our scenarios. Partly because of their terms of use.
Any utilities which I build in order to handle satellite data are likely to be passed on in one form or another. That could be either as a separate utility or within the map editor.
Since doing the same thing several different ways is inherently inefficient I'll probably add the facility to upload a file with the data in to the map editor.  That is then ready to take data from any external source you want to use.

It's much more likely any such utilities would require a user to download data from source rather than us re-packaging data already publicly available.



Andy ONeill

Map Editor

Menu toggle visibility for grid and places.

Allow stylus pressure to affect width of rivers.
It's only rivers where a different width on a "line" terrain is considered to be a plus.

Collapse point canvas unless drawing options selected
This is to allow user interaction with terrain objects already on the map.
First of which is:

Buildings
Mouse scroll to rotate a building ( so long as drawing options aren't selected ).
This is limited to 30 degrees like the arrows in the terrain edit as the shading of the rooves would look very odd if you rotate like 90 degrees.
Making buildings 3d objects would be more elegant but they'd then take way longer to design and be way too expensive to render in numbers. 3d objects are very expensive to render.

Started re-templating menu items.
The default WPF template is very complicated and has space for things like a checkbox and icon.  It doesn't suit anything but quite simple items.
As I have sliders in menu items this needs some work.