Continuously refresh SVG from server coordinates - html

Say I have a web server that contains a table like this which updates/changes once per second. Table can be stored in static file, SQL database, or in memory because it's very small.
Table contains three fields with Object Name, X coordinate, Y coordinate. Table has the following data.
A, 22, 4
B, 12, 3
C, 6, 7
The table might be stored in a static file, a SQL database, or just in memory since it's a very small amount of data.
I want to render an HTML page on a web client that contains a PNG image background. Then continuously render three circles representing object A, B, and C over the PNG image based on their X Y coordinates once per second.
I want to avoid redrawing the entire HTML page once per second for performance reasons. What is the best way to dynamically update the HTML page without reloading the entire HTML page? I read that it might be possible to just continuously reload the SVG file and overlay that circle over a PNG but even the SVG file is quite bloated when I all want to transmit is the coordinate change.
Is this possible?

Related

How to apply buffer in MapServer WMS query?

I am trying to add a pixel buffer around a WMS query in MapServer. I noticed in MapServer/mapwms.cpp there is an option to set 'tiled=true' which should check for "tile_map_edge_buffer" "100" value in the map config file. However, when I check the spatial query, it doesn't seem to extend at all. Even altering SQL query to include extra data using ST_Expand(!BOX!, 0.01) doesn't help - the query does return extra data but it is not drawn.
I need this as I am generating point data through WMS EPSG:4326. The point data is displayed as large squares (changes with zoom level) but the data from the next tile near the border don't get generated in the tile of interest.
For example if the point on the main tile (lets say 100x100) is on (50,1), square size 20 pixels, the main tile generates a rectangle approx: (40,1 40,11 60,11 60,1) (20x10) which is correct. If I try to generate left side tile, I would expect to see the remainder of the square but I don't.
Anyway, if anyone had luck setting up pixel buffer for WMS, I would appreciate their input.

Why LibGdx texturepacker doesn't pack images in order?

I got these images and when I pack them they come in the wrong order, like the last 7 images or so go to the front and this messes it all up for me and I don't even know why.I have packed images before with no problems.
TexturePacker does not store regions in a certain order unless you specify that order using indices appended to the file names. The intended way to pack and retrieve an animation is as follows:
1) Name the source images with their frame numbers appended, for example:
run1.png, run2.png, run3.png, etc.
2) Pack them with TexturePacker.
3) After loading the TextureAtlas, retrieve a set of regions by name. For example:
animation = new Animation(1/15f, textureAtlas.findRegions("run"));
The retrieved regions will be in the order of the frame numbers that were in the source file names.

SWF with multiple "stages"

Is it possible to have a single SWF file with multiple "stages" appearing at different parts of the page and sharing data?
What I'm trying to do requires sharing big amount of data (byteArrays of image data) that cannot be shared through LocalConnections or via JS (very slow) so I'm trying to avoid the "sharing" part and somehow do it in a single SWF. Problem is, those images need to appear on different parts of the page thus I'm stuck.
There is only one Stage in swfs - the Stage is effectively the background; and you cant have more than one background.
"Problem is, those images need to appear on different parts of the page" - why cant you adjust the position of the images?
Use swf 100x100 % of browser window with transparent bg (wmode='transparent'), load images and place them in appropriate position. Main problem how to calculte coordinates for thumbnails... ^)
And flash with transparent bg very slow too...

AS3 - Using sprite sheets to optimize my games

So, I'm trying to make my flash "games" run more smoothly. I am using individual PNG files for each of my objects in order to create player animations.
I've heard from some places that using individual files like that is bad.
I heard about using sprite sheets in order to compress data and reduce memory usage.
Maybe I have it wrong, but is there a way to merge all of my PNG images (with transparency) together in such a way that flash can continue to use the images individually?
I am really looking for ways to make my programs run more smoothly in order to be able to have lots of images on screen without much lag. Any ideas on how I can make things run better?
Here is an example of a tile based game I'm trying to make that is having serious lag issues.
TexturePacker allows merge png files. It generates two files: png and config file. Png is just merged images and config file is txt file which you can load into your swf, parse and demerge your images using it. Config could be in various formats for different game engines.
Using Photoshop or similar software you would combine all of the animations frames into one file. The size and shape of the file can be whatever you want, but each of the 'frames' should be the same size, in the same order and with no space between them. For example, lets say each frame is 25x25px, your walk animation is 10 frames and you want the final .png to be one long strip. You would make a new .png with the dimensions of either 250X25 or 25X250 and then insert all of your frames into that one file in the order of the animation. It's up to you if you want to embed these as display object or files that get loaded, but once you have them you just need to use BitmapData to break up the input file into new BitmapData objects and then display them as needed. Going one step further, lets say that most if not all characters have a walk animation and an action animation, you would make a single class to deal with loading character animations and the first row of the image file would be the walk animation and the second would be the action animation.

Python graphics skipping every other pixel when drawing a .PPM file from a function

I'm writing a program for a college course. I import a .PPM file saved as a 2-d array from main into the function. Then I have to update the pixels of a graphics window (which is opened in main) using .setPixel and color_RGB() method and functions.
The pixels are updating, however there is a white pixel in between each colored pixel for some reason. It's not the PPM file (they were supplied by my professor and I've tried multiple ones), so it has to be my function.
Warning: I am not allowed to use anything in my program that we have not yet covered in our course (it's a first year, 4 month course so the scope is not massive). I don't need to know exactly HOW to fix it, as much as I need to know why it's doing it (AKA: I need to be able to explain how I fixed it, and why it was breaking in the first place).
Here is my function:
def Draw_Pic(pic,pic_array, sizeX, sizeY, gfx_window):
for y in range(sizeY):
for x in range(0, sizeX, 3):
pixel_color = color_rgb(pic_array[y][x],pic_array[y][x+1],pic_array[y][x+2])
pic.setPixel(x,y,pixel_color)
gfx_window.update()
You are using range(0, sizeX, 3) which creates a list with values 0 to sizeX with increment 3.
So your x goes 0..3..6..9 etc. Makes perfect sense for the part where you assemble pixel color from 3 components, but then you do pic.setPixel(x,y,colors) using the same interleaved x.
Hope that helped.
P.S. By the way, why "colors" and not "color"?
edit Also, that way you'll copy only 1/3 of the image in pic_array.