Closed blurymind closed 6 years ago
What would be hard and new for me in the case is implementing a yarn parser behavior for gdevelop - to print out text on the screen. I am not sure how this is done and would appreciate any examples or code that might help me understand this :)
I guess that if you can get the parsing done to JSON, it's easy then to manipulate this in Javascript and write a few conditions/actions to expose it to GDevelop :)
The main thing to consider when wanting to "bundle" a software or feature like this is:
So enlarging the surface covered by a software like GDevelop is always tempting, but here I'm afraid that it will make things harder to maintain, especially if the other project is not evolving or used a lot.
Feel free to make me reconsider things though :) But I think other part of GDevelop would need some love first.
I can see the potential in this for making none linear dialogues but in case it is no longer maintained I don't think it worth it. It might be easy to hook it up to GD and read the texts from it, but in my opinion each scene should have it own Yarn editor so we can keep the dialogues separated for each scene, then we definitely need some dialogue events to kick off and switch between dialogues using a node name. For example I could have a dialogue to talk with Mark about picking the carrots then an other set of dialogue to talk to Mary about to feed the cows. When I talk to Mark or Mary, I need to be able to set which dialogue to start by entering the node name or something. Then I also need to be able to pass information to Yarn, because Mark want me to pick 10 carrots, but what if I have only 6 and I want a different Node to be triggered if I never talked to Mark, if I have 10 carrots or in case I talked to Mark but I have less than 10. The dialogue system need to process that and switch to the corresponding node. Finally, it should also display the dialogue and options to choose from, using the Text object would make it even more work. I think it should have it own text object with this node system in mind to display the text and options to choose from.
Wondering if it would be the same effort to make one from scratch that integrates perfectly with the event system and create the dialogues directly in the events editor similar to how it works in RPG Maker.
Hi, It is maintained, but not as often as Piskel is. The last update to the codebase was 2 months ago.
I am actually thinking of making my own fork, since it required some changes to get it to work with electron. The main version was designed for nwjs, so I amended some code to port it over to electron on my build - get it to load and save files. I will try to get them to migrate the app to electron and see how that goes.
I also added a new feature to make it easier to create links to other nodes:
I added a few new features to the js parser to help my project a bit (bondage.js): https://github.com/jhayley/bondage.js/pull/33 I got it to work in my personal project - yarn has a new button that saves and closes- sending the data to my app as an object to be parsed.
So I am at a point where I have some understanding of both and am genuinely interested in using them both beyond my personal project. If you are interested in allowing to bundle it, I am vouching to help maintain the electron fork of yarn- hopefuly geting the original developer to migrate to it as well. I will release my fork on github in the weekend hopefully.
In the last 10 years there has been no alternative to Yarn that is as good and simple as Yarn, while also being web based, open source and battle tested on released games.
The goal with this is to make gdevelop a better tool for storytellers - on par with game maker and renpy
Alot of the work to get it to work with Gdevelop has been done and tested on my project that is also electron based, but getting it to be userfriendly on gdevelop consists of also creating a new "Story scroll" behavior that prints and advances text from the yarn object, using bondage.js
@ddabrahim you can check and set yarn story variables inside yarn- that makes it very easy to set what you require straight in it. You can also register your own commands with bondage.js that are gdevelop specific - so getting the two to communicate both way is actually quite easy. Getting gdevelop to set yarn story variables and also yarn to check gdevelop game variables. I got all of that functionality on my electron project already.
I'm not a dialogs guy, but I would really like to know how GD events would look using this feature, which kind of conditions / actions are we talking about?
In RPG Maker we can make dialogues using simple if-else statements right in the event editor but in RPG Maker each object has it own event sheet which make it more simple to keep it organised. in GD we can use external events in a similar fashion for dialogues, at the moment I'm not convinced if Yarn on it own would make a huge difference to be honest, except in case each scene would have it own instance of yarn.
One way I could imagine the events with Yarn is to simply have an action to start a dialogue and pass a node name to it, For example StartDialogue("Mark") then it would get the instance of Yarn for the current scene and look for the Node "Mark". Once found the node, Yarn should compare the story variables then to see where are we in the story and kick off the corresponding node in the node tree of "Mark" and return the text. But, in my opinion it should not only return the text that we can display but it should also return the options and we should have a new text object dedicated for dialogues to do less condition checking manually and let the dialogue system do the heavy lifting. We would just write the dialogues in yarn, pick options, set values and the dialogue system should take care of the rest.
@Lizard-13 The way I am thinking of approaching this from end user point of design is to have a "Yarn Story" game object that serves to render text - kind of like a smart resizable text label. I would probably copy and extend the text object in gdevelop to have a text object that wraps the text, but it also has some extra functionality and variables ontop. With its contents dictated by bondage.js
The text contents - will be replaced by the yarn data resource's text during runtime. So they are updated by bondage.js technically- having the text scroll out of the box,
All of the below could be set/get during runtime (via event sheet logic) or within the properties editor:
Only for the event sheet (conditions):
Only for the event sheet (Actions):
Basically we are exposing the functionality of bondage.js to gdevelop editor. Bondage.js is a library to communicate with and control yarn story objects.
Setting and starting it is actually very similar to what @ddabrahim is describing. Its super easy, but very powerful/flexible Btw you can set and check variables without leaving yarn editor- without having to set them up in gdevelop. Bondage.js does all the work of interpreting the flow for you- so no need to set up event sheet for the dialogue flow at all. Yarn editor can also parse commands to gdevelop and even call javascript functions if you want to from it like this <<myfunction(parameters)>>.
So it's quite sweet in the end - because with very little work you can get an npc talking and storing your choices in the yarn data resource itself during runtime. The event sheet in general is only needed to set up how text scrolling is handled by input, or for special cases to trigger some sprite animation
Update on this: I did some work on writing a rendering procedure for yarn stories. It uses bondage.js and a tiny bbcode parser to do it's job and is tiny. I added it to my fork of yarn itself, but it can also be very easily reused by gdevelop/other engines (tested on my personal project)
I updated the first post to add a gif of it in action with some description. It still needs some polish, but its almost there now
It is looking promissing actually. One thing, if we end up having this in GD, could you make it so that the yarn story is saved as a separated file for each scene? So in case we are working in a team, can one person work on the story and dialogues and others on other parts of the game and just grab the yarn story and import it in to our project?
I did actually requested recently (yesterday) to make GD projects modular, instead of having everything stored in a single json file, would be better if the content would be divided in to separated modules/files. I don't expect this to happen overnight for the existing features but would be nice if we would go in to this modular direction with any new features from now on if possible.
Thanks.
A few idea/notes:
@4ian That is also an option :) We can just use the text object. The only reason I suggested to extend it is that I figured how to do scrolling with bbcode on my renderer
But having a richtext label should be its own object imo- if that ever becomes available in gdevelop.
If you guys are interested I can give it a go and make some pull requests - to integrate my electron ported yarn with new features and bondage.js into gdevelop - similar to how we did with piskel - but its actually much simpler this time. As noted bondage.js already takes care of most of the parsing functionality and story conditions checking- no need to use event sheets to drive the story- only to drive what happens on the screen as the text scrolls (cut scenes/player controller pausing during chat). I will need help to expose it to the editor though. Is it possible to use javascript to extend the gdevelop runtime in a plugin way? If so- is there an example to look at somewhere?
@4ian on game saving - bondage.js can interpret story data from standard json files or straight from an array. It has an online demo here: http://hayley.zone/bondage.js/
example files here https://github.com/jhayley/bondage.js/tree/master/tests/yarn_files
It keeps track of user choices and that can also be exported/saved
But having a richtext label should be its own object imo- if that ever becomes available in gdevelop.
Yes the idea is to favor small reusable objects over a large "do-it-all" yarn specific objects that would be a pain to maintain and could not be reused for other creative things :) A richtext label would there be a solution.
Before going any further, please remember that all of this is experimental and for now I don't plan to maintain it in the long term. This should still be considered as a third party extension should it be created (contrary to particles or Piskel, which I consider "officially" part of GD5 and maintained by me if necessary). Just don't want to waste your time even if trying is always nice to see what you can do :)
I will need help to expose it to the editor though. Is it possible to use javascript to extend the gdevelop runtime in a plugin way? If so- is there an example to look at somewhere?
For now, you would need to add a folder with some C++ sources files in Extensions
, expose it here and compile it (https://github.com/4ian/GDevelop.js).
It's not well documented. I suggest that you go and hack things into the runtime (you can edit GDJS/Runtime
folder and launch npm run import-resources
in newIDE/app
folder to copy your changes into GDevelop 5 (then launch the preview).
(If you want to iterate faster, you can also create a script to copy to GDJS/Runtime into the temporary folder where previews are created).
By "hacking" things into the runtime, I mean use an existing objects and tweak/modify it (maybe the text object ;)), and same for conditions/actions (try to find some that are not used a lot to do your tests).
@4ian on game saving - bondage.js can interpret story data from standard json files or straight from an array. It has an online demo here:
use json - avoid specific format as much as possible
@4ian another option is to use javascript straight in a gdevelop project and keep it separate- expose it that way. I wish gdevelop had a pure js addon system that did not require dealing with any c++ or recompiling
If that is planned, I will wait for it, before trying anything
This is not planned for now as there was not much demand. I do agree that it would be great still :) But the current way is the easiest it was to transition from GD4 to GD5 while still maintaining full compatibility and without rewriting all extensions (which would be a huge waste of time).
So you can start with Javascript straight into a GDevelop project. Who knows, maybe we can innovate and see later how to package custom Javascript as modular "lightweight" extensions providing conditions/actions or even objects/behaviors. A long term idea that I'd like to explore is to create more modularity by allowing such extensions to be created using JS or even events themselves.
@4ian perhaps we should check on the community forum if people would like to see it in gdevelop? I personally think that it will give the engine an edge over the competition - taking more advantage of its open source nature, but it is perhaps out of scope for the overal design.
I will continue to develop it for my personal project and contribute to yarn's development anyways :) The embedding and implementation is almost complete here. Seems to work ok , but will need more testing
A dialogue system if done right would be definitely welcomed by the community, the trouble is, as long it doesn't cost money and got it for free I don't think anyone would say no for it but in case you want feedback I think you should try the forum, Not sure how many users are on GitHub. Considering GDevelop targeting people who don't know or don't want to code, my guess is that you find more users on the forum than here.
Would be nice to see indeed a plugin system that would allow us to use JSON and JS to add new events, objects and behaviours maybe even expressions and even modify existing ones without need to recompile anything. This way, if people would like to play around with things don't need to worry about that the feature they are working on never going to make it in to a public release. Also in case multiple people would like to make their own implementation of the same feature, can do and people can choose which one is better. People could also make money by selling their plugins which would definitely also help to bring more devs to GD.
An other note for the end, GD4 compatibility should be not a priority any more in my opinion. We have technically sacrificed years of work made by the community in forms of tutorials, documentations and examples in favour of a new IDE, new workflow, new design and better Linux and MacOS compatibility, Makes no sense in my opinion to try to keep compatibility between the two version under the hood. I also don't really understand the point of maintaining two JavaScript codebase, Pixi.js and Cocos2D.js. Pixi.js become very popular, used by many companies in commercial projects, I would recommend to drop Cocos2D too. I see no benefit in Cocos.
Anyway, Good luck I hope for the best.
I think that a big part of both construct2 and clickteam fusion's success is due to the fact they have addon systems that are easy to develop for. Hell, their community could integrate a whole 3d engine in both - and those are proprietary apps
Beware of the "feature creep", which is very easy to get as a developer or contributor: it means to always being added new features for the sake of "this would be nice if gdevelop could do xxx...".
Don't be wrong here: the only thing GDevelop really need is new tutorials. With more tutorials, people would watch/read them, be more proficient with the software, and lots of tutorials on Youtube or 3rd party website would offer better visibility to the game engine.
(edit: I'm not even sure we can consider the MMF extension system as being "super easy to develop". They were successful because everybody know about it - while GDevelop is not advertised a lot).
Don't get me wrong: contributions are super useful and I do hope to see again things like Piskel or all the contributions from other contributors recently. That's super cool. But don't confuse success with lots of feature: with lots of tutorials and advertising, GDevelop is 10 times more evolved than what is needed for most people to create super nice games and make the software successful ;)
Also note that I say this because I was very focused when I was younger to add new features because it was cool. It was also a mistake. People do want new features, but first people need tutorials. Even if people don't say so, they prefer a software which does a few things, but a few things well, with lots of explanations and polished features, rather than a lots of things, but without tutorials and without being polished.
Edit: the data are very clear. More than 50% of the feedback I get about GDevelop is "cool but where can I find tutorials?". More. than. 50% ๐ฑ
That's the reason behind my question at the beginning of the thread:
Who will write the docs for using this and make tutorials for it? GDevelop is already missing tutorials :)
Even for Piskel, we almost have no mention of this on the wiki. We should at least have 4 or 5 different pages telling about this feature and how to use it!! :) I added a link on the website, but this would need a brand new page only to tell about it and how to use it. Sometime I think I should stop the development for 2 or 3 months and only do marketing about GDevelop until I observe a substantial amount of new users :)
(again that being said, I'm super open to new features like this one, just trying to find the right balance so that we're all successful in what we're doing for GDevelop :) I also don't want to discourage you or anything - just that we are all aligned about what is the current state of GDevelop and that we don't make false assumptions about success just because we do like something)
@4ian One thing I was thinking about - if this gets more interest to integrate in the newIde - is to create a new example/template project for the newIde that demonstrates how to use Yarn in the context of a gd game. I was thinking of a small rpg game room where you walk around a village and talk to the npcs - demonstrating all the features of bondage.js
Since rpg maker users are the main target demographic I want to lure to gdevelop- I will also make a video where I explain how the project is structured and how to create a new npc in the newIde - demonstrating how easy it is and how much better the story editor is. Then it would be cool to also publish the example project with the video as a web game on itch.io, where I have an account :) In any case that was my plan with this. Here is an example: https://ansimuz.itch.io/tiny-rpg-forest btw he has some awesome free assets we can use in our templates https://ansimuz.itch.io/
I didnt think that piskel in the context of gdevelop needs a tutorial, but it does need some coverage. When I asked gamesfromscratch to cover it, he just retweeted my post on twitter. Since he has a big audience,it would be awesome if we can get him to make some tutorials/coverage for the newIde. He has already made some for construct, fusion and the old ide.
The reason I mention the plugin system in other engines is to note that construct2 exposes the engine's ide to javascript and their addon system makes it easy to extend the engine without recompilation- thus why it has so many community made addons.
But you are right, a big part of our problem is the lack of video tutorials on youtube for the newide. We need to come up with some sort of an initiative.
One thing I would suggest is to put all demo games we have so far on itch.io - and put gdevelop's logo on the title/splash screen with a link to gdevelop. You can also embed the newIde on itch.io. Btw, if you are interested- I can start doing that to try and increase our presence there
Btw, if you are interested- I can start doing that to try and increase our presence there
Yeah sure, that's a great idea! Let me know if you need anything.
a new example/template project for the newIde that demonstrates how to use Yarn in the context of a gd game
Yes, I mean that's not even optional, it's a must have! Most people that want to try something new just launch the examples to see how it works.
Having more examples would also be an easy way to improve GDevelop audience I think :)
The reason I mention the plugin system in other engines is to note that construct2 exposes the engine's ide to javascript and their addon system makes it easy to extend the engine without recompilation- thus why it has so many community made addons.
I do agree that it's a good way to have more community made addons as it's more approachable.
On the topic of examples - somebody has uploaded gdevelop examples on itch.io: https://gametemplates.itch.io/gdevelop-examples
But there are two problems with that :
We need to create an official presence on itch.io to help increase the user base imo Would you like me to create a gdevelop group there? That is another way I can help
I would be happy to help with examples, what do you think would attract new users?
On Sat, 9 Jun 2018, 10:34 am Todor Imreorov, notifications@github.com wrote:
On the topic of examples - somebody has uploaded gdevelop examples on itch.io: https://gametemplates.itch.io/gdevelop-examples
But there are two problems with that :
- They are not a part of an official gdevelop group
- They are not running embedded in the browser- so people can't get a quick demonstration of gdevelop's capability.
We need to create an official presence on itch.io to help increase the user base imo Would you like me to create a gdevelop group? That is another way I can help
โ You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/4ian/GD/issues/511#issuecomment-395955123, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ8mi9k2iJ2cBx16KKWQraAuwQvsmYkwks5t65algaJpZM4UX10x .
The only thing I don't understand what sort of tutorials would help?
@4ian When you see people asking for tutorials, what sort of tutorials they would like to see? In the platformer and the tank shooter tutorial we have covered a lot. What is exactly missing, what information? What I see is that people are keep asking about the same things over and over again that we have already covered.
@zatsme I have shared tons of examples, no one cared to download them https://gametemplates.itch.io/gdevelop-examples And when I asked what examples to do, no one had an idea which means people don't need examples. I have also shared project files of more complete game . People have no use for them unless you are ready to document it but as I mentioned all the basics already there in the platformer and tank shooter tutorial
@zatsme More variety of 2d games running in the browser. It would help if you download a free tileset from here: https://itch.io/game-assets/free
and create a small game room, then uploaded it as a web game to itch.io with a zip file of the project of the game and a link to gdevelop in the description
@ddabrahim it will help if you create an individual itch page for each example you have - embedded like this: https://ansimuz.itch.io/tiny-rpg-forest So people can play the example in the web browser. We need the examples to look good- so if you dont have any cool graphics in them - use free pixel art packs from itch
@blurymind this is what I did. I was dedicated the itch.io page to GDevelop, Each example had it own page and I have also embeded the examples in to the page so people can try before download.. No one cared :( So I moved all the GD examples on to a single page, and now I decided to dedicate the pages to complete games only. But when I asked the community what sort of game they would be interested in, I got no answer...
GD community simply has no use for examples the way I see it. Tutorials, step by step explanations maybe but there is all the basics explained in the platformer and tank shooter already. I have no idea what else to do...
@4ian one suggestion to make is - put gdevelop's logo in the loading splash screen - with the option to remove it of course. But the default is to have it there. @ddabrahim it's good to have them there as playable in the browser- even if you dont get comments
Later on they will come in handy for a bigger initiative. We need cool game demos running in the browser https://cronus.itch.io/ld40
Also note that on itch.io you have limited number of pages you can do for free. I think it 20. After 20 pages/projects you need to "request" more. Not sure if it free or not. I have already way more then 20 examples including other non GD related examples too...
@ddabrahim What you've made is super useful! I think you don't get the proper recognition for it because very few peoples discover your page. I almost forget it!!
What I could do is bundle every example as part of GDevelop. Again the problem is not the lack of examples that you've made, it's that out of 1000 persons that launch GDevelop, no one see them. If I add them as examples in the "Create a new project" window of GDevelop 5, everybody will be able to try it and it will be a great way to show GDevelop capabilities.
@blurymind Sorry for temporarily hi-jacking the thread ^^
@ddabrahim Again what you've made is super cool. I'm feel guilty of not seeing the potential of it before. I you agree, I could bundle all examples with GDevelop 5 (so when you start a new project, you have "Starter", "Examples" and "Tutorials"). If really think it would help a lot beginners. I'll give you as other contributors a free GDevelop pro subscription - and name in the future GDevelop contributors in the software :)
@4ian Yes, you can bundle them if you want. I'm happy if you think they are useful :)
This is essential, it should be easy to find examples or tutorials and docs right from the ide. I will make some small game examples, should we use a single sprite/tileset to make it easier and familiar for new users?
On Sat, 9 Jun 2018, 10:54 am Florian Rival, notifications@github.com wrote:
@blurymind https://github.com/blurymind Sorry for temporarily hi-jacking the thread ^^
@ddabrahim https://github.com/ddabrahim Again what you've made is super cool. I'm feel guilty of not seeing the potential of it before. I you agree, I could bundle all examples with GDevelop 5 (so when you start a new project, you have "Starter", "Examples" and "Tutorials"). If really think it would help a lot beginners. I'll give you as other contributors a free GDevelop pro subscription - and name in the future GDevelop contributors in the software :)
โ You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/4ian/GD/issues/511#issuecomment-395956262, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ8mi7ecTV4e04jtNa97MZMSfHVn2oV1ks5t65s7gaJpZM4UX10x .
Great! I'm 100% sure this will improve engagement of new users with GDevelop - and will benefit in the mid/long term.
I guess we can go back to Yarn discussion. Let's continue the one about example/contributions here:https://github.com/4ian/GD/issues/517
Thanks again, really appreciate it ๐๐
@zatsme I think you can go and use any tileset that looks good and is free to use. The platformer and shooter examples assets can be a starter, they have been made by Kenney (https://kenney.nl/) which is a highly skilled artist who made them freely available :) (he retweeted a few times the tweets from GDevelop showing his assets).
I recomend against using keneys if we already have done so. They have been used alot in other demos and have become kind of generic. If we want gd to stand out, our demos need to also stand out. Phaser is a great example of an engine with cool online demos . Itch has so many free sprite assets already
On Sat, 9 Jun 2018 11:03 Florian Rival, notifications@github.com wrote:
@zatsme https://github.com/zatsme I think you can go and use any tileset that looks good and is free to use. The platformer and shooter examples assets can be a starter, they have been made by Kenney ( https://kenney.nl/) which is a highly skilled artist who made them freely available :) (he retweeted a few times the tweets from GDevelop showing his assets).
โ You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/4ian/GD/issues/511#issuecomment-395956760, or mute the thread https://github.com/notifications/unsubscribe-auth/AGMbVRfkU11SsBVvwmIun8c-L2jHoEHCks5t651UgaJpZM4UX10x .
Update on this- it looks like they might consider merging my electron port to the main branch, but I need to iron some things out on it first. I added some features to bondage.js as well - the library to parse yarn files - to make it easier to mesh with other code. That is also going under review
Thinking about it now- it seems that in order for this to happen - gdevelop needs to first be able to parse yarn json files via bondage.js bundled with a plugin for the js runtime. I have no idea how to write a plugin for gdevelop yet. @Lizard-13 ,you have some experience with that. Would you be interested in exposing bondage.js to gdevelop as an addon? If you are busy with other things - can you recomend where to start with learning to write an addon for gdevelop's runtime?
The documentation is mainly this short page: http://4ian.github.io/GD-Documentation/GDCore%20Documentation/write_a_new_extension.html which was written for GD4 but still applicable to GD5, except that you have to compile using GDevelop.js: https://github.com/4ian/GDevelop.js
We should surely improve this doc or even move it to a dedicated README file in GDevelop 5. Note that for bondage.js, I think that you don't need to expose all features of it before being able to use it. I think that you just want to include it in the runtime to get started, which you can do by having an extension specifiying it as an include file for you actions or conditions: check Shopify extension for example https://github.com/4ian/GD/blob/master/Extensions/Shopify/JsExtension.cpp#L81
Extension have to also be declared in GDevelop.js here: https://github.com/4ian/GDevelop.js/blob/master/CMakeLists.txt#L95
And finally added to the list of loaded extensions for the JsPlatform here: https://github.com/4ian/GD/blob/master/GDJS/GDJS/Extensions/JsPlatform.cpp#L248
(then rebuild GDevelop.js)
For the beginning, maybe you can just hack the index.html to directly include your file and worry later about making an extension :)
@4ian which index.html can I use for testing my bondage.js binding? Do you mean https://github.com/4ian/GD/blob/master/newIDE/app/public/index.html ? :) Btw I already have written a bondage.js renderer here: https://github.com/blurymind/Yarn/blob/master/app/renderer.html https://github.com/blurymind/Yarn/blob/master/app/js/classes/renderer.js It supports bbcode rendering to html in order to achieve richtext. But I can easily change it to simply return text - so it is more suitable for gdevelop's textlabel
You can see the renderer in action if you try my fork of Yarn I wrote it in the style that Yarn is written- with functions and subfunctions to build a class with methods. It is very easy to initiate and control a yarn file running a story with it - presenting a dialogue box
For now I think we just need to return the text with a typing effect. The ability to execute commands with yarn is secondary. For gdevelop the commands from yarn could be used to call events in the event sheet (as condition - yarn command = "mycommand")
In yarn to call a command you put it inside <<mycommand>>
- everything in that format doesnt get shown to the player - but can be used to call game events while the text is printed
Do you mean https://github.com/4ian/GD/blob/master/newIDE/app/public/index.html ?
No I mean the index.html of the Runtime, which is there: https://github.com/4ian/GD/blob/master/GDJS/Runtime/index.html
When extensions ask for adding a file, the file is inserted during preview/export generation in place of (using a <script src=...
tag).
So my idea is that you can always start by manually change this file to import your bondage.js file if you don't want to create an extension for now.
Unrelated note, but I would say to be cautious about bbcode. It's getting quite old and I don't think it's achieving mass adoption (outside of forums). Markdown could be a better option in my opinion - I can see lots of different products getting support for it as it's super simple and quite easy to understand. Another advantage is that it's looking good even without a renderer for it.
@4ian this is awesome! I will give it a try maybe in the weekend :) I will remove the bbcode stuff for gdevelop. In the future we could use markup syntax for gdevelop - but that should be implemented as another extension. This one will only return a string (with a configurable typing effect) of the text that is to be presented to the player. Whether the presentation is done via gdevelop's text label or some other rich text label should be handled outside of the scope of this extension and be up to the game designer.
@4ian this is really cool! One question - does gdevelop make a cache copy of that file somewhere? It looks like when I make changes to it after the initial run- it doesnt update.
EDIT: It looks it copies it in
newIDE\app\resources\GDJS\Runtime
And another question - is it possible to execute javascript commands to the runtime index via the event sheet? So for example I could use gdevelop's event sheet to call yarn commands with js - even before I have them registered via the plugin api. I think gdevelop 4 allowed js execution, but I cant seem to find it in the newIde
Can I include npm modules in it, or it can I only include js scripts. I guess I need to rewrite my bondagejs parser a bit more if thats the case
It looks like when I make changes to it after the initial run- it doesnt update.
You have indeed to run by yourself import-GDJS-Runtime.js
script everytime you make a change to the Runtime/index.html (or any JS file in the GDJS Runtime): cd newIDE/app/scripts
then node import-GDJS-Runtime.js
to start it :)
For now it's only done automatically when you start newIDE, but I think later I can add a watching script that will automatically update the files when you make a change :)
is it possible to execute javascript commands to the runtime index via the event sheet
I'm not sure to understand what you mean by "execute javascript commands to the runtime index"? The index file is just a file that is referencing the JS files of the engine and then starting it. ๐
Events sheet code is generated (when you launch a preview or when you launch an export) in files named codeXXX.js (code0.js, code1.js...). These files will also be included in index.html
for example I could use gdevelop's event sheet to call yarn commands with js
The extensions can declare actions and conditions, and wire them to a real Javascript function (using SetFunctionName, for example here: https://github.com/4ian/GD/blob/master/Extensions/Shopify/JsExtension.cpp#L83)
In these functions, you can do whatever you want :) Note that you can also use JS events in the events sheet, which generate a Javascript function that is called, so it's almost equivalent as using an action/condition.
(Sorry if my answer is not what you were asking, feel free to ask again!)
Can I include npm modules in it, or it can I only include js scripts.
You mean in GDJS Runtime? The runtime is only "basic" JS files (not transpiled by babel and not using npm modules) for maximum compatibility with browsers and older JS engines, and also to ensure that the size of the runtime is not exploding. So you have to provide JS files for bondage.js that are including everything that you need.
@4ian ah thank you for explaining. This is fantastic for quickly testing stuff! I meant for example calling an element in the index file by it's id for example. I meant exactly using JS events in the newIDE - is that possible? I couldn't find them :) EDIT: sorry, I found it ๐ No idea how to access elements on the index file still - it seems it gives me access to game objects though
I think that it will greatly help me test it before even trying to register the methods in my class via the extension api
On the inclusion of bondage.js- luckily it has a single file minified js file version - I just need to change some parts of my code to get it to work again
@4ian gdevelop is not copying the external js scripts I am including in the index file to the tmp folder where the game is created and running
Do I need to add them somewhere else?
You have to run node import-GDJS-Runtime.js
and then relaunch a preview. If it's becoming to long to do it each time, you can also launch the script manually: go in GDJS/scripts
, and run CopyRuntimeToGD.bat
(on Windows) or ./CopyRuntimeToGD.sh
(on macOS/Linux) followed by the tmp folder path. Then reload the preview.
The last approach works only for changes in JS. Any change in index.html need the script to be launched and preview relaunched from GDevelop. Anyway you should not have to modify index.html more than once or a few times :)
@4ian even when running the script, it is refusing to copy my js files to the tmp/preview directory
The changes to index.html file work, but adding new js files doesnt
I need to add two files: bondage.min.js and yarnParser.js
Description
Stories,often told through text are a very common thing in games. Especially indie games- be it rpg, action rpg, visual novels or even simple platformers. This is so common that every time I start writing my own dialogue/story system- it feels like I am reinventing the wheel rather than making my game fun.
Some engines are built for telling stories- the rpg maker engines (http://www.rpgmakerweb.com/) for example are very popular for that reason. But so is renpy (https://www.renpy.org/) and others like twinery (http://twinery.org/) They all have very vibrant communities, full of creative people with stories to tell
Looking at gdevelop- its a very good and user friendly engine- but it doesnt have a strong storytelling toolset like the others listed. The user has to do a lot of work to create and manage a dialogue tree system and the editor has no tools to write non linear stories
Solution suggested
A few years ago I discovered YARN - a story system and editor already used on some commercially successful games: https://github.com/InfiniteAmmoInc/Yarn The yarn editor is all web based, very tiny (500 kb) and super easy to use. Its written in javascript/nodejs and the story files it outputs are simple json format. Now the editor hasnt seen much updates officially, but the indie game community has been quietly using it on more and more games-focusing more on developing more implementations of the story parser.
While the official yarn story parser was written for the Unity3d engine, recently I found out that somebody has rewritten it in js and released it as an npm package here: https://www.npmjs.com/package/bondage
There is already an npm library that interprets yarn story files that we can use - bondage.js. I was able to succesfully integrate it with yarn itself and add the capability to test the story https://github.com/jhayley/bondage.js
The library takes care of remembering user made choices (storing and checking yarn variables without leaving yarn or having to write event sheet logic in gdevelop) I added text scrolling and support for bbcode ontop of it. My code is embeddable, so in theory should be easy to integrate into gdevelop as well. The only bulk of the job is exposing all of this to gdevelop as an object and event sheet actions/conditions to trigger it.
My suggestion is to bundle Yarn editor and the bondage.js yarn story parser with gdevelop. It will make creation of story based games much easier on gdevelop.
The reason I am suggesting it is that I already had looked into its source code and ported Yarn to electron for another personal project that integrates it with three.js :p
The question is - is there any interest in having Yarn bundled with gdevelop? I know it's kind of becoming my shtick to glue open source projects recently, but after playing some of the games made with Yarn editor and using it myself - I definitely see a lot of value in it. It might help us attract some twinery users to gdevelop imo
What would be hard and new for me in the case is implementing a yarn parser behavior for gdevelop - to print out text on the screen. I am not sure how this is done and would appreciate any examples or code that might help me understand this :) Getting yarn editor itself inside gdevelop and have it communicate with gdevelop would be easy- as I already know how to do that.
In any case, are you interested in this? Without approval from @4ian I wont even attempt it