Page 2 of 2

Posted: Mon Mar 01, 2010 10:19 am
by martin
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 ;)

Posted: Mon Mar 01, 2010 3:47 pm
by Ace Rimmer
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.