Hi All,
I am currently developing my own game engine. I would like to use scratch as a scripting engine. I guess this will give a new edge to my game engine. My engine will be in C++,JAVA and python. Is there a way that scratch exports its APIs for C/C++ users? Any suggestions. Scratch is completely implemented in squeak a variant of small talk. I am completely new to smalltalk, though I can learn small talk and hack into scratch, I would like a less time consuming alternative.
~Thanks
Shakti
Last edited by spmisra (2010-01-22 01:48:42)
Offline
That is quite ambitious. But smalltalk, fyi, is like a secure prison, no one comes in, and no one comes out.
If you need to learn smalltalk, you must be patient and very, very open to the strange syntax.
Speaking of which, I'd better continue learning smalltalk.
as for deporting the Scratch API... meh, that's probably unlikely, but i don't really know.
but personally, I'm more nto java, C++, and C.
If you need any help, you just need to ask.
Offline
Well cds56 as I told I would scratch to be a scripting language. More likely because I think its kind of conventional language independent. A visual language is always easier to learn and less error prone in writing syntax. I have this experience as I maintain a small visual language in the company. I guess one option can be to interface via RPC or some web services etc, but it will be slow and very very slow for a real time environment like games or anything. Another option can be converting the bytecode generated by the frontend to LLVM or JVM, which is still some task to do. Other option is designing a simple clone of scratch to run on JVM.
I am just wondering what to use. Right now I do not want to go for learning smalltalk or coding for it as I have other tasks to do. Any way I will not need the sprite manipulation part of scratch, just will be using it as a programing language. Or let me put this way, am not in a mood to learn small talk now. Well I know its easier said than done, but I am willing to give it a try on some feasible options.
cds56 or anybody - You are welcome to suggest and help.
Last edited by spmisra (2010-01-22 13:33:53)
Offline
so you want to use the scratch api in C++?
hmmmm.
scratch is programmed in smalltalk, using the squeak vm. the squeak vm is extensive, and you want to use scratch, for a midway interface between the C++ /java and the graphics?
I'm slightly confused. You would like to program in scratch, and generate the C++/java equivelant code?
That is doable, but I'm not sure what you mean.
You want a scratch where you can export the scripts as C++ source code?
meh, just options.
But scratch is very limited, but in different ways than conventional languages. moreso in speed than in other areas.
Offline
I quite get the idea: isn't it scratch-based scripting language to describe and animate the maps for your game? Well, then 10/10 for idea, but like -500 for thinking: man, this would be quite hard, I mean, even with all the stuff you have the idea of what's going on, how would you do a global broadcast over, if we're talking maps, like a thousand objects?
Offline
cds56 - I do not want to convert scratch code to C++, this will add an additional overhead of conversion. The more doable/fast approach will be to generate code for scratch/squeak VM and then convert the code to JAVA byte-code or LLVM byte code. This is like assembly to assembly translation. So if we can use JIT it will be quite practice. In-fact this is used by LLVM to translate JAVA byte-code to LLVM byte code. Once the byte-code is converted to JAVA byte-code then all the java classes will be available to it, so it can use java functionality or I can use this from JAVA byte-code also.
About speed, scratch has some other functionality that I will not want and may be modify some other functionality. You can see Alice http://www.alice.org/ from CMU too. So after use speed bottle neck can be achieved. I found out some smalltalk implementation in C++. May be we can add it as a scratch back-end.
http://syx.berlios.de/
http://smalltalk.gnu.org/
filo5 - As I told earlier also, I wont mind to add/remove some features. I would like experiment on some visual scripting for the game so that people can use game states quickly. May be a block combined programing included in the Scratch can help like in blender. I am not building a commercial game engine, its just for my fun and learning, so I am not afraid of doing some experiment on this.
I feel the idea of scratch is sweet, but it remains confined to its own domain. But I feel it has the capability for serious programing also.
Offline
I think you might want to concider creating a very similar visual programming interface without using Scratch itself, Just like Stencyl did.
Smalltalk/Squeak indeed is some kind of Data Prison...
If you want to use the Scratch code, there will be no other option then editing the source code.
Scratch already has a feature to export projects to text, Chirp can export scripts to XML. You might want to concider sending these scratch-generated data through a socket or something.
Check the BlockSpecs inside the source code to edit the scratch blocks to fit your syntax.
Offline