Should I offer graphical programming?

For discussions about game development that does not fit in any of the other topics.
Post Reply
User avatar
a_bertrand
Posts: 1537
Joined: Mon Feb 25, 2013 1:46 pm

Should I offer graphical programming?

Post by a_bertrand »

Hi guys,

I'm really wondering if I should offer a way to game developers to develop their logic via some sort of graphical programming and avoid to write scripts like they currently need to do to customize the behaviors. This is what I have for the default monster behavior for example:

Code: Select all

// Default monster behavior. If not re-written on the monster code, this default code will be used.
// Function called on each game loop to run monster attacks, or others.
function Handle(monster)
{
    // If the player is in a NPC dialog the monster should just randomly walk around.
    if(Player.IsInDialog() == true)
    {
        Monster.RandomWalk(monster);
        return true;
    }
    
    // If the monster is near the player, he shall try to attack.
    if(Actor.DistanceToPlayer(monster) <= Monster.RetreiveSetting(monster,'ProximityAttack'))
    {
        Attack(monster);
        return true;
    }
    
    // Moves toward the player if it's nearer than 10 tiles.
    Monster.HuntWalk(monster, 10);
    
    // If we returns false the engine would handle it for us.
    return true;
}

// Handle Monster attacks.
function Attack(monster)
{
    if(Actor.DistanceToPlayer(monster) > Monster.RetreiveSetting(monster,'ProximityAttack'))
        return false;
    if(Actor.IsAnimationRunning(monster))
        return false;
    // Check if at least @BaseRechargeSpeed@ sec passed between the attacks. If not skip the attack.
    if(Actor.TimerRunning(monster, 'Attack'))
        return false;
    // Starts the Attack timer, to avoid to attack too frequently.
    Actor.StartTimer(monster, 'Attack', Monster.RetreiveSetting(monster,'AttackSpeed'));
	Actor.SetAnimation(monster, 'attack');
    Actor.ExecuteWhenAnimationDone(monster, 'AttackAnimationDone');
    return true;
}

// Attack after the animation is done
function AttackAnimationDone(monster)
{
    damage = Monster.RetreiveSetting(monster, 'BaseDamage'); 
    damage = damage - Inventory.GetWearedEffect('Protection');
    if(damage <= 0)
        return true;
    Player.ReduceStat('Life',damage);
    Player.SetAnimation('damage');
    return true;
}
It would be possible to display the same logic in some "graphical" form, either as a tree, or like a collapsed list of instructions. The advantage is that it may be easier for new-comers to edit those logic but, it would make the work on the script a lot more complex for experts. That's why I would not replace the text scripts completely, but more as an option. What do you think? Any opinion on the subject?
Creator of Dot World Maker
Mad programmer and annoying composer
User avatar
a_bertrand
Posts: 1537
Joined: Mon Feb 25, 2013 1:46 pm

Re: Should I offer graphical programming?

Post by a_bertrand »

I have a first test for a node view of the scripts. Clearly it's not the easiest script I choose (it's the default monster behavior as before), and the view is not ready either (would need still quite some work), but it should give an idea of how that could look like in my opinion. As you see it's a list of "boxes" with what kind of box it is, and the parameters under.

https://dotworldmaker.com/tests/test_graphview.html

The idea would be that you can add more blocks by choosing them from a list, and fill in the parameters in the same way. For most scripts it would work, comments currently are dropped but I could somehow maybe add them somewhere.
Creator of Dot World Maker
Mad programmer and annoying composer
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Should I offer graphical programming?

Post by hallsofvallhalla »

Hmm i personally like scripting better but that is just me. I could see a kismet like option like Unreal has but to me what you have for graphical seems very confusing. Maybe just me though.

Image

Image
User avatar
a_bertrand
Posts: 1537
Joined: Mon Feb 25, 2013 1:46 pm

Re: Should I offer graphical programming?

Post by a_bertrand »

What you propose here is a node graph. While certainly not so difficult to make the issue I have is that you can't generate those graphs from the script as there is no coordinates in the script. Also those are either event driven or data driven, and don't allow to code loops. I know that currently my thing is quite confusing, I shall try to improve a bit the layout and maybe it will be a bit clearer to you.

Again it's not a replacement of the text script which in my mind remains superior, it's just a way to let non-developers start creating something.
Creator of Dot World Maker
Mad programmer and annoying composer
User avatar
a_bertrand
Posts: 1537
Joined: Mon Feb 25, 2013 1:46 pm

Re: Should I offer graphical programming?

Post by a_bertrand »

Now I have nearly the visual result I was looking for:
Capture.PNG
You can test it live here:
https://dotworldmaker.com/tests/test_graphview.html

By passing the mouse over one block it highlights it such that you know what belongs to what level. I Still need to be able to collapse / expand blocks, and then I will need to implement all the editing.

At the end the idea is that you have a 2 tab editor, you choose at any point to either edit it as blocks or via text.
Creator of Dot World Maker
Mad programmer and annoying composer
User avatar
a_bertrand
Posts: 1537
Joined: Mon Feb 25, 2013 1:46 pm

Re: Should I offer graphical programming?

Post by a_bertrand »

Ok made it so that it's all collapsed by default, click on the block title and it will expand showing the content. It's not all perfect, for example just the expand collapse "icon" is currently just a + / - text, and some blocks don't have any expansion possibility so they should not show the icon at all. But that may help dig into it. Please comment out the idea such that I know if I shall or not go on with this as the next step would be to be able to edit the tree with drag drop of new nodes for example.
Creator of Dot World Maker
Mad programmer and annoying composer
Oroton
Posts: 39
Joined: Wed Dec 02, 2015 4:56 am

Re: Should I offer graphical programming?

Post by Oroton »

this looks awesome.. reminds me of Flex
User avatar
a_bertrand
Posts: 1537
Joined: Mon Feb 25, 2013 1:46 pm

Re: Should I offer graphical programming?

Post by a_bertrand »

Flex you mean the language XML based which is inside Flash?
Creator of Dot World Maker
Mad programmer and annoying composer
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Should I offer graphical programming?

Post by hallsofvallhalla »

Wow yeah MUCH better! I love it! This will be a huge hit amongst the non coders and graphical people. This will also help kids who are trying to learn. I can definitely have my daughter test.
User avatar
a_bertrand
Posts: 1537
Joined: Mon Feb 25, 2013 1:46 pm

Re: Should I offer graphical programming?

Post by a_bertrand »

Ok I have a first somewhat working editor:

https://dotworldmaker.com/tests/test_grapheditor.html

You can drag blocks around, to re-order them, or delete them (if you drop them on the empty space), or add them if you take them from the right list.

You can also fill in the parameters / values, and expand / contract the nodes.

What remains to do, is to add some help when you over the items, and add some check to see if that block construction could potentially work or not. The 2 tabs on the bottom are currently not working, but will let you switch between the 2 views of the code, and will be remembered. Switching from one to the other should keep all feature (hopefully) beside special formatting.

Please test it out, and give me your opinion. As said it's not finished, some cosmetic work needs to be done, and more smartness too.
Creator of Dot World Maker
Mad programmer and annoying composer
Post Reply

Return to “General Development”