magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Aug 29, 2017 19:42:52 GMT
I've run into a bug that causes waves to spawn incorrectly after pausing/unpausing. It took me a while to track down whether this was my issue or Core Gamekit, but I'm sure it's Core Gamekit at this point. I currently have just 2 levels set up and at the end of the last wave in Level 1 I have checked Pause Global Waves and I'm firing a custom StageComplete message. This part works fine and I received my StageComplete event. In that handler I start a coroutine that activates a stage complete message, plays some sounds, upgrades the player ship, and ultimately calls UnpauseWave so that it can start Level 2. Within this coroutine there are various yield WaitForSeconds calls to delay some things. Now, when the Unpause finally gets called, the first two waves in Level 2 spawn incorrectly. The last enemy in wave 1 spawns and wave 2 starts spawning immediately. If I don't have any pausing in between the first and second level then it correctly spawns Level 2 Wave 1 by itself and then spawns Level 2 Wave 2 after that.
It seems like the delay that is happening during the paused state is accumulating and when I unpause, it starts spawning as if Level 2 is already 12 seconds in, instead of starting Level 2 right at zero time. I haven't tried to find the code for this yet, but I'll do that a little later unless you are able to help before that.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Aug 29, 2017 19:57:04 GMT
OK, so I'm able to work around this by setting a large delay for the first wave of Level 2 and increasing the length of that wave by the extra amount. However, I still think this is probably a bug that could be fixed.
|
|
|
Post by DarkTonic Dev on Aug 29, 2017 21:01:57 GMT
Ok, please send me a small example project that reproduces this and I will fix it. It can spawn spheres or whatever.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Aug 29, 2017 21:06:56 GMT
I don't have time to make an example, but I can tell you the basic problem as I see it.
_waveStartTime is set at the end of a wave in the SetupNextWave function. So this occurs before the Pause happens. When Unpause occurs, there is no consideration for the time that passed in between. I don't know your code very well, but either don't do setupNextWave until after the pause or add in the time it was paused to _waveStartTime once it's unpaused.
|
|
|
Post by DarkTonic Dev on Aug 29, 2017 21:13:39 GMT
Thank you, I will take a look when I can.
|
|
|
Post by DarkTonic Dev on Sept 7, 2017 5:13:33 GMT
This is fixed.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Sept 28, 2017 20:05:46 GMT
I never got around to implementing my own solution for this, but I do have some custom code in the Core GameKit that I'm using so I don't want to do any asset updates. Can you provide some guidance on where the fixes are for this issue so I can merge in the changes myself?
|
|
|
Post by DarkTonic Dev on Sept 28, 2017 20:24:21 GMT
Sorry, but no. You will need to update, it's not the most simple change and I don't keep track of diffs. What is your custom code, because I may consider incorporating it in the main.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Sept 28, 2017 20:37:21 GMT
Sorry, but no. You will need to update, it's not the most simple change and I don't keep track of diffs. What is your custom code, because I may consider incorporating it in the main. The custom code is an integration with Curvy. It's not really the kind of integration you could publish as a generic solution though so it's pretty much unique to what I'm doing. I tried to come up with a generic solution that would require no code changes to Core GameKit, but there were problematic things that would make it difficult. I really, really would like to make it generic though so I don't have to worry about updating to the latest version so I might re-think it once again and see if it can be done.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Sept 28, 2017 20:41:57 GMT
The problem with Curvy integration for me is that I need a way to specify a Curvy Spline for a Spawner. It's dependent entirely on the Spawner and not what is spawned. For example, I may have 3 Spawners in a row that all spawn the same enemy ship, but each spawner uses a different Curvy Spline for the enemies to follow. So when the spawner starts spawning it instantiates the spline and then as each ship is spawned, it is attached to the spline.
Perhaps there is a way to accomplish this without modify Core GameKit, but I haven't thought of how to this point. I'm open to suggestions though if anyone has an idea.
|
|
|
Post by DarkTonic Dev on Sept 28, 2017 20:48:35 GMT
It depends where you do the using of the Spline stuff. Possibly could be put into a Listener class. The problem is that the custom Inspector doesn't show any extra fields you may have in subclasses, I believe. Because you can always add extra fields to a spawner / killable subclass and use that instead, but those fields won't show in the custom Inspector. Correct?
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Sept 28, 2017 20:51:46 GMT
It depends where you do the using of the Spline stuff. Possibly could be put into a Listener class. The problem is that the custom Inspector doesn't show any extra fields you may have in subclasses, I believe. Because you can always add extra fields to a spawner / killable subclass and use that instead, but those fields won't show in the custom Inspector. Correct? Yeah, that's part of the problem. The custom fields need to show in the inspector for the Spawner. Not only do I have a field to reference the Curvy Spline prefab, but also some other variables that are relevant to the spawns that are going to use that spline. For example, I have a scaling factor that tells the spawn what scale to be at the start of the spline and what scale to be at the end. [EDIT] I may just go ahead and re-merge the code into the latest version. It's not too complicated and is only in 2-3 files. I did it once before, but was hoping I wouldn't have to do it again.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Sept 28, 2017 20:55:42 GMT
Wait. Your suggestion of a Listener could work if I understand you correctly. Is it possible to select the Spawner in the hierarchy and add a Listener to it? If so, then I could make a custom Spawner Listener that is attached to the spawner, which has the Curvy spline reference and other parameters. Then the Listener could instantiate the spline and attach the spawns to it. Does that sound like it would work?
|
|
|
Post by DarkTonic Dev on Sept 28, 2017 21:06:46 GMT
Which spawner are you using? Syncro or triggered? I'll need to examine the methods of the correct listener. Listeners are useful here because they use default inspectors and everything you add will show up there.
You need to call a method on what script after you spawn?
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Sept 28, 2017 21:13:38 GMT
I'm assuming I am using Synchro spawners. They're just the spawners added in the LevelSettings.
So, basically here are the steps I need to do to make this work:
1. Before a Spawner starts spawning I need to instantiate a Curvy Spline prefab for it. This spline prefab must be directly associated with the Spawner. 2. As each Killable is spawned from the spawner then I need to take that spawn and attach it to the Curvy Spline.
|
|