Data Realms Fan Forums
http://45.55.195.193/

Concept: MOPixel Drawing
http://45.55.195.193/viewtopic.php?f=73&t=15822
Page 1 of 1

Author:  Kyred [ Sun Jul 12, 2009 5:22 pm ]
Post subject:  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.

Author:  Kyred [ Sun Jul 12, 2009 5:24 pm ]
Post subject:  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

Author:  LowestFormOfWit [ Mon Jul 13, 2009 6:46 am ]
Post subject:  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.

Author:  Disst [ Mon Jul 13, 2009 7:01 am ]
Post subject:  Re: Concept: MOPixel Drawing

I want a Cortex Command sierpinski triangle generator.

Author:  Kyred [ Mon Jul 13, 2009 7:35 am ]
Post subject:  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.

Author:  mail2345 [ Mon Jul 13, 2009 8:10 am ]
Post subject:  Re: Concept: MOPixel Drawing

MOID looping and RootID checks.

Author:  piipu [ Mon Jul 13, 2009 9:54 am ]
Post subject:  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.

Author:  Kyred [ Tue Jul 14, 2009 12:02 am ]
Post subject:  Re: Concept: MOPixel Drawing

piipu wrote:
Edit: Actually, Lua seems to handle recursions differently. Some fiddling will be needed.
Really? Please elaborate.

Author:  piipu [ Tue Jul 14, 2009 11:34 am ]
Post subject:  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.

Author:  Kyred [ Wed Jul 15, 2009 11:43 pm ]
Post subject:  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.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/