Monday, January 24, 2005

We have the area contained, sir!

This weekend was quite productive. I even have a screenshot to prove it.

The keyboard-controlled marker now places objects and acts as a target in firing mode. In building mode, the marker icon is changed into a "wireframe" of the piece to be placed next. It's not really rendered as a GL wireframe, it's just some DTS objects. The aim marker is even a dts object (though just a plane with bitmap). I even had time to do the contained area check. And half of it is in C++ code (since it was slow... about 12 seconds to compute just a quarter of the map!). I started on getting the other half into C++ code this morning, and I'll definitely have that done this week. The first half sped up the whole process to 5 seconds for the entire map, so that's good. The c++ code is still calling some script functions to build the markers and to check for walls, which are key points in the loop. Once it's all in C++, I expect it will be fast enough.

Right now the contained areas are displayed by spawning a dts object (translucent) just above the terrain at each point on the terrain. Yeah, that's slow. So eventually I'll make custom GL code or something to draw patches above the terrain client-side. I plan to represent the occupied areas with quadtrees to reduce the network traffic.

Also, the piece building "template" is on the server, so each client would build using the current piece/rotation shared by everyone. That might be interesting, but not for this game. I need to migrate the piece code to the client, and just transmit which piece number and orientation to build at. Or perhaps even just the orientation. The position is already stored on the server... the idea is to avoid blatant cheating.

So my next steps are to finish migrating the contained check code into C++, then to move the piece-building stuff to the client, so each client can build a different piece. Cool.

Now check the image. If you look carefully, you can see a couple of arcs from cannon shots.

No comments: