PDA

View Full Version : dk similar game



barz00n
May 9th, 2011, 11:28
hey.

started making a game a couple of months ago similar to dk in unity3d. so far i have the map generator done, pathfinding done and wall selection with a selection box. Before I can show any sort of demo I need some functional worker ai. Now, I've played both dk 1 and 2 a lot and I can imagine most of the AI but i was hoping any of the WftO or keeperFX devs might have the worker ai documented somewhere. It would greatly speed up my work so I have something to show.

Thanks

barz00n
May 10th, 2011, 11:40
Nobody got any documented imp ai?

I'm not sure how dk does it.
Do the jobs have any sort of priority by type?
When you mark a 5x5 zone to be dug, do all those tiles generate a job and queue somewhere? Or do only the accessible tiles queue as jobs. If only the accessible tiles generate jobs, what happens when those tiles are dug? Do those imps automatically continue their last job type in accessible neighbor tiles?
If all tiles generate jobs, and generate paths as soon as they have an open neighbor tile, how do they chose imps? Closest? It looks like closest since an imp that started digging will continue digging/claiming/fortifying neighbors until finished.

Some of this info would greatly speed my work up.

Thanks.

Priato
May 10th, 2011, 12:35
I think the best thing to do is to play DK1 and 2. You will find all answer! I'm not working on AI, and I think there is no documented imp ai.
All knowledge come from DK 1 and 2 gameplay and we are trying to reproduce it. You have the specification into the game, you only need to do your conception within qualities and defects of your engine (I don't know unity3D)

barz00n
May 10th, 2011, 12:42
thanks for answering.
ya, i know i have to heavily observe dk. Unity3d uses scripting in C# so I can pretty much do anything, but I saw your imp digging demo on youtube was really good and felt like dk, so I am curious though what's your approach in UDK. Do you use a queue? Do you create entries for every marked wall or only the accessible ones, and then automatically continue with marked neighbors?

verhoevenv
May 10th, 2011, 13:18
We've not really done the imp AI fully yet. A lot of work has been done on needed parts like pathfinding and map representation, but I suspect the ideas in the AI itself will need a lot more tweaking or maybe even major changes.

I think we right now simply let each imp search the closest available reachable job, ranked with a certain priority like digging before reinforcing etc. Not sure we're doing this, but it's also important to allocate jobs, noting which imps takes which jobs, so that you don't have 50 imps rushing to the other side of the map to claim 1 tile.

All this is probably not optimal. Multi-agent systems are not trivial. Tweak around and see what works! We would also be very interested to know what your experiences are!

barz00n
May 10th, 2011, 13:29
I will most certainly update this thread as I move along.
Right now I have the pathfinding in, and its working well in my opinion. I keep my requested paths in a queue and I limit path calculations per frame, so I don't drop my fps when requesting 50 paths at once. Currently it does roughly 40 nodes of a path/frame, so small paths take 1 frame each at most, larger paths take 5-10.

I also have wall selection like in dk2: a 3d selection box. I was thinking, after I do some new selection, each of those marked walls would create a dig job with an empty path and empty assigned workers list. When/if that wall has an open neighbor tile, I request a path from my path manager, and as that path is finished, request the closest free worker.

Does this sound reasonable for a start? :)