Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411574 Posts in 69386 Topics- by 58444 Members - Latest Member: darkcitien

May 04, 2024, 04:38:51 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)anybody any experiences in programmaticaly generated flowcharts ?
Pages: [1]
Print
Author Topic: anybody any experiences in programmaticaly generated flowcharts ?  (Read 1813 times)
nikki
Level 10
*****


View Profile
« on: March 03, 2010, 06:22:55 PM »


i want to implement a reasonably simple scripting engine, or rather use an existing one (lua) ,

i am looking for examples to make it appear graphically, like a flowchart, where the user connects boxes, and fills in values in the boxes.

Is there something like that out there ?
Or have you made such a thing a can point me in the right direction?
Logged
Fallsburg
Level 10
*****


Fear the CircleCat


View Profile
« Reply #1 on: March 04, 2010, 11:19:54 AM »

Well, I don't know exactly what you are looking for, but the best opensource graph software out there that I know of is Graphviz.

http://www.graphviz.org/

Hopefully, that will help.
Logged
nikki
Level 10
*****


View Profile
« Reply #2 on: March 04, 2010, 01:02:50 PM »

i think i wasn't very clear, let's hope this one is better Wink

I'd like to implement a scripting capability to my game.
In my game the user will be able to 'create' new objects and have an actor that can interact on them.
Because the object kan contain data that are actually if-else statements to work together with the actor methods, I thought to have the look and feel of flowcharts that a user can create and manage, and that will output to code that LUA could handle...

jees, it's still hard to write it down..

edit:




is the user end

and this kind of mumbo comes out...

Code:
type actor


type object
 
var actor:actor
method interact()
 if pathpossible(actor,self)= true
     actor.move(selfposition)
 else
     actor.playanimation(someconstant)



« Last Edit: March 04, 2010, 01:29:55 PM by nikki » Logged
BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #3 on: March 04, 2010, 03:11:00 PM »

One way of doing it you probably haven't considered:
Don't allow arbitrary placement of boxes, and lines. Instead, force users to build up their structure. I.e. you must drag and drop a whole loop, or if statement, rather than random boxes with links. This is much easier to layout, and you are coding at a higher level (arrows are like GOTOs; evil).

I'm also not explaining myself right, so look at this to get an idea of what I mean. They are beautiful flowcharts, and if you look at how they are designed, it is nested compositions of sequences, loops, and if/switches.

Here's an example code, as getting it is quite a pain.

  create-index-stmt {
    stack
       {line CREATE {opt UNIQUE} INDEX {opt IF NOT EXISTS}}
       {line {optx /database-name .} /index-name
             ON /table-name ( {loop indexed-column ,} )}
  }


Gives this:
Logged
shrimp
Level 5
*****


View Profile WWW
« Reply #4 on: March 05, 2010, 11:28:16 PM »

I'm not sure how much help it is, but Martin Fowler has written a few things about Domain Specific Languages (i.e. a high-level language describing your systems, like the Lua output) and Language Workbenches, which is essentially what you are trying to implement:
http://martinfowler.com/articles/languageWorkbench.html

It's just background context though, doesn't really give any technical help.
Logged

Mikademus
Level 10
*****


The Magical Owl


View Profile
« Reply #5 on: March 06, 2010, 03:05:34 AM »

arrows are like GOTOs; evil

OT, but that's prejudices, and I don't like to see naive drivel and myths like that perpetuated. Goto statements, like arrows, simply are. There's nothing inherently evil about them. Any construct can be used in a bad way, just as they they can be used well. Early BASICs and some other languages had no other control mechanisms. Of course their programs became ugly messes. If they had only had "while", would you consider that keyword evil? Roll Eyes

Sorry for the thread hijack.
Logged

\\\"There\\\'s a tendency among the press to attribute the creation of a game to a single person,\\\" says Warren Spector, creator of Thief and Deus Ex. --IGN<br />My compilation of game engines for indies
nikki
Level 10
*****


