Yeah, the system won't scale well.
I just updated the post. It seems to work really fast with the "ghost mode" built into the engine. Of course, right now I am only seeing one object. I wonder, how would I construct the See() function so that I don't have a big switch statement for all objects that can be seen. I think i could have the cone see everything, but then it would be sensory overload (I don't think it would be enough to crash the engine though. It would just be too much to deal with to have it see everything in the game. I do understand that this is how our eyes work, but it would cause unnecessary memory use in the game.
I am sure this would have to end up being a class, but even then, how would I construct the class in the most efficient way so as to make the cone able to dynamically see things?
Doesn't seem hard, just thinking of the easiest and most efficient way at the moment.
I am using lua (which uses tables).
To really test, you'd need to add more and more objects, and more and more agents. Depending on how you eventually want to go, this might not be a big issue. For example, the original Carnage Heart was an AI programming game, and only had six agents in a battle at once. Only having to do six vision cone checks of varying complexity and you could probably keep a decent framerate.
And your system sounds similar to view frustums. So you might look into various culling routines, even a scenegraph or octtree.
That way you could narrow down which objects you actually need to do the expensive collision checks on, and which you can trivially reject as being out of sight. Though you might also want to move to a fuzzy system, if you are modelling human sight, for instance, we have peripheral vision which is very good at sensing movement, but terrible at everything else.
Granted, those are steps I would take when you get to them, ie when you actually start having trouble with your framerate.