Joshua LUA coroutine

Come in here to talk about your sky-net style world-destroying super bots!

Moderator: Defcon moderators

martin
level5
level5
Posts: 3210
Joined: Fri Nov 19, 2004 8:37 pm

Postby martin » Mon Mar 01, 2010 10:19 am

Ok, the problem is that Defcon will consider 3 ships placed in the same tick to be in the same fleet. The multithreading module is designed to do as much work in one tick as possible. So, you need an unconditional yield, give me 10 seconds to write it and commit to svn...

Ok, grab the new multithreaidng file off the svn. To unconditionally yield pass true to the yield function. Ie. replace all yields in your ship placement code with

Code: Select all

Multithreading.YieldLongTask(true)


Nb: I haven't tested this, but it should work ;)
GENERATION 22:The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.
User avatar
Ace Rimmer
level5
level5
Posts: 10803
Joined: Thu Dec 07, 2006 9:46 pm
Location: The Multiverse

Postby Ace Rimmer » Mon Mar 01, 2010 3:47 pm

Thanks, I'll have to try that later today. The main reason I'm migrating is because I can get all my ships/planes to move (even can get planes to constantly keep a 90 degree angle against enemy ships), but can't seem to get any state changes in there all together. That is, the piece that launches bombers from carriers is completely separate from the movement code, which I want to avoid. Separate functions are ok, but they're not tied to each other in any kind of way, so I can dynamically launch planes based on enemy ships yet. Ok, I can, but I can't do much more than that without it hanging.

So far, I can get within 20 points of a tie (as NA vs EU, against CPU) with only silos launching and bombers flying (no SRBM's, yet), no subs and a chaotic mess of a fleet...

Code: Select all

If yourship comes within n of myship, move myship smallR (random direction, set distance)


I've also got a very choppy way to remove destroyed units from tables using OnEvent. However, I've noticed that it seems if multiple gunshots strike a target the moment it dies, it wants to try and perform the removal as many times as there were gunshots. :roll:

Hey, it's a start and units are moving. :P

Edit: forgot to mention that when I first tried this, I had the whiteboard show me which myunit was moving based on which enemyunit; it was like watching StarWars (whiteboardclear, whiteboard draw, repeat).

Pew, pew, pew, ship killed.

Return to “AI Bots”

Who is online

Users browsing this forum: No registered users and 4 guests