Want tS to work for you? Find out how at the Scriptors Meeting!

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

Want tS to work for you? Find out how at the Scriptors Meeting! // Collaboration

1  |  

Post by robert // Apr 26, 2009, 5:41am

robert
Total Posts: 609
pic
I know Frootee usually puts these posts, but I figured that I would this time.
Every Tuesday there is a Scriptors meeting held in Shared Space.
The information is on the Birds of a Feather page here: http://www.caligari.com/BirdsOfAFeather.asp

This week I will be showcasing something special, the start of particles in workspace.
I've recreated a Thinking Particles demo originally made with Cinema 4D.
Along with that other automations of various things may be showcased.

If you would like to learn about the Link Editor and how to make trueSpace do the work for you after writing a bit of code then this is the place for you!

-Robert

P.S. In case you're wondering which Thinking Particles demo I'm referring to... http://www.youtube.com/watch?v=Spiu-qGQh8o

Post by frootee // Apr 26, 2009, 5:53am

frootee
Total Posts: 2667
pic
Thanks Robert.
Please feel free to post the announcement whenever you like! :banana:

Cool. Particles in Workspace! :D

Post by robert // Apr 27, 2009, 2:13pm

robert
Total Posts: 609
pic
Just bumping this one to the top.
If you want to attend you don't need to post, just show up.

Although if you do want to see a coding example you can post your request and I can work on something.
Or someone else can pick up the tab. :p

Post by frootee // Apr 27, 2009, 5:38pm

frootee
Total Posts: 2667
pic
Requests?


Play some Skynyrd dude! :D


Looking forward to this Robert!

Post by spacekdet // Apr 27, 2009, 6:37pm

spacekdet
Total Posts: 1360
pic
Requests?

Play some Skynyrd dude!


Tuesday's Gone?

Post by frootee // Apr 27, 2009, 6:52pm

frootee
Total Posts: 2667
pic
hehehe Yeah That's what I'm talkin about. Good One! :D

Post by robert // Apr 28, 2009, 12:49pm

robert
Total Posts: 609
pic
Nice, I don't have any Skynard though. :(
In fact, I don't have much from that genre in general. :o

Post by robert // Apr 28, 2009, 1:54pm

robert
Total Posts: 609
pic
Reminding everyone, as much as myself, that it starts in just over an hour from this post.

Post by frootee // Apr 28, 2009, 2:10pm

frootee
Total Posts: 2667
pic
cool I'll be there Robert. :banana:

Post by robert // May 2, 2009, 5:24am

robert
Total Posts: 609
pic
I've completely altered the demo that I "showed" there.
Now it is much more complex, and has a central "brain".
This one involves spreading a "virus" through a "population" and changing the color of the "infected".
It also has a script to check the number of particles and rename the first one from just "Clean" to "Clean, 0" so it can be detected by the "brain".

I should have something working later today, I'll then post a link to the video which showcases the demo and describes how it works.

Post by trueBlue // May 2, 2009, 5:40am

trueBlue
Total Posts: 1761
pic
Awesome! I'll look forward to that as I am very disappointed I could not make the meeting last week.
:)

Post by frootee // May 2, 2009, 6:59am

frootee
Total Posts: 2667
pic
Very Groovy Robert. Lookin forward to it! :)

Post by robert // May 2, 2009, 7:17am

robert
Total Posts: 609
pic
I just realized something about the method I have in mind for tracking infected.
The method basically consists of renaming the particle from "Clean, #" to "Infected, #".
The trouble is that by doing it this way there will be gaps in the sequence which can cause errors.
I know I can check if the object is renderable before doing anything to it, but I was wondering if anyone knows about arrays in the tS JScript architecture.

See what I'm doing is is checking the proximity of each "Clean" particle with that of each "Infected" particle and if they are close enough the infection spreads.
Renaming works, I'm just wondering if arrays would work better.
I'm guessing not really since the scripts don't store information in themselves between cycles.

I plan on sticking with renaming unless arrays are clearly superior; I'm just curious is all.

Post by frootee // May 2, 2009, 7:32am

frootee
Total Posts: 2667
pic
Hi Robert.
I believe there is a Universal Array type. It can hold any complex type.

Connectors on nodes can be used to retain data from one script execution to the next:

Node.Value() = 5;

I cannot remember whether I use arrays in the fluid sim panel. I think I do.
Check out the listbox with the list of fluid sims. I think I implemented that as an array.

I'd say, if renaming works already, then stick with it; create a new copy of your scene, and
experiment with arrays.

Good goin!

Jason

Post by robert // May 2, 2009, 7:54am

robert
Total Posts: 609
pic
Yeah, you did.

