Interactive geographic map in Phaser - phaser-framework

I'm trying to create a interactive geographic map with Phaser framework that is similar to this http://preview.codecanyon.net/item/interactive-usa-map-html5/full_screen_preview/4527698 so what I was looking into is loading tile maps from JSON or CSV, but I'm not sure this is the right approach.
I know it's abstract question but I just wanted to be sure I'm moving into right direction and see if there are other ways to do this

I'm not sure a Tilemap is going to help you here. There's nothing 'tiled' or uniform about that map. While you could achieve it using Object placement in Tiled, I still think it's probably not the best route.
Personally I'd question the use of Phaser for something like this, and I wrote it! If I had to re-create the map you linked to, I would be looking at SVG and a library like paper.js instead, which just seems far more suited to this particular task.

Related

How did Epic Games achieve this 3D effect on their Fortnite site?

I have been looking at Epic Games' Fortnites Website and I am trying to figure out how they achieved the 3D effect on the page:
Epic Games' Fortnite website - scrolled down to 3rd slide
Does any one have any idea how to do it? I would really like something similar to a project I'm working on. I have found Three.js, but I am quite sure that is not the solution they went with.
For these types of questions, i can only recommend to install spector.js and have a look yourself. In short: everything you see is 100% faked.
I mean, that's always the case. In fact, if you want to build something like that, your first question should always be: how much of this can I fake and still get away with that?
In this example, it turns out: everything. Just open the devtools and click through all the assets in the network-tab. You will find these two textures:
looks familiar, right?
So what they appear to be doing is they are using three.js with some custom shaders to handle the translations, the flickering of the lights and the highlighting. These effects are computed using the normal-map and an additional mask-texture which I couldn't quite figure out what it does. But again, if you look at the scene in spector.js you can see the shaders used for every drawcall.
The only thing that is a bit more complex is the little robot-friend in the bottom left corner. But again, it's not 3d as in meshes and so on but rather a set of flat textured quads running a bones-animation thing.
I think that makes it a really great website after all.
Given that epic is building the unreal-engine I would suspect the original renders were done there. And I agree, the lighting looks really amazing :)
It is a simple parallax effect using animated sprite sheets.
Parallax effect is achieved by using several layers of images/video on top of one another in different Z-depth.
You can achieve the moving part by using the mousemove event to track the cursor.

Using snap svg for manipulating/dragging/hide/show nodes in SVG diagrams

I have a Network Diagram(Nodes and Edges) in SVG generated by GraphViz tool. I want to make the diagram interactive in the sense, it should be draggable, on click of a node some other nodes to be hidden.ETC. Can any one suggest snapSVG is sufficient for that? I cannot add any thing to the SVG diagram that is my restriction. How can we make existing svg diagrams forced directed? Any help, starting point, fiddle will be helpful. I have hands on in d3.js is it achievable by d3.js?
This should be possible, maybe be aware Snap.svg isn't so compatible with older browsers (in which case you could look at Raphael which is Snaps older brother, d3 is very well established as well). They all have all the basics, handlers, animation etc. However, although its possible, it may well be quite a lot of work (so may want to stick with what you know).
You may want to look into whether you want to autocreate connecting elements and move automatically, or are happy moving endpoints manually.
It may also depend on things like what you want to happen after dragging the elements. Do you want to save them ? Some of that may be quite important as to how you approach it, maybe more important than dragging as most will support that.

Getting Mouse Coordinates in Gloss(Haskell)

I am trying to implement drag-and-drop functionality into a haskell gloss (scheduling) program of mine, but to do that I need to be able to read the coordinates of the mouse. I have been researching how to do this for multiple hours and am coming up empty, except for the fact that it is possible in GLUT, which gloss is based off of, but going that deep is over my head.
I was wondering if there is already some way to do this in gloss, and if not, what library should I switch to?
Thank you in advance!
For your serve function you'll want to handle an event such as:
serveWorld (EventKey (MouseButton LeftButton) Down xPos yPos) world = ...
Or perhaps you don't want to look for buttons but instead just motion? In that case serveWorld should handle EventMotion.
You might want to look at the gloss-draw example program, which is in the gloss-examples package.

OpenGL 3.2 Core Sprite Batch Example?

I have been tearing my hair out for a while over this. I need an OpenGL 3.2 Core (no deprecated stuff!) way to efficiently render many sprites, using batching (no instancing).
I've seen examples that do this with geometry alone, but mine also needs to send textures to it, I don't know how to do this.
I need a well done example of it working in action. And looking at how other libs like monogame and such do it isn't much help, because all I'm interested in is the GL code, and it has to have no deprecated stuff in it.
Basically I want to be able to efficiently render thousands+ of sprites, all having textures. The texture is just a spritesheet, so I just need to tell it to render a region of that spritesheet.
I'm disappointed in the amount of material available for programmable pipeline. To the point where it seems like it'd be so much easier to just say screw it and use fixed pipeline, even though I definitely don't want to do that.
So yeah, any full examples that do what I want? Or could somebody more knowledgable write one up? :)
A lot of the examples are "oh, here's how you render 1 triangle". Well that's great, except nobody needs to render only 1 triangle/quad. And they need to be textured in addition to that!
An example that uses VBOs/VAOs/EBOs
ALSO: this means the code can't use glTexPointer and that stuff, but just in raw VBOs/VAOs...
I saw this question and decided to write a little program that does some "sprite" rendering using points and gl_PointSize. I'm not quite sure what you mean by "batching" as opposed to "instancing," but my program uses the glDrawArraysInstanced() call so that I can render multiple points without needing my VBO to be variable sized. My code also doesn't texture the sprites, but that's easy enough to add in (upload the active texture index (the one that was active during your call to glTexSubImage), to a GLSL sampler2D using glUniform1i).
Anyway, here's the program I wrote: http://litherum.blogspot.com/2013/02/sprites-in-opengl-programmable-pipeline.html Hope you can learn from it!

Simple C/C++ library for triangle-intersection acceleration structure

I'm raytracing and would like to speed it up via some acceleration structure (kd-tree, BVH, whatever). I don't want to code it up myself. What I've tried so far:
Yanking the kd-tree out of pbrt. There are so many intra-dependencies that I couldn't succeed at this without pulling all of pbrt into my code.
CGAL's AABB tree. Frustratingly, this seems to return only the point of intersection. Without knowing which triangle the point came from, I can't efficiently interpolate color over the triangle. I'd love to just extend the notion of "Point" with color, but this doesn't seem possible without writing a lot of template code from scratch.
Writing my own. Okay so I wrote my own grid acceleration class, and it works, but it's nasty and inefficient.
So, if anyone can suggest a simple library that I can use for this purpose I'd really appreciate it! All I need is given a triangle soup and ray, find the closest intersection and return the index of that triangle.
Jaco Bikker wrote this series of tutorials: http://www.devmaster.net/articles/raytracing_series/part7.php
They're very helpful and he includes code at the end for a ray tracer using a kd-tree.
You might be able to use that.
The G3D engine has a ray tracing implementation. Not sure how efficient it is though. It shouldn't bee too much trouble to use the Tree implementation without the rest of the library.

Resources