View Profile
« Reply #6 on: March 06, 2010, 03:43:53 AM »

@Ed thanks for that link, it was a good read.
Yesterday i started naively writing my own scripting language.... after i found myself defining tokens, getting them from a external script i quit.
That's not the way to go i believe, I'll probably use Lua (Since Blitzmax (my preferred language) has Lua communicating implementing.)

So then the problem turns to 2 smaller problems:
  • writing a Lua script in a graphical way instead of plain text, or translating a graphic to a plain text lua file
  • implement methods that can handle those Lua scripts in my blitzmax code.

I also tried to write down All the methods i'll be using, and it's not that many.
The thing i can't get my head around at this moment are the if statements.
how to script if-else statement (possibly nested), where the condition(s) and the result are to be filled in by the scripter.

edit: it's clear how to write a if statement, but how to create a higher abstraction out of this  (that's reuasble ) is unclear .



Thanks again Ed for the link cause now i atleast know of some terminology wich i can use to look further (domain specific language, visual scripting etc.)

« Last Edit: March 06, 2010, 03:55:42 AM by nikki » Logged
BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #7 on: March 06, 2010, 03:57:57 AM »

Does game make have some sort of graphical scripting?

arrows are like GOTOs; evil
OT, but that's prejudice.
Sorry, but "gotos are widely considered harmful and it's bad to structure all control flow in terms of them" didn't have quite the same ring. reference. No geek fight this time.
Logged
mcc
Level 10
*****


glitch


View Profile WWW
« Reply #8 on: March 07, 2010, 12:46:46 PM »

I've been thinking for awhile it would be really nice if there were some good open source base code for making flow charts like this that could be integrated into other programs.

Graphviz can generate some very nice images but I don't think it's intended for realtime stuff.

"Puredata" is an open source program that does visual scripting much like you want. Maybe you should look at that and see if you can raid it for graph drawing code. Unfortunately the graphs generated in this way are very ugly and I don't know how easy it would be to adapt their code to embed into something else.

Logged

My projects:<br />Games: Jumpman Retro-futuristic platforming iJumpman iPhone version Drumcircle PC+smartphone music toy<br />More: RUN HELLO
Chromanoid
Level 10
*****



View Profile
« Reply #9 on: March 07, 2010, 02:06:45 PM »

you could try netbeans platform (they have some stuff for visual editing etc.), swing (just use moveable jpanels in front of a jpanel that draws the connections), maybe JHotDraw is something for you https://sourceforge.net/projects/jhotdraw/

a while ago i tried to implement something similar (i wrote the gui stuff myself):

from that i only can advise against implementations that use finite state machine logics. maybe you can look at petri nets (i.e. http://renew.de is nice petri net editor) (petri nets are able to visualize concurrent processing and reusable structures)
« Last Edit: March 07, 2010, 02:12:14 PM by Chromanoid » Logged
lansing
Level 2
**


View Profile
« Reply #10 on: March 10, 2010, 02:21:05 PM »

polemic:

is there anything inherently good about designing a language to be graphical? 

I have a hard time seeing why it's better than just using a scripting language, or exposing a subset of one.  Graphs are useful for representing data, but I don't see the benefit to using them to design programs.
Logged
nikki
Level 10
*****


View Profile
« Reply #11 on: March 10, 2010, 02:30:02 PM »

Thanks for all the very cool links, ideas and search terms.
I am studying the Lua at the moment , and the sending of data between my own program and Lua.

@lansing

behind the scene it's not a new language thats graphical, it more c++ and Lua and a nice way to design a scriptfile, instad of a texteditor you can press a button with a mouse, type in some variables and have created a method()  Hand Fork Left Wizard Hand Knife Right .

The idea is to write/translate those graphical decisions back to a fresh .lua script, wich in its turn get read by the program. (atleast thats the theory Smiley)
 

Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic