Could you please let me know if it is at all possible to find corners in the node graph, any spot where the paths intersect, using lua?
I don't honestly care what kind of node, but I would like to find nodes that are connected to each other, preferably ones that go out of the room.
Finding paths that go out of the room should be easy enough to check for with traces. (if one of the trace distances is closer than that node position then it must leave the room)
If it is possible to find node intersection points (essentially where the node's were when the map was compiled) could you please let me know how? Thanks!
Is that possible? At least a simple yes or no would be very appreciated
If you have information about the nodes, then yeah it's possible.
[QUOTE=EvacX;43120265]If you have information about the nodes, then yeah it's possible.[/QUOTE]
Meaning?
[editline]9th December 2013[/editline]
How would I get information about the nodes?
[editline]9th December 2013[/editline]
I've never dealt with using nodes with lua before in my life
Basically what I want to know is how I would get the node locations... well, I doubt I can really do what I want to do very easily...
I want to have this flying object go into different rooms, around corners, etc. automatically, always trying to leave the room, and in a new direction if at all possible.
It kinda requires the map to actually have nodes in the first place.
[QUOTE=EvacX;43126065]It kinda requires the map to actually have nodes in the first place.[/QUOTE]
If course. Without nodes this thing just flies around in random directions.
[editline]9th December 2013[/editline]
Well, not ENTIRELY random... there is a random aspect to some of it but the general direction is decided by other methods.
If you remember a while ago, in another thread, I asked about traces, yeah... it tries to fly in the direction of the farthest trace.
The only way I know how to get information about the nodes is through this hacky method:
[lua]
local EntInfo = {}
local Nodes = {}
//Gets entity info that we couldn't get otherwise
function GM:EntityKeyValue(ent, key, val)
local found = false
for _,v in pairs(EntInfo) do
if v.ent == ent then
v.kv[key] = val
found = true
break
end
end
if not found then
local tbl = {ent = ent, class = ent:GetClass(), kv = {[key] = val}}
table.insert(EntInfo, tbl)
end
end
//
//Assigns certain info to table
hook.Add("InitPostEntity", "TranslateInfo", function()
for _,v in pairs(EntInfo) do
if v.class == "info_node" then
local tbl = string.Explode(" ", v.kv.origin)
local vec = Vector(tonumber(tbl[1]), tonumber(tbl[2]), tonumber(tbl[3]))
table.insert(Nodes, vec)
end
end
end)
//
[/lua]
[QUOTE=Sparky-Z;43126115]The only way I know how to get information about the nodes is through this hacky method:
[lua]
local EntInfo = {}
local Nodes = {}
//Gets entity info that we couldn't get otherwise
function GM:EntityKeyValue(ent, key, val)
local found = false
for _,v in pairs(EntInfo) do
if v.ent == ent then
v.kv[key] = val
found = true
break
end
end
if not found then
local tbl = {ent = ent, class = ent:GetClass(), kv = {[key] = val}}
table.insert(EntInfo, tbl)
end
end
//
//Assigns certain info to table
hook.Add("InitPostEntity", "TranslateInfo", function()
for _,v in pairs(EntInfo) do
if v.class == "info_node" then
local tbl = string.Explode(" ", v.kv.origin)
local vec = Vector(tonumber(tbl[1]), tonumber(tbl[2]), tonumber(tbl[3]))
table.insert(Nodes, vec)
end
end
end)
//
[/lua][/QUOTE]
Now hold on a second, are you telling me it still recognizes them as info_node entities???
[editline]9th December 2013[/editline]
It might be too costly to have each one of these things keep a table of previously visited nodes for the purpose of never going back to the same place... which is what I'd have to do to get what I want, not even including tracing from node to node. I guess it might be better to just not do it, then?
[editline]9th December 2013[/editline]
Thanks for the info, though
[QUOTE=WalkingZombie;43126465]Now hold on a second, are you telling me it still recognizes them as info_node entities???[/QUOTE]
If I remember correctly, you can't actually find the info_node entities after the map has loaded. You can only access them while the map is loading, in which all entities go through the KeyValue process. I basically tapped into this process to record every entity and its keyvalues. Then once the map loads, InitPostEntity, we can sort through this table and look for the information we need. In this case the class was "info_node" and the keyvalue was the origin.
I'm not even sure if this is the only way of doing it, I just know it works.
[QUOTE=Sparky-Z;43126562]If I remember correctly, you can't actually find the info_node entities after the map has loaded. You can only access them while the map is loading, in which all entities go through the KeyValue process. I basically tapped into this process to record every entity and its keyvalues. Then once the map loads, InitPostEntity, we can sort through this table and look for the information we need. In this case the class was "info_node" and the keyvalue was the origin.
I'm not even sure if this is the only way of doing it, I just know it works.[/QUOTE]
Well, alright. Now I'm just thinking it would be waaay too much work to get a working navigation system with this thing, so I suppose what I have now is good enough to be the preferred entity.
I just need to better design it as a weapon n' all... it would be nice if I could've gotten the angels working right, but it looks fine as a set of glows.
[editline]9th December 2013[/editline]
first though, for the main reason I wanted and needed this thing, a set of gamemodes I'm making, ones that will be inter-connected, this would be one of the weapons. It's meant to be a cybernetic bug, imprinted with the relationship statuses of it's owner by the weapon, a bug that flies around looking for enemies to attack. It will go around corners and through doors, but not as often as I would like.
This bug happens to be a wild species from another alien race, bred for the purpose of warfare. It has neurotoxin glands and a sack for storage. Equipped with the cyborg suit it no longer has control over itself. When it hits a target the suit harness will explode, splattering the bug's neurotoxin onto the target's body.
Lol, I thought this thing up in a lot of detail I guess?? Here's a shorter description:
New alien group wild bug, bred for warfare, produces neurotoxin, made into a cyborg that searches for enemies to its owner, flies to and hits them, blows up and poisons their target.
It only attacks organic NPC's. It does check birds and humans, civies, alyx, barney, etc... but it won't attack them unless for... SOME reason... your character happens to hate humans... :rolleyes:
The bug is programmed, using a spit wad model from the worker antlions from EP2.. The weapon is as well... kinda, it uses the AR2 Model right now though. I need to model the weapon. I might want to model the bug just for ammunition, but it won't be seen on the projectile itself.
[editline]9th December 2013[/editline]
Same effect as the poison headcrab, max damage is 100 for when an antlion guard is involved. One major difference, if the target already has just one hit point the neurotoxin will actually kill them!
[editline]9th December 2013[/editline]
So yeah... it works well enough! I'll post a video shortly
actually... I need to get it to pick the nearest entity and I'm having a lot of trouble there...
probably should use find in sphere, but even still... it won't find the closest one
[QUOTE=WalkingZombie;43128196]actually... I need to get it to pick the nearest entity and I'm having a lot of trouble there...
probably should use find in sphere, but even still... it won't find the closest one[/QUOTE]
Loop through the entities FindInSphere returns and compare the distance to find the closest one.
[QUOTE=wh1t3rabbit;43128282]Loop through the entities FindInSphere returns and compare the distance to find the closest one.[/QUOTE]
Yeah... problem is I can't really do that when all of the entity chasing code is in there... so now I'm splitting it, first I do the for loop check and THEN I do the rest
[editline]9th December 2013[/editline]
get out of here brandonj4!
Wait what?
This whole time you were just trying to make a navigation system?!?!?!
USE NAVMESHES
[QUOTE=BFG9000;43130498]Wait what?
This whole time you were just trying to make a navigation system?!?!?!
USE NAVMESHES[/QUOTE]
Uh, idk if you really understand... it's a crazy sporatically moving flying object, so I need it to be floating above the ground nodes
[editline]9th December 2013[/editline]
Also, I thought node graph was the same thing?
[editline]9th December 2013[/editline]
I suppose this thing would be a lot like the half-life 1 hornet, except I want it to actively look for targets instead of just making short abrupt bends within the immediate area... in drafting, it would literally fly through the level looking for targets. If I get that working well enough I will lower the life span to be much less than 30 seconds...
[editline]9th December 2013[/editline]
Well, and it actually flies a lot like a bug, so much so that, I think it was a hallucination, I saw a bug fly into my curtains, but I never saw it after that. Yeah, my brain is naturally on "durgs"!
Disagree with the idea that the node graph is the same as the nav mesh, alright. Actually, I think the nav mesh is actually used for bots, so I agree... oops. I still don't know how to use that though, let alone how to make this thing fly in a searching pattern above it!
I'm gonna need to know how to use the nav mesh in lua
[QUOTE=WalkingZombie;43136042]I'm gonna need to know how to use the nav mesh in lua[/QUOTE]
Look at the nextbot files.
[QUOTE=brandonj4;43136376]Look at the nextbot files.[/QUOTE]
Yeah brandon, and those seem to be a pain in the ass to find? From the google results I got it seems they were used in hl fallout? I had some relations to the project but that's another subject. I have some steam friends that worked on that but I don't remember the names... it's been too long, among other reasons... [sp]I'm trying to stay away from personal information and shit you won't believe![/sp]
[editline]10th December 2013[/editline]
Meh, search two worked better
[QUOTE=WalkingZombie;43142323]Yeah brandon, and those seem to be a pain in the ass to find? From the google results I got it seems they were used in hl fallout? I had some relations to the project but that's another subject. I have some steam friends that worked on that but I don't remember the names... it's been too long, among other reasons... [sp]I'm trying to stay away from personal information and shit you won't believe![/sp]
[editline]10th December 2013[/editline]
Meh, search two worked better[/QUOTE]
Wasn't hard to find at all
[URL="https://github.com/garrynewman/garrysmod/search?q=nextbot&ref=cmdform"]https://github.com/garrynewman/garrysmod/search?q=nextbot&ref=cmdform[/URL]
[QUOTE=brandonj4;43142459]Wasn't hard to find at all
[URL="https://github.com/garrynewman/garrysmod/search?q=nextbot&ref=cmdform"]https://github.com/garrynewman/garrysmod/search?q=nextbot&ref=cmdform[/URL][/QUOTE]
I said the second search worked wonders
Wait, are you telling me to use the same navigation system that that lame TF2 Ghost npc uses?
[QUOTE=brandonj4;43142459]Wasn't hard to find at all
[URL]https://github.com/garrynewman/garrysmod/search?q=nextbot&ref=cmdform[/URL][/QUOTE]
I'm sorry, but you wanted me to use nextbot for this entity? Did you not understand the part about it being a sporadically flying NPC? It doesn't 'run' on the ground!
Nextbot doesn't work for this. It uses special code to fly around sporadically, and so I need code that can find destinations for it to aim for, destinations like nearby exits. I felt using nodes or the nodegraph would provide me a way to approximate decent locations to target.
You killed a thread without a solution!
[editline]21st December 2013[/editline]
Yeah, I went that long without testing it. I've been doing other things
[editline]21st December 2013[/editline]
I could try having a ground running entity that it tries to follow, but I don't want to use up an extra edict
[editline]21st December 2013[/editline]
so seriously, is there any way?
[editline]21st December 2013[/editline]
Here, allow me to clarify it better... I want it to fly around sporadically with a destination in mind...
I don't want it to fly straight, EVER, it should fly in a seemingly bug like style, but it knows where it's heading. It's bouncing off the walls while it flies, but it's moving towards an end goal.
Sorry, you need to Log In to post a reply to this thread.