I'm used to exporting several things to keep them for the next iteration.

I just think an array may be more trouble than it's worth.
If I do use an array the code will follow something like this:
for(i=0; i<numparticles; i++)
{
checking = name + ', ' + i

for(n=0; n<infectedarraysize; n++)
{
infected = name + ', ' + arrayvalue n
combined radii = radius checking + radius infected

if(distance < combined radii + X%)
{
increase array size by 1
add number i to the end of the array
change infected to true
}
}
}The thing is it will check all the infected particles against themselves, not a problem, but can be avoided.

Using just plain renaming you have to periodically update two separate numbers though, and check to make sure the object exists to avoid error.

I guess in the code above you could add a redundancy check so you don't need to check an infected particle.
Although I'm not sure how to check if a particle number is part of an array in a simple enough manner to avoid it cross checking with the particles before it in the array.

After writing it out it seems simpler to use an array.

Do you think you could quickly explain how the arrays work in tS, and how to lengthen an array without losing old info?

Post by robert // May 2, 2009, 8:12am

robert
Total Posts: 609
pic
Actually I think I got how it works by looking through your fluidsim importer.

Post by frootee // May 2, 2009, 9:36am

frootee
Total Posts: 2667
pic
Cool.

You know... in C++ you can use the vector class; it's basically an array type on steroids. :)


An array is typically static sized; with a vector, you can use the push_back function to add to the end of the vector. Also, you can access items in the vector just like an array: daval[34], for example. Or, use daval.at(34)


Hm come to think of it, I believe you can shrink and grow arrays in truespace scripting as well.


Yeah, that fluid sim script code has a Lot of good stuff in it. Harvest what you need. :)

Post by robert // May 2, 2009, 2:12pm

robert
Total Posts: 609
pic
Right I have the code which checks the inputs.
It renames the original object from "Name" to "Name, 0" so it can be used by the main script.
It grabs the numbers of the infected particles and puts them into an array.
If you have no infected particles it gives an entertaining warning.
If you misspell the name or have the particle number at 0 it warns you about that.
It also takes the inputted number of particles and shrinks it down to the actual number.
It doesn't move the number up to the correct number so always overestimate.

I may or may not get the main body script in tonight.
All it really does is periodically add impulses to keep the objects moving and then checks their distances from infected particles and reacts accordingly.
It's backwards, the main script is the easier one.:D

Post by robert // May 3, 2009, 7:27am

robert
Total Posts: 609
pic
I got tS to crash on me several times before finding out the problem was not of my doing.

Apparently
for(i = 0; i < #; i++)
{
}only yields "#-1" and never any of the rest.
It's all messed up.

Post by robert // May 3, 2009, 4:17pm

robert
Total Posts: 609
pic
*Laughing Maniacally* It's finished! *Thunderclap*

I even put it some info about what each of the settings are for.
I'll try and get the video in by tomorrow which showcases it and offers some explanation.

This thing was so much harder than it was supposed to be.
Oh well, now it works exactly how I want it to.

Post by robert // May 6, 2009, 1:14pm

robert
Total Posts: 609
pic
It has been done for a bit now, just trying to optimize a few things.
When working on the animation I had 100 particles and it wasn't going very smoothly.

Just now I realized why the for loop wasn't working and it's really obvious now.
I'm going to change the main script back again to the for loop and it should work better with higher particle numbers.

Post by frootee // May 7, 2009, 2:10am

frootee
Total Posts: 2667
pic
Excellent Robert. Looking forward to the video! :banana:

Post by robert // May 7, 2009, 4:59pm

robert
Total Posts: 609
pic
Alright, the animation finished. 50 particles with one infected one to start.
In under 25 seconds all 50 have become infected.

Just need to render out the animation and do a descriptive video to go with it.
I'll start a thread in the scripts section and will link to that when it all gets finished.

The script has undergone several revisions because of several interesting errors which have occurred.
It now works exactly like it should with no errors that I can detect.

Tomorrow is prom so I won't have it done then, Saturday sounds good.

Sorry it took so long, last minute things with exams and such.
Several versions of my code crashed tS, and that didn't help either.

Post by frootee // May 8, 2009, 2:15am

frootee
Total Posts: 2667
pic
Excellent Robert! :banana:

Post by robert // May 8, 2009, 7:36am

robert
Total Posts: 609
pic
Little teaser image.
Look here for details on it: http://sites.google.com/site/zukazamme/projects/in_flux

Here's where all new updates will be: http://forums1.caligari.com/truespace/showthread.php?p=100742

http://sites.google.com/site/zukazamme/data/Infection.png
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn