[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: noob - How to architect c++ code to use lua as external code
- From: Kevin Martin <kev82@...>
- Date: Mon, 22 Oct 2012 11:45:54 +0100
On 22 Oct 2012, at 10:26, spir wrote:
Just to say I'm not a games developer, my opinion is only based on coding a few agents for optimization simulations - so probably isn't worth that much.
> Would you explain why? (the two points you say)
*) I dislike the approach of returning the decided move from a function simply because, I find in a lot of instances (I code some AI's for use in simple simulations - I'm not a games programmer) you tend to be in the middle of an algorithm, 4/5 functions deep in the call stack at the point you decide what move to make. To code a search algorithm where you have to return and be re-called is quite cumbersome in my opinion.
**) When using an approach like this, the API can be styled in such a way to lead you to think the AI has control of the program rather than being a repeatedly called procedure (even though it is). I find this is just a far more natural way to think. Also as in (*) you avoid the issue of having to return from a few functions deep in the callstack.
Thanks,
Kev