Detect when a entity passes through anything a map has
Hi there, is there any way to check if a entity is passing though a object or any obstacle, house, box, etc a map can have?
|
Re: Detect when a entity passes through anything a map has
Hook touch?
|
Re: Detect when a entity passes through anything a map has
PHP Code:
|
Re: Detect when a entity passes through anything a map has
Everything that a map has is a entity(since i don't really know if yes or no), cuz if it is this makes everything a lot easier and if not then how can i check if an entity or player can pass through a point.
P.S. my goal is pathfinding algorithm for bots |
Re: Detect when a entity passes through anything a map has
Figure out the classname of all potential entities and use register_touch
Or use Ham_Touch to hook all entities touched by a player PHP Code:
|
Re: Detect when a entity passes through anything a map has
Its every important to check entities validity in the touch function because its called many times depending on player frame per second
|
Re: Detect when a entity passes through anything a map has
Quote:
PHP Code:
Edit: I just read your pathfinding goal comment. Good luck with that! |
Re: Detect when a entity passes through anything a map has
Quote:
Anyway, you don't need to list all possible entities to check if it's passable or not. You typically use a traceline to "scan" ahead. If the trace hits something then there is an obstacle in the way - it can also tell you useful information like the location of the obstacle. Also, I don't see how hooking touch is useful for pathfinding. You need to plan ahead and move only when you have a route, you don't move the bot in real-time while you search - that would look extremely silly. Extra note 1: running a pathfinding algorithm in real-time will be extremely computationally expensive. At the very least you should pre-compute a node graph and run pathfinding over it. DO NOT explore the map and run pathfinding at the same time for every single bot that needs to move, it will completely overwhelm the server and it will be VERY far from real-time performance. Ideally, you want to use some kind of navmesh built on top of the node graph to reduce the number of edges that need to be explored and hopefully the number of runs of your pathfinding algorithm. Extra note 2: you should consider implementing such algorithms in a module and you should be familiar with data structures like priority queues if you want to get a decent complexity out of your algorithm. I suggest you look into A*, or, if you plan to use this in smaller maps you may also use something called LRTA*(real time A*). Let the algorithm learn and pre-compute the matrix H and save it to disk. Later, when you want to execute movement you just need to follow the matrix(which will be an inexpensive operation). The only issue is if your map is big(covered using a lot of graph nodes) the matrix will get extremely big, that's why I suggest you use this only if your map is small or employ other techniques like dividing the map into multiple sections and generating a matrix for each section - each section will be smaller than the entire map thus resulting in a smaller matrix. |
Re: Detect when a entity passes through anything a map has
Quote:
but also, the FL_ONGROUND flag is only when you're on the ground of the map or even if you are on objects ? (didn't test it out since i have some other things i'm doing and also learning about) |
Re: Detect when a entity passes through anything a map has
For determining if an entity is on ground or not you'd better tracing a line down and cheking the fraction.
As for the pathfinding problem, Counter-Strike pathfinding seems to be using a grid to represent the map. Implementing the algorithm wouldn't be too hard, the actual problem would be to generate the graph. Would have to look through ReGameDLL source to check how CS create the graphs. Alternatively you could do something similar to podbots, where you have to manually add the points, depending on what you're working on this may be sufficient. Quote:
|
| All times are GMT -4. The time now is 02:39. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.