View unanswered posts | View active topics It is currently Thu Dec 26, 2024 4:53 pm



Reply to topic  [ 10 posts ] 
 Concept: MOPixel Drawing 
Author Message
User avatar

Joined: Sun May 31, 2009 1:04 am
Posts: 308
Reply with quote
Post Concept: MOPixel Drawing
Well...we can't draw lines, but we can draw with MOPixels :D. This draws a spire using settled MOPixels, line by line, from the bottom up. The original plan was to see if I could make an effect of a wall or rock shooting up out of the ground. However, the drawing process is somewhat slow, so there went that idea :razz:

Image Image*Note: Not a normal RPC

The .gif is a little choppy because I only rendered every 3rd frame to cut down on file size.

So what can you do with this? Well, what I want to do is create a cool teleport effect. The actor disappears into a swarming cloud of MOPixels, which then move to the "out" teleporter's location. Then the MOPixels move into predefined positions and settle there, slowly redrawing the actor. Then the real actor bursts from the settled MOPixels. Laggy? Yes. Complicated? Yes. Impossible? No.


Sun Jul 12, 2009 5:22 pm
Profile
User avatar

Joined: Sun May 31, 2009 1:04 am
Posts: 308
Reply with quote
Post Re: Concept: MOPixel Drawing
Almost forgot the code:

Code:
function Create(self)
    self.Lifetime = 10000;
    self.targetPos = nil;
    self.timer = nil;
    self.timerx = Timer();
    --self.box = nil;
    self.height = 0;
    for actor in MovableMan.Actors do
         if (self.Pos - actor.Pos).Magnitude < 50 then
             self.owner = actor;
         end
    end
end

function Update(self)
    --print("Hyes!");
    local bool = false;
    if self.timer == nil then
       if self.timerx:IsPastSimMS(50) then
          --print("check3");
          bool = true;
          self.Vel = Vector(0,0);
          self.timer = Timer();
          self.targetPos = self.Pos;
          self.timerx = nil;
       end
    else
         if self.timer:IsPastSimMS(1) then
            local start,endp = 0,0;
            if self.height < 50 then
               start = -1*(62-self.height);
               endp = start*-1;
            elseif self.height >= 50 and self.height < 476 then
               start = -12;
               endp = 12;
            else
               start = -500 + self.height;
               endp = start*-1;
            end
            for i = start, endp, 1 do
                local pix = CreateMOPixel("ChardPixel");
                pix.Pos = self.targetPos + Vector(i,-1*self.height);
                MovableMan:AddParticle(pix);
                ToMovableObject(pix).ToSettle = true; --Important Part!
            end
            self.height = self.height + 1;
            self.timer:Reset();
         end
    end
end


Sun Jul 12, 2009 5:24 pm
Profile
User avatar

Joined: Mon Oct 06, 2008 2:04 am
Posts: 1559
Reply with quote
Post Re: Concept: MOPixel Drawing
Very, very cool. So much you could do with that. Can you draw it 2 lines at a time to perhaps save you the time and speed it up?
Also, make a gun used to erect a statue of yourself right over a conquered enemy base.


Mon Jul 13, 2009 6:46 am
Profile
User avatar

Joined: Thu Feb 12, 2009 1:47 am
Posts: 1182
Reply with quote
Post Re: Concept: MOPixel Drawing
I want a Cortex Command sierpinski triangle generator.


Mon Jul 13, 2009 7:01 am
Profile
User avatar

Joined: Sun May 31, 2009 1:04 am
Posts: 308
Reply with quote
Post Re: Concept: MOPixel Drawing
LowestFormOfWit wrote:
Very, very cool. So much you could do with that. Can you draw it 2 lines at a time to perhaps save you the time and speed it up?
Also, make a gun used to erect a statue of yourself right over a conquered enemy base.
I forgot. AHumans don't have a single bounding box since they are composed of several actors >_<. That might make creating a MOPixel clone a little more difficult.


Mon Jul 13, 2009 7:35 am
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Concept: MOPixel Drawing
MOID looping and RootID checks.


Mon Jul 13, 2009 8:10 am
Profile
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post Re: Concept: MOPixel Drawing
One sierpinski generator coming up. I have one I made with C++, shouldn't be too hard to convert it to Lua.
Edit: Actually, Lua seems to handle recursions differently. Some fiddling will be needed.


Mon Jul 13, 2009 9:54 am
Profile
User avatar

Joined: Sun May 31, 2009 1:04 am
Posts: 308
Reply with quote
Post Re: Concept: MOPixel Drawing
piipu wrote:
Edit: Actually, Lua seems to handle recursions differently. Some fiddling will be needed.
Really? Please elaborate.


Tue Jul 14, 2009 12:02 am
Profile
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post Re: Concept: MOPixel Drawing
In C++, if I have a function that calls itself and the called function modifies it's variables and then ends, the original function still has the variables unmodified. In Lua, the original function's variables are replaced with the modified variables, causing my recursion to end before it should. I got over this problem when I converted the thing for my calculator using some fiddling with tables, but I don't have the program anymore, and I can't remember how exactly I did it.


Tue Jul 14, 2009 11:34 am
Profile
User avatar

Joined: Sun May 31, 2009 1:04 am
Posts: 308
Reply with quote
Post Re: Concept: MOPixel Drawing
piipu wrote:
In C++, if I have a function that calls itself and the called function modifies it's variables and then ends, the original function still has the variables unmodified. In Lua, the original function's variables are replaced with the modified variables, causing my recursion to end before it should. I got over this problem when I converted the thing for my calculator using some fiddling with tables, but I don't have the program anymore, and I can't remember how exactly I did it.

I didn't know C++ did recursion like that. I'm used to the way Java does it, it simply puts the function call on the higher end of the processing stack. So if you save the recursive returns to a table/array, then the last entry comes first, and the first entry comes last. I'm assuming this is how Lua does it.


Wed Jul 15, 2009 11:43 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 10 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.051s | 13 Queries | GZIP : Off ]