Error creating thumbnail: Unable to save thumbnail to destination
The Influence Map, originally by Paladin Vent, is a sovereignty map for EVE-Online maintained by Exi. The map displays regions of space held by the Alliances that hold them, as well as changes in the sovereignty since a specified day.
The current implementation is in favor for speed and portability written in PHP and C instead of Java like the original project. During porting to PHP performance issues arose which could not be solved in PHP alone. While Java needed around 16 minutes for rendering the Map on a Core2Duo E6600 (Single threaded, a multithreaded version did in in 10 minutes), PHP took 30 minutes for the same algorithm. The C program uses plain C and only <stdio.h> to be as portable as possible even though its written by a complete C newbie it is pretty fast as the combination of C and PHP reduces the total rendering time to about 180 seconds.
The way the map renderer was implemented allowed the main loop (which is executed roughly 8.5 billion times per map generation) to be executed prior to all image generation code so the PHP program has become a wrapper around the C core. PHP handles all database and image actions, preprocesses the sovereignty data and passes it to the C program which then processes the data and pipes it directly back to php. A cached datafile of the communication between the 2 processes reaches about 55MB, depending on the number of influenced systems.
How it works
During initialization it pulls out an outpost list which is maintained manually, system, region and jump-data from the CCP Datadump, npc influence injects to keep player alliances out of npc space and the current sovereignty data using the API joined with the API-Alliancelist to resolve allianceID to allianceName. The influence of alliances spreads via jumpgates into neighbour systems (and regions) but stops if the target systems is faction space to avoid leakage.
It reduces the influence to 30% of last value per jump and travels max 4 jumps for an Outpost and 3 for a POS. The algorithm for doing that is recursive and uses a small stack to keep track of visited systems so it doesn't jump into a circular reference.
Constellation Capitals get a 200% boost in influence power and one additonal jump point and systems with sovereignty level 3 get a 20% boost.
At that time all systems, sovereignty points, jumplines and outposts are printed to the map. Then it passes the data into a textfile for the C program to work on. This is the time consuming part, for every pixel of the map it iterates through all systems in range (indexed by y), calculates the distance and breaks down the influence over that distance to this pixel. After that it prints out the pixel with the allianceID of the 'winning' alliance for that pixel to the PHP parent.
PHP now collects all pixel of a line and uses a 1D-Scanline algorithm to link alliance areas together for the correct placement of name tags. It also keeps track of borders and adjusts the pixel alpha as needed. After all lines are drawn it prints the region names and then iterates through all recognized alliance areas to print the name tag. The last thing is printing a sovereignty overview to name changes on the map.
The current backend source can be reviewed through our trac service at http://trac.eve-id.net/browser/sovereignty