Page 2 of 3

Posted: Sun 09 Jan, 2005 2:23 am
by Duck
Kozak wrote:For my UOH (uniform object handler) I thought of a way to handle characters on screen. I had a general update loop which checked what input the character got:
- player input character, check for keypresses (so I could have 10+ character controlled chars)
- inverse player movement (same as player movement only inverse, also seen in zelda)
- follow player (move in direction of player)
These are all quite simple. Just make one routine ("getPlayerInput"), recording all input and putting them to vars. Then you can use player input anywhere in your program. For example, the input of 2nd, apha and 2 other keys are stored in one byte variable. The higher 4 bits are the pushed keys in this frame. And the lower 4 bits are the pushed keys in the previous frame. So, if key "2nd" is the 0th (prev frame) and 4th (this frame) bit, you check secondPressed (AND %00010000), secondHold (AND %00010001) and second Released (AND %00000001) very simply, and use them anywhere you like. Also in enemy AI routines of course.

By the way, some people make AI sound much more mysteriously then it actually is. Its just about making a piece of code for which determines for each monster the next action (for example xspeed, yspeed, particle throwing) by checking some input variables (player closeness or somethin') and you'll have very delicate AI for a ti83 game. You dont need any education to be able to write such a thing.

Posted: Sun 09 Jan, 2005 2:35 am
by tr1p1ea
You dont need any education to be able to write such a thing.
No education at all aye? :).

Posted: Sun 09 Jan, 2005 2:40 am
by Duck
I'm just wondering what all the discussion is all about. Some things are just too obvious. Or is it just me? :?:

Posted: Sun 09 Jan, 2005 12:05 pm
by coelurus
For a TI, AI doesn't have to work much. Duck explained the idea pretty well up there, "enemy picks action on some input parameters", what else could enemies do (and to me, there's more common sense in that than education ;) )? Biggest problem is that people who know a lot about a subject always talk about what they find hard and discussions go heywire when the newcomer doesn't have a clue even where to start (AI-people often go ranting about fuzzy logic, neural networks etc when those are hardly used in the most advanced games today).

The tricky part comes when enemies has to think nearly as much as the player, for instance, the already so much discussed issue of pathfindng. The worst bit is memory space, because the workload could be split up to multiple frames. I had some thoughts about this once in a discussion about an RTS (where pathfinding is dead crucial if you're allowed to build buildings, otherwise a sort of sector+portal-system could solve concave areas), but I never worked seriously on that. I will have to soon though, I'm still programming on the PC and I like keeping mem resources down.

Posted: Sun 09 Jan, 2005 3:54 pm
by CoBB
Another supporter of Duck raising a hand. On the calc we are constrained to make use of the simplest methods, often hacks. I think the state driven approach is the easiest way to create behaviour that looks complex from the outside. Given that each state can be implemented with a simple enough strategy (for standing still, keeping looking around, patrolling, chasing, attacking, fleeing, calling others etc.), adding more states is a very cheap way of extending the capabilities of NPCs, e. g. adding more degrees of attacks. It is still an interesting question whether orthogonal state variables are a good idea, e. g. maintaining a bit for 'heard something suspicious recently' or 'seen the corpse of a buddy' which contribute to the internal strategy instead of directly affecting the actions (as opposed to the previous 'named states' approach).

Pathfinding is quite a resource eater, especially when combined with swarm movement. Hmmm, creating an RTS would need more thinking anyway...

Posted: Sun 09 Jan, 2005 8:32 pm
by teoryn
More powerful AI usually isn't put into games because it would take a lot of programming, and probably to much time. However, sometimes more powerful AI's can be really cool. Check out http://www.20q.net for an example of a neural network in use.

Posted: Mon 10 Jan, 2005 9:43 am
by kv83
Of course a pathways system would help a lot... let's say, if you create a map, you could make important pathways, which the AI could use, this would eat up some more memory, but less cpu speed than another method

Posted: Thu 27 Jan, 2005 7:51 pm
by dysfunction
Wow... 20Q is pretty damn smart... My object was a computer, and for oguhly hlf of my answers I wasn't sure my answer was the most helpful choice. Yet it took about 10 questions, then it guessed and was correct!
On the subject of AI that's actually possible on-calc, I think the ideas most discussed here work best- they've been used, in varying levels of complexity- in many games. Chrono Trigger, the Metal Gear series, Starcraft, etc.

Posted: Fri 28 Jan, 2005 9:18 pm
by Kozak
kv83 wrote:Of course a pathways system would help a lot... let's say, if you create a map, you could make important pathways, which the AI could use, this would eat up some more memory, but less cpu speed than another method
This is the beacon method I proposed, could work in alot of instances, but might be a space eater when you want to register which tile points to which beacon.

I think cool AI shouldn't be a problem on the TI, only the pathfinding aspect will give speed and size problems. States are challenging enough since humans think in the same way. To make it more realistic you could change the strenght of how each external input is registered to the NPC and so adapting NPC behavior to weaknesses of the player.

hmm

Posted: Fri 28 Jan, 2005 10:11 pm
by the_unknown_one
I think good AI is very hard to do... The best AI i've ever been able to do yet, is in the game Shoot (example game for MLC) and its not even really an AI...

Posted: Wed 09 Feb, 2005 11:42 am
by kv83
Just for reference, I started a new thread about the BattleCards AI in the BattleCard forum.
It's called Designing the AI of BattleCards

Posted: Mon 07 Mar, 2005 11:54 pm
by Toaster
Ninja AI

Well I have the game engine pretty much done so I have gone on to AI and I am stuck!

The AI is gona be pretty simple they just move at you and if there close enough to attack they would do so.

How would I make it so the AI would move at you. I have no clue how to do this. Much help would really be appercated!

Thanks

Posted: Tue 08 Mar, 2005 7:14 am
by CoBB
Comparing coordinates and choosing an action based on the result?

Posted: Tue 08 Mar, 2005 3:58 pm
by VahnRPG
though it's not entirely related to the subject, my mom is CONVINCED that if you program something like a game where your opponent is the computer, it will cheat. I have no clue WHY she has this mentality, since the only way I could think that'd be possible is to PROGRAM it to cheat (the first I heard of this was when I was working on my Rock Paper Scissors game so very long ago)...<sigh> women...

Posted: Tue 08 Mar, 2005 6:00 pm
by CrimsonCasio
actually, in some games thats a good solution to a not very bright AI... just have it cheat every now and then ;)