Lots of tasks completed for PoP2

I spent the past month working on a lot of different tasks. This is part of my push to get the game ready for Internet testing within the next few weeks. Finishing-up all of the loose ends always seems to take longer than expected.

I finally decided that most of the shadows in game would be done as a separate pass instead of being baked into the artwork. Removing the shadows from the artwork means I no longer need to use 32-bit textures with an alpha component. So I can reduce the graphics memory almost in half, which is a big advantage. I also have some more control over how the shadows are displayed. I am currently using a simple oval graphic that takes color from the vertex data, which right now is just black. I’m satisfied with the way it looks. Right now I just have troops using that method, but eventually I will use it for other assets too.

I also needed better control of where my projectiles start and when, in order to match the new troop attacks. This is especially important with animations such as a bow. I will further tweak the design to allow sync with actual attack frame. Right now I just have an x/y offset and a delay value, which is better, but could still use some improvement.

I fixed a glitch with rendering my zealots too. I was rendering them in the wrong order, so the z-buffer was removing some pixels, which made them look weird. Now they look correct. I might have to make a few adjustments with some effects that seem to be in front of certain entities. Not quite sure why that is happening when other effects look good. Hopefully that will be a quick fix.

I have been wanting to show the banner refresh timer on the selection icon for a while now. That timer tells the player how long until a new banner location can be selected (to march zealots to that location). The current refresh value is 60 seconds, so that is important to know or it would be annoying to keep guessing wrong. Displaying on the local computer was easy, but getting that information to the client was a bit of a pain.

I had to add some core code to sync pulse events between server and client. I spent some time to get it right, because I will use that mechanism for other timers in the future. Once I completed that code, I sent the banner ticks to the client and handled a few edge cases. Now players can see the banner refresh timer for single player and multiplayer games.

When I finished that multiplayer code, I realized I needed to work on some other related improvements. I made the client more robust for certain cases when entities are removed. I streamlined a lot of the update code to reduce complexity, which should make it less prone to mistakes. I fixed a few possible crash conditions too.

I  also finally tackled a limitation of the client update for certain attack conditions. There was a problem when a client player observed a visible enemy attacking a non-visible enemy. I used to only send the entity data for the visible enemy, so the attacks to the non-visible and from it, would not work correctly. So I introduced the concept of an indirectly visible entity, which would just send data for its type, position, and optionally an attack. That way I still only send minimal data to the client for visible or indirectly visible entities, while supporting the required state information to allow those attack conditions. It took a while to get it completely right due to many edge cases, but it works great now.

Then I fixed a few other sync issues. One was related to a rare bug with the leader teleporting that depended on the order of the index value. I actually remove the leader where it teleported and then create it with a new instance and matching health of previous instance. That way projectiles fire at the correct leader if it teleported while being attacked. The order was preventing an update for the new instance. It is now fixed.

I also resolved a really nasty issue when zealots were removed. The pointer was incremented incorrectly and it was really subtle. In fact, it worked most of the time so I had some trouble finding the bug. I had to actually add sync values after each data section, incrementing each time and adding some other signature values. Then I compared expected to actual value. It took longer to write that code than to find the problem. I fixed a few other multiplayer issues and now everything seems to be working well, even  after some burn-in testing with other sync checks.

Then I noticed death effects weren’t working for fortresses. I totally forgot I never sent that data over to the client. I had to increase the size of the fortress header and reorganize the bits. I decided to tweak that area while I was at it. Now the fortress death effects are displaying on the client.

Finally, I smoothed the troop movement by introducing a constant delay on the client. That allows the next update to arrive before the troop reaches its destination. Now the lag and jitter of the network don’t affect troop movement (up to 80 milliseconds).

So, you can see I have been busy! I will continue working on those types of details to get the game ready for Internet testing. I’m definitely looking forward to that milestone. The mage leader animation is almost done. I will post a picture of all 3 leaders when the mage artwork is completed. Fortress and tower assets will probably follow, then back to troops.

I promise to start posting screenshots regularly once I get to that point. Same thing with the new video. My prototype video is really old and I’m anxious to show the current state of the game! Thanks for reading this long post :)

Comments are closed.