[1.2] Algodoo Mod System Now has Network Plugin!
25 posts • Page 1 of 1
[1.2] Algodoo Mod System Now has Network Plugin!
Algodoo Mod System
by ags131
This is a plugin system I have wrote in VB.NET. It is capable of receiving and sending commands to/from algodoo using thyme. It has been tested with and requires 2.0.2b15 and will NOT operate on older versions (Use 1.0 for older versions).
1.0 uses the same method used by all previous interfaces such as externet, reading the logfile. In fact, it would be simple to implement something like externet. Done! See AMSNetPlugin!
1.1 uses the new system.WriteToFile function in 2.0.2 b15 and later to avoid the difficult hooking that 1.0 is forced to use.
Download 1.0 (1.9.9 and up): http://dl.dropbox.com/u/10471884/Algodoo%20Mod%20System.zip
Download 1.2 (2.0.2b15 and up): http://db.tt/iqsjvt3u
NOTE: Some plugins are not included in 1.2 yet. I will add them once I get them updated. A few things changed in 1.1 that made it much easier to write plugins.
The only currently included plugins are AMS Net Plugin (Added in 1.2) and AMSSoundMod, play sound from within algodoo with the following functions:
Current Plugins:
Sound Mod (Included)
Portex Programmer (Included)
Net Plugin (WIP) (Included)
Want to write your own plugin?
To write your own plugin, simply create a new class library, add a reference to AMSPluginSystem, and implement IPlugin. After compiling, copy the resulting DLL to the Plugins folder of AMS. (NOTE: Project must be compiled for .NET 2.0! (3.5 or lower for v1.1 and up) Otherwise your plugin will NOT be loaded!) Thats it! The console will show that your plugin has been loaded.
1.0 Info
1.1 Info
by ags131
This is a plugin system I have wrote in VB.NET. It is capable of receiving and sending commands to/from algodoo using thyme. It has been tested with and requires 2.0.2b15 and will NOT operate on older versions (Use 1.0 for older versions).
1.0 uses the same method used by all previous interfaces such as externet, reading the logfile. In fact, it would be simple to implement something like externet. Done! See AMSNetPlugin!
1.1 uses the new system.WriteToFile function in 2.0.2 b15 and later to avoid the difficult hooking that 1.0 is forced to use.
Download 1.0 (1.9.9 and up): http://dl.dropbox.com/u/10471884/Algodoo%20Mod%20System.zip
Download 1.2 (2.0.2b15 and up): http://db.tt/iqsjvt3u
NOTE: Some plugins are not included in 1.2 yet. I will add them once I get them updated. A few things changed in 1.1 that made it much easier to write plugins.
The only currently included plugins are AMS Net Plugin (Added in 1.2) and AMSSoundMod, play sound from within algodoo with the following functions:
- Code: Select all
scene.AMS.musicplay("PATH\\TO\\MUSIC\\FILE");
scene.AMS.musicstop();
scene.AMS.sndplay("PATH\\TO\\SOUND\\FILE");
NOTE: The alias are only in the AMS Intro scene, the connecter by default does NOT add alias.
Use scene.AMS.send("musicplay","PATH\\TO\\MUSIC\\FILE") and similar for any other scenes.
Current Plugins:
Sound Mod (Included)
Spoiler: show
Portex Programmer (Included)
Spoiler: show
Net Plugin (WIP) (Included)
Spoiler: show
Want to write your own plugin?
To write your own plugin, simply create a new class library, add a reference to AMSPluginSystem, and implement IPlugin. After compiling, copy the resulting DLL to the Plugins folder of AMS. (NOTE: Project must be compiled for .NET 2.0! (3.5 or lower for v1.1 and up) Otherwise your plugin will NOT be loaded!) Thats it! The console will show that your plugin has been loaded.
1.0 Info
Spoiler: show
1.1 Info
Spoiler: show
Last edited by ags131 on Sat May 19, 2012 5:07 pm, edited 5 times in total.
- ags131
- Posts: 71
- Joined: Thu Oct 29, 2009 4:14 pm
Re: Algodoo Mod System
Neat, now someone make an external sound mod.
-
Mystery - Posts: 2802
- Joined: Thu Sep 03, 2009 1:16 pm
- Location: Southern Australia
Re: Algodoo Mod System
Mystery wrote:Neat, now someone make an external sound mod.
ಠ_ಠ
TheWinkits wrote:They both looks of cuking amazing
-
Chronos - [Most Active Member 2010]
- Posts: 4457
- Joined: Mon Aug 31, 2009 6:00 pm
- Location: Californania
Re: Algodoo Mod System
Chronos wrote:Mystery wrote:Neat, now someone make an external sound mod.
ಠ_ಠ
I thought you two were making one?
Ive got a working network system now, Trying to isolate a bug where the buffer isnt being cleared at the moment.
- ags131
- Posts: 71
- Joined: Thu Oct 29, 2009 4:14 pm
Re: Algodoo Mod System
This is awesome! Finally we have modding in Algodoo! Now I can add my long wanted feature of stickyness.
-
Sonic - Posts: 1467
- Joined: Tue Sep 01, 2009 6:18 pm
- Location: America!!!
Re: Algodoo Mod System
I now have a simple sound plugin for AMS.
It can play most common formats, (MP3,Wav,Ogg,etc)
Place this in the onCollide event of a ball.
(Sound Plugin is in the download now)
I also added the Net Plugin I'm working on, it currently works but has a bug where it doesnt clear the buffer of previous messages. :S
It can play most common formats, (MP3,Wav,Ogg,etc)
Place this in the onCollide event of a ball.
- Code: Select all
geval("scene.AMS.sndplay(\"C:\\\\Windows\\\\Media\\\\WIndows Default.wav\")")
(Sound Plugin is in the download now)
I also added the Net Plugin I'm working on, it currently works but has a bug where it doesnt clear the buffer of previous messages. :S
- ags131
- Posts: 71
- Joined: Thu Oct 29, 2009 4:14 pm
Re: Algodoo Mod System
UPDATE: Added a AMS Intro scene to demonstrate sound in AMS and to give a quick Introduction to AMS usage.
- ags131
- Posts: 71
- Joined: Thu Oct 29, 2009 4:14 pm
Re: Algodoo Mod System
Anyone tried it? Any bugs/suggestions? Ideas for future plugins? If anyone is interested in making a plugin in either C# or VB, I will help you In any way I can.
- ags131
- Posts: 71
- Joined: Thu Oct 29, 2009 4:14 pm
Re: Algodoo Mod System
Sonic wrote:This is awesome! Finally we have modding in Algodoo! Now I can add my long wanted feature of stickyness.
We've had modding in algodoo, even had it for Phun before algodoo came out. Remember that SmartSnap thing I wrote in Python? That wasn't built-in.
Anyways, I'm glad you guys have gotten back to working on this, I would help if I had more time.
Please excuse my posts. I am extremely stupid.
-
cdh473 - Posts: 816
- Joined: Tue Sep 01, 2009 12:37 am
- Location: Yes
Re: Algodoo Mod System
I haven't done much since my last post, I'll work on this more if people are interested
IIRC, I had a working network plugin and a simple sound plugin
IIRC, I had a working network plugin and a simple sound plugin
- ags131
- Posts: 71
- Joined: Thu Oct 29, 2009 4:14 pm
Re: Algodoo Mod System
UPDATE!
I have updated AMS to version 1.1!
New Features:
Uses new system.WriteToFile() function in Algodoo 2.0.2b15 therefore removing the need for it to hook algodoo in any way. Thanks Emil!
Updated Interfaces to make coding plugins easier
Updated AMSSoundMod to work a little better. Sound is perfectly syncronized with Algodoo now
Please leave comments and let me know what you like, dislike, want added, or even plugin requests.
I have updated AMS to version 1.1!
New Features:
Uses new system.WriteToFile() function in Algodoo 2.0.2b15 therefore removing the need for it to hook algodoo in any way. Thanks Emil!
Updated Interfaces to make coding plugins easier
Updated AMSSoundMod to work a little better. Sound is perfectly syncronized with Algodoo now
Please leave comments and let me know what you like, dislike, want added, or even plugin requests.
- ags131
- Posts: 71
- Joined: Thu Oct 29, 2009 4:14 pm
Re: Algodoo Mod System
ags131 wrote:UPDATE!
I have updated AMS to version 1.1!
New Features:
Uses new system.WriteToFile() function in Algodoo 2.0.2b15 therefore removing the need for it to hook algodoo in any way. Thanks Emil!
Updated Interfaces to make coding plugins easier
Updated AMSSoundMod to work a little better. Sound is perfectly syncronized with Algodoo now
Please leave comments and let me know what you like, dislike, want added, or even plugin requests.
Great!
Is it possible to remove next error message?
Cannot find identifier "AMS" in ""
This message is shown when "AMS Intro.phz" is opened.
EDIT:
== How to reproduce ==
1. Open "AMS Intro.phz"
2. Sim.running = true
3. Close Algodoo.
4. Open "AMS Intro.phz" again.
Regards,
Tatt
NOTE: I'm not an Algoryx member.
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
-
tatt61880 - [Most Helpful Person 2010]
- Posts: 1150
- Joined: Mon Aug 31, 2009 5:45 pm
- Location: Tokyo, Japan
Re: Algodoo Mod System
Hmm... not sure where thats being triggered... All actual ams code should be in the laser. There may be remnents from previous partially operational versions though
- ags131
- Posts: 71
- Joined: Thu Oct 29, 2009 4:14 pm
Re: Algodoo Mod System
ags131 wrote:Hmm... not sure where thats being triggered... All actual ams code should be in the laser. There may be remnents from previous partially operational versions though
I've added "How to reproduce" in previous post.
NOTE: I'm not an Algoryx member.
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
-
tatt61880 - [Most Helpful Person 2010]
- Posts: 1150
- Joined: Mon Aug 31, 2009 5:45 pm
- Location: Tokyo, Japan
Re: Algodoo Mod System
Ahh thanks
Edit:
It looks like it may be an Algodoo bug, some reason, Scene and Scene.AMS is being serialized to the config.
I'm not sure how to prevent the error unless there is a way to create custom objects without using a laser or geom. (EX: not having to do scene.AMS=e.laser)
Then it should serialize without problem...
It's annoying when stuff thats not supposed to serialize serializes to config :/
I also went ahead and updated AMS Intro as I had forgotten to update the text. And I fixed the music stop which wasn't working. Ignore any warnings in AMS console saying "Cold not open sound file: C:\path\to\AMS\STOP"
Thats because using a blank string or non-existant file triggers a stop and since it now prepends the AMS directory to the audio file, if none is specified, my IF preventing the error fails :/
Edit:
It looks like it may be an Algodoo bug, some reason, Scene and Scene.AMS is being serialized to the config.
I'm not sure how to prevent the error unless there is a way to create custom objects without using a laser or geom. (EX: not having to do scene.AMS=e.laser)
Then it should serialize without problem...
It's annoying when stuff thats not supposed to serialize serializes to config :/
I also went ahead and updated AMS Intro as I had forgotten to update the text. And I fixed the music stop which wasn't working. Ignore any warnings in AMS console saying "Cold not open sound file: C:\path\to\AMS\STOP"
Thats because using a blank string or non-existant file triggers a stop and since it now prepends the AMS directory to the audio file, if none is specified, my IF preventing the error fails :/
- ags131
- Posts: 71
- Joined: Thu Oct 29, 2009 4:14 pm
Re: Algodoo Mod System
Scene.newVariablename is not supported officially (Scene.my.newVariablename is OK, but Scene.my.foo.bar is not OK ), I think.
Btw, when I executed AlgodooModSystem.exe, it executed all files which existed task in Algodoo/AMS folder. These files are created by Algodoo when AMS was not working. I don't think it's good to execute them.
Is it possible to ignore them?
Regards,
Tatt
Btw, when I executed AlgodooModSystem.exe, it executed all files which existed task in Algodoo/AMS folder. These files are created by Algodoo when AMS was not working. I don't think it's good to execute them.
Is it possible to ignore them?
Regards,
Tatt
NOTE: I'm not an Algoryx member.
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
-
tatt61880 - [Most Helpful Person 2010]
- Posts: 1150
- Joined: Mon Aug 31, 2009 5:45 pm
- Location: Tokyo, Japan
Re: Algodoo Mod System
Yes, that should be an easy fix, I'll just have AMS clear the folder on startup.
If anyone can come up with a better and more versatile method of getting the data into Algodoo from AMS then please share!
If anyone can come up with a better and more versatile method of getting the data into Algodoo from AMS then please share!
- ags131
- Posts: 71
- Joined: Thu Oct 29, 2009 4:14 pm
Re: Algodoo Mod System
Just updated AMS Net Plugin Will be uploading it shortly It is included in the 1.2 build , here is a screenshot of it in action:
There is a server built into the plugin, but I was also testing usage with an external server
I will be including both the standalone server and client with the plugin
New in 1.2:
Fixed bug where AMS would execute files created while AMS was closed. (Thanks tatt61880!)
Updated NetPlugin and fixed the bug where buffer wasn't clearing.
Added NetPlugin to main package
Added Standalone Net server and client (Both are fully compatible with NetPlugin
Added NetPlugin test scene
There is a server built into the plugin, but I was also testing usage with an external server
I will be including both the standalone server and client with the plugin
New in 1.2:
Fixed bug where AMS would execute files created while AMS was closed. (Thanks tatt61880!)
Updated NetPlugin and fixed the bug where buffer wasn't clearing.
Added NetPlugin to main package
Added Standalone Net server and client (Both are fully compatible with NetPlugin
Added NetPlugin test scene
- ags131
- Posts: 71
- Joined: Thu Oct 29, 2009 4:14 pm
Re: [1.2] Algodoo Mod System Now has Network Plugin!
I don't think zDepth is needed.
Next code has smaller overhead, in my opinion.
Regards,
Tatt
(Current AMS) wrote:Scene.AMS.send
(com, data)=>{
l.zDepth = l.zDepth + 1;
file = "AMS\\" + sim.time + "" + l.zDepth + ".out";
system.writetofile(file, sim.time + "\n" + com + "\n" + data)
}
Next code has smaller overhead, in my opinion.
(My suggestion) wrote:Scene.AMS.send
(com, data)=>{
l.zDepth = l.zDepth + 1;
file = "AMS\\" + sim.time + ".out";
system.writetofile(file, sim.time + "\n" + com + "\n" + data + "\n")
}
Regards,
Tatt
NOTE: I'm not an Algoryx member.
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
-
tatt61880 - [Most Helpful Person 2010]
- Posts: 1150
- Joined: Mon Aug 31, 2009 5:45 pm
- Location: Tokyo, Japan
Re: [1.2] Algodoo Mod System Now has Network Plugin!
Originally I didn't use zDepth, but when the functions are called rapidly, (Such as from a laser) Sim.time doesn't change and it starts appending to already created files. AMS considers everything after the first two lines as function arguments. I just haven't figured out a good way of handling the Thyme side yet... :/
And I'm looking into that bug report you sent, electronicboy said it worked fine for him, then screwed something up that prevented him from doing anything to the AMS folder... I'll check more when I'm back home and not on my laptop.
And I'm looking into that bug report you sent, electronicboy said it worked fine for him, then screwed something up that prevented him from doing anything to the AMS folder... I'll check more when I'm back home and not on my laptop.
- ags131
- Posts: 71
- Joined: Thu Oct 29, 2009 4:14 pm
Re: [1.2] Algodoo Mod System Now has Network Plugin!
ags131 wrote:Originally I didn't use zDepth, but when the functions are called rapidly, (Such as from a laser) Sim.time doesn't change and it starts appending to already created files. AMS considers everything after the first two lines as function arguments. I just haven't figured out a good way of handling the Thyme side yet... :/
The code which I suggested works fine for me.
ags131 wrote:And I'm looking into that bug report you sent, electronicboy said it worked fine for him, then screwed something up that prevented him from doing anything to the AMS folder... I'll check more when I'm back home and not on my laptop.
The issue doesn't occur when AMS folder is empty when you executed AlgodooModSystem.exe
NOTE: I'm not an Algoryx member.
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
-
tatt61880 - [Most Helpful Person 2010]
- Posts: 1150
- Joined: Mon Aug 31, 2009 5:45 pm
- Location: Tokyo, Japan
Re: [1.2] Algodoo Mod System Now has Network Plugin!
tatt61880 wrote:The code which I suggested works fine for me.
The code you posted works, BUT if a large amount of functions are called at once it tends to write 2 or more to one file. AMS is only capable of reading the first function in each file.
A normal file looks something like this:
- Code: Select all
23.129999 (Sim.time)
musicplay
shore.ogg
A "bugged" file where it writes faster than sim.time changes:
- Code: Select all
25.24999
sndplay
C:\Windows\Media\Windows Default.wav
25.24999
sndplay
C:\Windows\Media\Windows Default.wav
25.24999
sndplay
C:\Windows\Media\Windows Default.wav
In the second one only the first entry is processed. (That is an actual example from the bouncing balls)
- ags131
- Posts: 71
- Joined: Thu Oct 29, 2009 4:14 pm
Re: [1.2] Algodoo Mod System Now has Network Plugin!
ags131 wrote:tatt61880 wrote:The code which I suggested works fine for me.
The code you posted works, BUT if a large amount of functions are called at once it tends to write 2 or more to one file. AMS is only capable of reading the first function in each file.
A normal file looks something like this:
- Code: Select all
23.129999 (Sim.time)
musicplay
shore.ogg
A "bugged" file where it writes faster than sim.time changes:
- Code: Select all
25.24999
sndplay
C:\Windows\Media\Windows Default.wav
25.24999
sndplay
C:\Windows\Media\Windows Default.wav
25.24999
sndplay
C:\Windows\Media\Windows Default.wav
In the second one only the first entry is processed. (That is an actual example from the bouncing balls)
Is it difficult to handle bugged file with next version of AMS?
I've added "\n" for the purpose.
NOTE: I'm not an Algoryx member.
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
-
tatt61880 - [Most Helpful Person 2010]
- Posts: 1150
- Joined: Mon Aug 31, 2009 5:45 pm
- Location: Tokyo, Japan
Re: [1.2] Algodoo Mod System Now has Network Plugin!
Hmmm.. Possibly...
What do you think is the best way for thyme to be able to pass multiple parameters?
Currently every line after the function name is one.
I'm thinking about a format like below to account for the bugged files.
It would allow all functions in a bugged file to be processed.
Im thinking, that for multi-parameter functions, I will make the plugin register functions.
Ex:
Plugin calls
registerFunction("functionName",parameterCount) (Will use 3 as parameterCount in this example
then AMS creates a function like this with thyme:
Any Ideas/thoughts on this? Technically, with this system, I can remove all the scene.ams code except runonce (Which again, could be registered by AMS when it starts)
What do you think is the best way for thyme to be able to pass multiple parameters?
Currently every line after the function name is one.
I'm thinking about a format like below to account for the bugged files.
It would allow all functions in a bugged file to be processed.
- Code: Select all
sim.time
Function Name
parameter count
parameter1
parameter2
etc
Im thinking, that for multi-parameter functions, I will make the plugin register functions.
Ex:
Plugin calls
registerFunction("functionName",parameterCount) (Will use 3 as parameterCount in this example
then AMS creates a function like this with thyme:
- Code: Select all
scene.my.functionName=(param1,param2,param3)=>{
system.writeToFile(sim.time+".out",sim.time+"\nfunctionName\n3\n"+param1+"\n"+param2+"\n"+param3+"\n";
}
Any Ideas/thoughts on this? Technically, with this system, I can remove all the scene.ams code except runonce (Which again, could be registered by AMS when it starts)
- ags131
- Posts: 71
- Joined: Thu Oct 29, 2009 4:14 pm
Re: [1.2] Algodoo Mod System Now has Network Plugin!
Your method for plugin calls seams okay, Best method really considering how algodoos functions can only be called with as many parameters as its wrote to take.
I am working on the Algodoo side of runonce code, I have a concept involving AMS counting how many commands have been sent, algodoo recieving that value and processing the code using a counter and the number of send commands.
I will reply once I manage look at it!
I am working on the Algodoo side of runonce code, I have a concept involving AMS counting how many commands have been sent, algodoo recieving that value and processing the code using a counter and the number of send commands.
I will reply once I manage look at it!
When asking for help, READ THE STICKIES!
- electronicboy
- Posts: 1694
- Joined: Mon Aug 31, 2009 6:18 pm
25 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 12 guests