Jump to content

TylerH

Members
  • Posts

    525
  • Joined

  • Last visited

Posts posted by TylerH

  1. You can code your own system in Lua that works instantly. If I can assume that if I grab an instance of ANOTHER script in a given entity's script, can I access the members defined in the OTHER script? Or does this multi-state setup prevent that currently?

     

    The single-state would clearly let you setup a global message system simply in Lua using an Input/Output structure like in Hammer.

     

    function entity:FireOutput(output,value)
    	for k,v in pairs(self.targets) do
    	v:FireInput(output,value)
    	end
    end
    

     

    The above would be instantaneous, because you are directly calling a function of the receiver from the sender's script. Hammer/Source engine does this EXACTLY in this way, except via C++ functors/callbacks, not Lua.

  2. I am in 100% agreement.

     

    Though I think the way the community can spearhead this, if not done by Josh (whom seems interested :D), is to go ahead and start making some of these objects.

     

    You made a 3rd Person Camera; if someone makes a First Person Camera, then someone else can make a First <-> Third person camera that you can switch between and change elevation angle via mouse wheel, and the list just goes on from there...

  3. I tried starting this, but no one has commented on my math_counter object, and almost no one has downloaded it.

     

    I know how to fix the problem you are talking about with the models too, but also, no one has spoken to me about it since I mentioned heading up this project.

     

    So PM Me, talk to me on MSN, or respond in my math_counter thread, and I will shed some light on it.

  4. Yeah, I use LinePick extensively in Weaponwerks, for obvious reasons.

     

    You simple create assign a variable to the return value of LinePick, it will be a table with the following values:

    local pick = LinePick(...)

     

    pick.entity (TEntity)

    pick.surface (TSurface)

    pick.position (vec3)

    pick.normal (vec3)

    pick.triangle (number)

  5. Yep, I was able to push that up to 120 bullets on screen, running bullet logic, keeping 60 FPS.

     

    I also made the gun shoot a non-tracer bullet by default, and will be implementing some logic for either every nth bullet being a tracer, or a tracer is fired to let you know you have n bullets remaining (i.e. either every 4 rounds, or say when you have 5 rounds left in the current clip).

     

    I also implemented colored tracers, so if you want crazy looking tracers, they will be as easy as setting weapon.TracerColor ;)

  6. It was fun to remove the ricochet count and angle checks, and just have 12 bullets flying around making ricochets forever. With 12 on screen, I got about 30 FPS, down from 60 FPS, which is believable, for the amount of math I am doing per bullet.

     

    Needless to say, I already know about 5 ways to optimize what I have currently, I already made a few changes and gained loads of frames I didn't know had ever been lost ;)

  7. I have successfully implemented hierarchical bullet ricochet, skimming, and skewing.

     

    Right now, the system will use this little bit of code:

    -- Process ricochets if they should still occur
    			if (bullet.ricochetcount < 3) then
    
    				local I = bullet.velocity--Subtract3(pick.position,bullet.origin)
    				local N = pick.normal--:Normalize()
    
    				local angle = 180 - math.deg(math.acos(Dot3(I,N)/(I:Length()*N:Length())))
    
    				if (angle < (60)) then return end
    
    				local R = Subtract3(I,N:Scale(2 * Dot3(I,N)))--:Scale(bullet.velocity:Length()*HOST_TIMESCALE)
    
    				local ricochet = CreateBullet(pick.position, R, Vec3(0.0,0.0,0.0), ricochets)
    				ricochet.ricochetcount = bullet.ricochetcount + 1
    			end
    

     

    Which grabs the bullet velocity (our incident vector), the normal of the surface we hit (the normal), calculates the angle between these two (which will be obtuse, so we subtract from 180 to get an acute angle that is easier to run comparisons on relative the bullet and player).

     

    Presently it is hardcoded to ignore impacts for ricochet if the incident angle is less than 60 degrees. To explain, when you think of a protractor, where the far right flat line is 0, as you move up towards the top is goes from 0 to 90 , this is backwards of how the system works. The Normal is 0 degrees, and as the bullet angle towards the impact point gets close to parallel with the surface that the normal is from, it gets closer to 90. It is checking to see the angle between the normal plane of the object you hit, and the bullet velocity.

     

    This has worked and given realistic results (minus that I didn't add friction, velocity fall off, etc. physical effects), and appears to be how this would work in real life.

     

    The next thing I want to work on is bullet penetration through surfaces, but I am not entirely sure how this is done, and wouldn't mind some suggestions or ideas on how to do this.

  8. You need to do a ForEachEntityInAABBDo on the mine, and run the a function to add massive amounts of force in vectors equivalent to the entity's position minus the mine position.

     

    Basically:

     

    for each entity in the bounding box (radius or whatever) of the mine

    forcevector = entity.position - mineposition

    AddBodyForce(entity, forcevector*500) // 500 is your force scalar or whatever

    repeat

×
×
  • Create New...