Pages: 1
  Print  
Author Topic: Force directed graph in LGM  (Read 12971 times)
Offline (Unknown gender) Mangolion
Posted on: October 19, 2014, 03:09:58 pm
Member
Joined: Sep 2014
Posts: 19

View Profile Email
After a few hours studying LGM's wild source code (I really wish there are more comments and javaDocs   :-\ ) I decided to make a small feature to see how I understood LGM's basic components. I've added 2 force directed graphs, one to show an object 's events and actions, the other to show all resources in a project (objects, backgrounds, ...) and also objects and their events.
I added a "View" menu in the menubar for project visuallization, and a "Visualize" button in the obj frame.
Drag right mouse to zoom.
Download it here : https://www.dropbox.com/s/3hp184w14at89uf/Crazy%20LGM.jar?dl=0
I have used the substance library for the cool-looking GUI : https://github.com/Insubstantial/insubstantial/releases/tag/insubstantial_7.3
and the visualization toolkit called prefuse: http://sourceforge.net/projects/prefuse/
Please know that I don't really understand most of LGM's code because my experiences with java isn't enough. However, I am quite proficient with writing Android apps and am planning to port LGM to Android, perhaps you guys can help!  :)


« Last Edit: October 19, 2014, 03:14:46 pm by Mangolion » Logged
Offline (Unknown gender) TheExDeus
Reply #1 Posted on: October 20, 2014, 11:46:03 am

Developer
Joined: Apr 2008
Posts: 1860

View Profile
This is actually an extremely cool feature. It helps the user to grasp the project and the relationships. More view options would be cool, like showing sprites as actual sprites; allowing people to edit the resource by clicking on it; and showing the scripts used in an event (even code events).

Then later things like relations between instances would cool, like showing Create event -> Code Event -> scr_delete_bullet then links to obj_bullet, because spr_delete_bullet has "with (obj_bullet){ instance_destroy(); }" in it. But that would involve parsing the code, to see which resources are referenced.
Logged
Offline (Unknown gender) TheExDeus
Reply #2 Posted on: October 24, 2014, 06:26:57 pm

Developer
Joined: Apr 2008
Posts: 1860

View Profile
Did anyone else check this out? I would really like a feature like this in main LGM at some point. I guess having a 3rd party visualization library can be large to include (or is the skin the one thing that made this LGM 6mb?) and I don't think we need something as fancy looking as this (via all the animations and stuff). But I really do like the feature.
Logged
Offline (Male) Goombert
Reply #3 Posted on: October 25, 2014, 05:45:35 am

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
Sorry I forgot to respond to this topic. It certainly is a nice feature, I can tell you that Josh would definitely like it he did very similar with JDI which can spit out SVG's. My recommendation is to wait until we design a better plugin system with LateralGM. The intention was to utilize Project Nashorn so that JavaScript extensions could also be added, much like Unity3D so that users can expand editors and such. Currently I have no actual solid plans for this and it requires more discussion with IsmAvatar, but I haven't even really approached her about the topic yet. In other words, I am just saying that I think LGM should have a better extension system that supports JavaScript, but I really have no idea how to go about implementing it, it's not that I don't understand the technology involved. For instance, Unity3D lets you place a script as a resource in your project and you can even write your own editor with JavaScript or C# and you can distribute these scripts on their market place. If we went that route for LGM we would have to add a new resource folder to the tree among other things, but again, I have no idea if we should go this route or what route anyone else wants to go for the extension system revamp.

However one thing that everyone could do to speed this along is to go and upgrade to Java 8, which is one of the most quickly adopted Java versions in history because of all the new features. I strongly encourage you all to upgrade.
https://java.com/en/download/index.jsp
« Last Edit: October 25, 2014, 05:50:54 am by Robert B Colton » Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Male) Josh @ Dreamland
Reply #4 Posted on: October 25, 2014, 11:56:44 am

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
Actually, I don't really understand this one—in general, I'm a fan of GraphViz (Prefuse?), but in this case, the interface seems not to offer any new information; it seems to just be an unscalable rehash of the current system. What happens when you try to display an actual game? I've never seen a finished game with less than 20 objects, and I've never seen an event which had about three non-code DND tiles. This presentation just won't work for real games.

That said, the interface could be effectively used to display inter-resource dependencies. For instance, if it showed "Objects" -> (Group name)* -> (Object name) -> (Script name)*, that would be mostly tractable (as long as you had to click a group to make it the root and display its objects). It would also be useful for people when they wanted to change the behavior of a script—especially if you could filter by script name.

The same can be said for most combinations of resources. It'd be easier to bundle resources into loadable/unloadable packages if you could quickly see what all references them.

Showing actual code, though, just won't scale.

JDI exports expressions as trees, not whole pieces of code. A complicated expression looks like this or this:


An entire script would not be fun or easy to navigate in this form. I'll be adding that capability for my own debugging purposes, but it's not something we really want to hand users.
« Last Edit: October 25, 2014, 12:00:40 pm by Josh @ Dreamland » Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) TheExDeus
Reply #5 Posted on: October 25, 2014, 03:31:17 pm

Developer
Joined: Apr 2008
Posts: 1860

View Profile
As I said there are many ways to improve what is shown. I was advocating the idea in general though. Right now this is like Gource. It shows the project as "gmk", then each resource type as a child of that, and then each resource as a child to each type node. Then things like objects also have events and code. It might be clearer and easier to use if it was more in a tree form, but this is also cool. We could make it more practical, but I also liked only the visualization in general, as it shows scope of a project.
Logged
Pages: 1
  Print