1. Post #401
    CapsAdmin's Avatar
    August 2005
    3,964 Posts
    Speaking of this, how come props aren't lit per triangle yet? Most modern games and I think CS:GO have lighting like that. In GMod either props, players, and viewmodels are always uniformly lit, which is unrealistic in many cases.
    because it's the source engine

    if CS:GO has it then gmod might get it too sometime in the future though :)
    Reply With Quote Edit / Delete Windows 7 Norway Show Events Optimistic Optimistic x 1Lua Helper Lua Helper x 1 (list)

  2. Post #402
    Gold Member
    Mr. Quiggles's Avatar
    July 2010
    179 Posts
    -snip because this is irrelevant to threading-

    Edited:

    I got chunk generation threaded, except the way it works... well... it seems to be sporadic. It doesn't do what Minecraft does, where it loads around the player.

    I'm currently trying to get a fancy formula/algorithm down to compare two chunks to their origins of which they were radially generated around, and if one of the chunks are closer to their origin than the other, then generate that chunk.

    There are a few issues, of course:

    o It's sporadic. It picks chunks willy-nilly.
    o Takes too long to generate chunks. ~52 12 to load all of them. Of course, I can adjust the delays, but I want to wait until I get this down before tuning it to the max before I get this.
    o For loops do not like returning inside of it. I don't know why, but it doesn't and just halts the entire process. It's a mess to the eyes without it.
    o Somewhat of a good and a bad, but it's in Tick().

    Here's a code snippet, but it's a wreck.

    Code:
    for A, _ in pairs(Threads) do
    	if (LastChunkLoad > CurTime()) then
    		// Do something here.
    	elseif (coroutine.status(Threads[A].Thread) == "dead") then
    		Threads[A] = nil;
    	elseif (Threads[A].Time < (CurTime() + 1)) then
    		for B, _ in pairs(Threads) do
    			if (A == B) and table.Count(Threads) == 1 then
    				coroutine.resume(Threads[A].Thread);
    				LastChunkLoad = CurTime() + 0.125;
    			elseif (A == B) then
    				Threads[A].Time = CurTime() + 1;
    			elseif (Threads[A].Time < CurTime() + 1) then
    				local aPOS = Vector( Threads[A].Chunk.X, Threads[A].Chunk.Y, Threads[A].Chunk.Z);
    				local bPOS = Vector( Threads[B].Chunk.X, Threads[B].Chunk.Y, Threads[B].Chunk.Z);
    				local aORIGIN = Threads[A].Origin;
    				local bORIGIN = Threads[B].Origin;
    				
    				if aORIGIN:Distance( aPOS ) < bORIGIN:Distance( bPOS ) then
    					coroutine.resume(Threads[A].Thread);
    					Threads[B].Time = CurTime() + 1;
    					LastChunkLoad = CurTime() + 0.125;
    				elseif aORIGIN:Distance( aPOS ) > bORIGIN:Distance( bPOS ) then
    					coroutine.resume(Threads[B].Thread);
    					Threads[A].Time = CurTime() + 1;
    					LastChunkLoad = CurTime() + 0.125;
    				elseif aORIGIN:Distance( aPOS ) == bORIGIN:Distance( bPOS ) then
    					coroutine.resume(Threads[A].Thread);
    					Threads[B].Time = CurTime() + 1;
    					LastChunkLoad = CurTime() + 0.125;
    				end
    			end
    		end
    	end
    end
    I think it would gain >9000% efficiency if I somehow get all the chunks to order itself based on how close it is to it's origin, and generate in order without calling the checks.

    Why on Earth am I coding at 4 o'clock in the morning?

    Edited:


    A Nice Stroll in Clock Town.
    Just add the chunks not generating, very bad frame rate, and the crash at the end due to chunks being unloaded! Yaaaayyyy....

    'gm_video' is convenient as I can easily upload to my Dropbox and don't have to worry about getting Dxtory to get the recording right, and then go into Sony Vegas and edit it, then upload to YouTube and wait. Alas, the quality. Then again I'm stuck with this shit MacBook.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  3. Post #403
    SHADERS
    Legend286's Avatar
    October 2008
    10,024 Posts
    Speaking of this, how come props aren't lit per triangle yet? Most modern games and I think CS:GO have lighting like that. In GMod either props, players, and viewmodels are always uniformly lit, which is unrealistic in many cases.
    Because how can you attenuate lightmaps without using dynamic shadows or something like Unreal Engine does. Sure you can do it for spotlights, but not for directional lighting which has no attenuation.
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Agree Agree x 1 (list)

  4. Post #404
    Gold Member
    FoohyAB's Avatar
    July 2009
    945 Posts
    Garry I don't know what you did, but that light cache issue seems to be gone in the newest update.


    Edited:

    Made rollercoaster nodes support garry's drive system:
    Reply With Quote Edit / Delete Windows 7 United States Show Events Lua King Lua King x 37Winner Winner x 2 (list)

  5. Post #405
    My Blog
    Spencer Sharkey's Avatar
    July 2009
    1,958 Posts
    Garry, these lighting functions are great and all and I love them,
    but is there a way we can get different shaders working with meshes? (Specifically VertexLitGeneric and WorldVertexTransition.. :D)

    The lighting functions are a tad slow to have to update the mesh every time lighting needs to change.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 2 (list)

  6. Post #406
    Please waste more of your money changing this title again.
    Gmod4ever's Avatar
    August 2005
    6,774 Posts
    Made rollercoaster nodes support garry's drive system:

    -awesome-
    Do you realize what you have done?

    If we have binaries that allow us to read various pieces of information from sound files (and I think we do), and we were to combine them with this system you have for dynamically creating tracks here...

    We could make Audiosurf in Garry's Mod.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Winner Winner x 17Artistic Artistic x 1 (list)

  7. Post #407
    foxcock
    Bletotum's Avatar
    June 2008
    6,873 Posts
    indeed!

    Edited:

    but i'm not sure how interesting it would actually be to ride a rollercoaster shaped to a song

    for instance, it could easily not generate enough speed to handle certain areas of a song correctly, without falling backward

    gravity resulting in speeds at all in rollercoasters kind of trashes the idea
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  8. Post #408
    Map in a box's Avatar
    July 2009
    7,293 Posts
    I've had too many problems with the "new" version of gm_BASS, I would just stick with fixing up the old one to work with beta. You'd just play the song at a higher pitch and go through the FFT.
    Reply With Quote Edit / Delete Windows XP United States Show Events Dumb Dumb x 3Useful Useful x 1Disagree Disagree x 1 (list)

  9. Post #409
    foxcock
    Bletotum's Avatar
    June 2008
    6,873 Posts
    That doesn't change how various songs wouldn't have functional coasters. All it would take is for a song to have roughly the same values for a few seconds and then spike upwards. A cart would not have the speed to make it over the spike.

    Additionally, the cart going at different speeds could not be reflected in the song playback without distorting it.

    Edited:

    this is why you move at a constant speed in audiosurf
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  10. Post #410
    Map in a box's Avatar
    July 2009
    7,293 Posts
    That's why you involve math.
    Reply With Quote Edit / Delete Windows XP United States Show Events Dumb Dumb x 3 (list)

  11. Post #411
    PROUD BRONY 4LYFE
    Drakehawke's Avatar
    February 2009
    3,312 Posts
    I doubt it would be too hard to make it move at a constant speed for the sake of replicating Audiosurf?
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Agree Agree x 2Dumb Dumb x 1Zing Zing x 1 (list)

  12. Post #412
    Map in a box's Avatar
    July 2009
    7,293 Posts
    Would probably be wise to make a seperate module specificly for analyzing musics
    Reply With Quote Edit / Delete Windows XP United States Show Events

  13. Post #413
    My Blog
    Spencer Sharkey's Avatar
    July 2009
    1,958 Posts
    I doubt it would be too hard to make it move at a constant speed for the sake of replicating Audiosurf?
    This~
    Reply With Quote Edit / Delete Windows 7 United States Show Events Disagree Disagree x 1 (list)

  14. Post #414
    Map in a box's Avatar
    July 2009
    7,293 Posts
    It isn't really hard to make music-aware games~~
    Reply With Quote Edit / Delete Windows XP United States Show Events Dumb Dumb x 9Artistic Artistic x 1 (list)

  15. Post #415
    Gold Member
    FoohyAB's Avatar
    July 2009
    945 Posts
    Do you realize what you have done?

    If we have binaries that allow us to read various pieces of information from sound files (and I think we do), and we were to combine them with this system you have for dynamically creating tracks here...

    We could make Audiosurf in Garry's Mod.
    If anyone wanted to make it, I could totally help with mesh creation. I've also had ideas to use my same system of nodes to make things like custom roads/tracks, for cars or other vehicles. That way you wouldn't have to always use a bunch of props for a custom road in a map.

    Meshes are great
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 2 (list)

  16. Post #416
    Gold Member
    Mr. Quiggles's Avatar
    July 2010
    179 Posts


    Instead of threading chunks one by one, why not thread the radial generation?

    There's something off about doing that though... As seen in the video, the Y chunks are loaded first, and then it loads all the X chunks. I don't know why. Maybe I need to call 'coroutine.yield()' when generating the final chunk inside the chunk generation command, instead of in the 'for' loop.

    Also, I theorized there could be a severe lag spike created when having a mass amount of chunks being generated at once. I may need to reincorporate threading single chunks. But instead of generating it based on how close it is to the origin, have it generate in the order they are called for generation.

    Meshes are great
    Ya, when they work.

    Edited:

    I fixed the issue with the Y chunks being generated first, then the X chunks. I relocated where the thread is yielded. But that theory I had about a severe lag spike. Well... It's now proven. I can't even record it without getting this again. Off to reimplementing the threading of single chunks.

    Edited:



    I reduced the amount of time it takes to load every chunk down to 5 seconds after initialization (~3 seconds after player spawned). What's odd is that it's still loading chunks along the Y axis first, but it's no issue if you're walking straight.

    Now to see if 32^3 chunk size would work. Usually sending chunk sizes 32+, 'net' has issues sending the table. More precisely:
    Code:
    [@lua\includes\modules\net.lua:138] Couldn't read type 12	Error	[C]:-1
    	ReadType	lua\includes\modules\net.lua:138
    	unknown	lua\includes\modules\net.lua:90
    	unknown	(tail call):-1
    	unknown	(tail call):-1
    	unknown	lua\includes\modules\net.lua:90
    	unknown	(tail call):-1
    	unknown	(tail call):-1
    	unknown	lua\includes\modules\net.lua:90
    	unknown	(tail call):-1
    	unknown	(tail call):-1
    	unknown	lua\includes\modules\net.lua:90
    	unknown	(tail call):-1
    	unknown	(tail call):-1
    	ReadTable	lua\includes\modules\net.lua:90
    	func	addons\world handler\lua\plugins\uforzyxdos\modules\sh_stream.lua:41
    I guess 16^3 is fine too...
    Reply With Quote Edit / Delete Windows 7 United States Show Events Lua King Lua King x 5 (list)

  17. Post #417
    foxcock
    Bletotum's Avatar
    June 2008
    6,873 Posts
    I doubt it would be too hard to make it move at a constant speed for the sake of replicating Audiosurf?
    by that point it would be a very useless rollercoaster, and not at all a replication of audiosurf

    Edited:

    That's why you involve math.
    you say that as if its simple to determine the velocity of a hypothetical cart along a track that's unfinished and make a curve to keep the song playing with it well

    rollercoaster audiosurf is pointless; like i said, high increases in intensity could not be accounted for
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  18. Post #418
    Map in a box's Avatar
    July 2009
    7,293 Posts
    by that point it would be a very useless rollercoaster, and not at all a replication of audiosurf

    Edited:



    you say that as if its simple to determine the velocity of a hypothetical cart along a track that's unfinished and make a curve to keep the song playing with it well

    rollercoaster audiosurf is pointless; like i said, high increases in intensity could not be accounted for
    You wouldn't determine the velocity, you'd already know it by calculating the slopes and clamping how slow the cart can go, simulating an engine moving you.
    Reply With Quote Edit / Delete Windows XP United States Show Events

  19. Post #419
    foxcock
    Bletotum's Avatar
    June 2008
    6,873 Posts
    The slopes of the cart would affect the speed. A five second piece of music that results in a track moving downward would need to be such a length and curve so that it takes five seconds to cross it. The velocity is required.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  20. Post #420
    Gold Member
    FoohyAB's Avatar
    July 2009
    945 Posts


    Edited:

    And of course you gotta have a backflip.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Winner Winner x 33Lua King Lua King x 6Funny Funny x 1 (list)

  21. Post #421
    kp3
    Gold Member
    kp3's Avatar
    January 2008
    2,986 Posts
    Are loops and corkscrews possible? It's really really cool what so ever though, Great job.
    Reply With Quote Edit / Delete Windows 7 Sweden Show Events Agree Agree x 1 (list)

  22. Post #422
    Gold Member
    FoohyAB's Avatar
    July 2009
    945 Posts
    Well at the moment no, but I know the reason why. I just need to figure out how to fix it.

    NoLimits ran into this same problem, but they fixed it with a "relative roll" checkmark, so I need to figure out what that does.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  23. Post #423
    garry's Avatar
    September 2001
    12,398 Posts
    Garry, these lighting functions are great and all and I love them,
    but is there a way we can get different shaders working with meshes? (Specifically VertexLitGeneric and WorldVertexTransition.. :D)

    The lighting functions are a tad slow to have to update the mesh every time lighting needs to change.
    I can look into why they aren't working right now and provide alternatives. The problem with VertexLitGeneric is that it isn't really vertex lit. I mean, it isn't per vertex lighting.

    For example - something big like that rollercoaster. It'd get the light at a single point and every vertex would be lit based on that point's lighting. Basically what someone said earlier in the thread.
    Reply With Quote Edit / Delete Windows 7 Show Events Informative Informative x 2 (list)

  24. Post #424
    My Blog
    Spencer Sharkey's Avatar
    July 2009
    1,958 Posts
    Oh right, that makes sense about the lighting thing. Is it even possible to do per vertex lighting (without rewriting a lot)?

    In any case the WorldVertexTransition would be awesome, I remember you mentioning something about a custom shader that'd let us have more than two blend textures too...
    Reply With Quote Edit / Delete Windows 7 United States Show Events Informative Informative x 1 (list)

  25. Post #425
    My Blog
    Spencer Sharkey's Avatar
    July 2009
    1,958 Posts
    Finally back from vacation!
    Reply With Quote Edit / Delete Windows 7 United States Show Events Informative Informative x 12Optimistic Optimistic x 1 (list)

  26. Post #426
    Gold Member
    Mr. Quiggles's Avatar
    July 2010
    179 Posts
    I am a major idiot. How did I not see the 'Triangles' in Mesh.BuildFromTriangles ... HOW?!

    Anways, enough scolding myself. I got meshes to (finally) work. Very wonderful, except the part where it's really offsetted for some reason.

    Oh, and Entity.PhysicsFromMesh crashes upon calling it. Well, not upon calling it, but when you attempt to collide with it.

    Holy sweaty fuck, those are pretty squares

    Only issue is that you have to look at them at the correct angle, sides seems to be off for some reason, and no collision yet...

    Aside from that little episode, I was thinking of getting this pure infinite. It's simple, but will be hard to pull off in multiplayer. This will involve, instead of moving the player, move the chunks around the player, keeping the player at the center of the world.

    This will allow infinicy in Source engine with the use of chunks. It's also a way to stop the 32 bit integer limit (For those who don't know, it's 2,147,483,647, and causes this) from ever being reached.

    But how to pull it off... Maybe use the Gamemode.SetupMove hook, and shift it in the inverted direction. If all else fails, with being unable to move the chunks and/or with mesh collision, I could go with making my own player entity and physics.
    [offtopic]
    Off to bed now. I really need to start getting sleep. Plus, I hunger.

    Edited:

    Dicks... My Dropbox's public links had too much traffic. I guess I didn't expect that to happen for having it double as a temporary place for (some-what) my TF2 server. Gee. I'll reupload the image on my other account.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Winner Winner x 5Useful Useful x 1Lua Helper Lua Helper x 1 (list)

  27. Post #427
    Gold Member
    FoohyAB's Avatar
    July 2009
    945 Posts
    PhysicsFromMesh works fine for me. Make sure you're giving it a properly formatted table, if it isn't formatted right or isn't a valid table, it tends to make you feel really bad and crashes.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 2Lua Helper Lua Helper x 1 (list)

  28. Post #428
    Gold Member
    raBBish's Avatar
    March 2007
    2,667 Posts
    It's been a while since I released Hades, and I didn't feel like making a release thread for another "hack", so have these. I didn't get very far while making it, so it doesn't include much beyond the core stuff for injecting Lua in-game. It's broken by many updates, but it could be a handy reference for something.

    https://bitbucket.org/auraeloria/iris/src/
    https://bitbucket.org/auraeloria/iris-lua/src/

    This is the last hack I've made for GMod, so no more releases like this coming
    Reply With Quote Edit / Delete Windows 7 Finland Show Events Informative Informative x 1Dumb Dumb x 1Funny Funny x 1Friendly Friendly x 1 (list)

  29. Post #429
    wanksta11's Avatar
    April 2009
    1,804 Posts
    are html panels fixed?
    Reply With Quote Edit / Delete Windows 7 Canada Show Events Informative Informative x 2Disagree Disagree x 1Dumb Dumb x 1 (list)

  30. Post #430
    zachar543's Avatar
    August 2007
    126 Posts
    Ran into a road block with my usual project and started on something else until I can get past the block:
    This is similar to (I think) the VMF-loader that was shown a few pages back. I decided to try and make a VMF to GMod mesh converter. You give it the VMF and it extracts the info from it.


    Also, anyone know a way to stop the player from colliding with static world geometry? Though ShouldColide gets called between the two, it does not have any effect on the two.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Winner Winner x 2Artistic Artistic x 1 (list)

  31. Post #431
    Gold Member
    Mr. Quiggles's Avatar
    July 2010
    179 Posts
    I revised a ton of things. First one is the way vertices are calculated. The visuals are what the mesh will show, while the collisions are for collision. I'm not sure how this was overlooked, since this would be impossible for blocks like liquids and soul sand to be utilized. Also, the server iteration of vertex calculation now relies on 'Block.Solid' instead of opacity, since collision doesn't "care" if a block is see-through, but if it's tangible.

    Another thing I added is blocks to be perfectly scaled and offsetted for both collisions and visuals. No need for using the matrix class for that.

    Textured meshes!
    Textures are now usable for blocks via a texture file that acts like the 'terrain.png' in Minecraft. The UV is a pain in the ass, and also due to the way vertices are added, gives the rotated sides like that.

    But, as always, demons are released via code errors, like this one:
    This gave me a major headache. If you cannot take 'koth_rainbow' or are prone to seizures, GET OUT OF HERE! Caused by something involving invalid scaling. It's fixed now.

    [somewhat off-topic]
    PhysicsFromMesh works fine for me. Make sure you're giving it a properly formatted table, if it isn't formatted right or isn't a valid table, it tends to make you feel really bad and crashes.
    The wiki says it's the same as an IMesh table is, with something like:
    Code:
     Table[1] = { pos = Vector( 0, 0, 0 ) }
    which is how I have mine set up. I'm guessing that's wrong due to the crashes. Is it with a table like
    Code:
     Table[1] = Vector( 0, 0, 0 )
    or
    Code:
    Table[1] = { Position = Vector( 0, 0, 0 ) }
    or none of the above?
    Reply With Quote Edit / Delete Windows 7 United States Show Events Artistic Artistic x 1 (list)

  32. Post #432
    Gold Member
    bobthe2lol's Avatar
    July 2007
    1,370 Posts
    Just wondering, is it possible to draw 3d lines? Because surface.DrawLine only takes an x and a y.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  33. Post #433
    samm5506's Avatar
    July 2008
    643 Posts
    Just wondering, is it possible to draw 3d lines? Because surface.DrawLine only takes an x and a y.
    Not exactly 3D, but you can get the x,y coordinates of any vector and draw a line between points. See Vector.ToScreen for more info.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Informative Informative x 1 (list)

  34. Post #434
    Gold Member
    bobthe2lol's Avatar
    July 2007
    1,370 Posts
    Right, I meant draw a line in 3d space, not 2d space. I'm using surface.DrawLine inside a cam 3D2D call. I guess I'll have to use the position and rotation arguments to that call to make it 3D. Thanks though.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  35. Post #435
    dill pickle pringle EXTREME

    May 2005
    479 Posts
    Just wondering, is it possible to draw 3d lines? Because surface.DrawLine only takes an x and a y.
    In the beta we have render.DrawLine( vec, vec, color, zbuffer )
    Reply With Quote Edit / Delete Windows 7 United States Show Events Useful Useful x 2Informative Informative x 1Agree Agree x 1Winner Winner x 1 (list)

  36. Post #436
    zachar543's Avatar
    August 2007
    126 Posts
    The wiki says it's the same as an IMesh table is, with something like:
    Code:
     Table[1] = { pos = Vector( 0, 0, 0 ) }
    which is how I have mine set up. I'm guessing that's wrong due to the crashes. Is it with a table like
    Code:
     Table[1] = Vector( 0, 0, 0 )
    or
    Code:
    Table[1] = { Position = Vector( 0, 0, 0 ) }
    or none of the above?
    A part from my code when I am building the triangles of the mesh looks like this:
    Code:
    table.insert(points, {pos = Vector(0, 0, 0), normal = Vector(0, 0, 1), u = 1, v = 1});
    You need to insert each of the 3 vertices in counter-clockwise order for every triangle.
    The wiki says the tables are setup the same for Physics as they are for Mesh:BuildFromTriangles()
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 1 (list)

  37. Post #437
    Gold Member
    Mr. Quiggles's Avatar
    July 2010
    179 Posts
    I do have it like that in clockwise. I guess I'll try counter clockwise... Crashed. Great.

    Edited:

    I had something to add, but Chrome crashed and forgot what I was going to include. Oh well, that will be for the morning afternoon or evening, as I'm going to bed at 6:33 AM.

    Also, is anyone else noticed that 'hl2.exe' and 'GameOverlayUI.exe' are still running, even when GMod 13 has been exited? Really annoys me that some of my resources are being eaten, and notifications won't show. Even crashing it still has Steam thinking you're still in it.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  38. Post #438
    My Blog
    Spencer Sharkey's Avatar
    July 2009
    1,958 Posts
    Haven't posted anything in here for a while, just got back from doing a lot of crap.

    Here, I hope this brings back memories. Did this in like, an hour and a half


    Come on, Crash Bash...


    Also fuck my terrible mapping skills, don't look at the map just realize that it's a non-standard camera with a trace to the world using the mouse :D
    Reply With Quote Edit / Delete Windows 7 United States Show Events Winner Winner x 4 (list)

  39. Post #439
    pennerlord's Avatar
    February 2011
    503 Posts
    Just wondering, is it possible to draw 3d lines? Because surface.DrawLine only takes an x and a y.
    You can use the cam library for this.
    Reply With Quote Edit / Delete Windows 7 Germany Show Events

  40. Post #440
    Dragon Dildoes
    Dennab
    April 2009
    4,432 Posts
    In gmod13 I spotted a line drawing function for 3d, however, you can also do it in gm12 using the mesh library.
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Agree Agree x 1 (list)