It’s Rude to Point!
This week I have spent quite a bit of time coding more of the orders engine. The new code is around 80% complete, but before it could be finished I would have to make a little coding diversion…
Some of the order code I have been working on involves user interaction with the maps and units. For it to work well I would need some means of marking up the maps.
As an example I wanted to be able to plot the path of a unit. In most 3d wargames, they take the ‘cheap’ approach and have some very boring tubular lines connecting the unit to its destination – I didn’t want this – I wanted proper markings – like arrows!
So off to work on the latest diversion. The result (click for a larger version):
Quite impressive – or at least I thought so – I’m easily pleased!
The arrows class I designed is very flexible. It allows one to define, colour, opacity and even the shape of the arrows. This can be seen in the screenshot above where the arrows exhibit different shapes, colours and opacity settings.
Coding the above wasn’t too bad. I guess my experience with creating dynamic unit meshes helped me out here. However, there was one issue I had to address and that is terrain. Terrain, alas, can be quite hilly, so my arrows class would need to be able to follow this terrain! So back to do some more coding – I guess I can use the odd challenge to keep me amused!
After a further period of coding I created a hilly map and ran the application. This is what I got (click for larger image):
Terrain following looks good! But wait, there was something that was bugging me….
Here is the same terrain from two other angles (again click for larger images):
Can you see what might have been bugging me?
Basically, the problem was – at least in my eyes – that the arrows were following the terrain a little too perfectly for my liking. The last image really highlights what I mean. Here the arrow end has ended up tilted on its side, which I thought was a little unsightly. Technically, it’s a marvel of terrain following technology, but aesthetically, at least in my eyes, it’s a bit of a failure.
Back to the code….
I decided to code in an option to allow the user of the arrow class to specify whether they wanted the arrow’s terrain following stabilized at all. With stabilization selected, the above three images now look like (click for larger images):
Can you see the difference yet?
How about now?
In terms of the last image, the stabilisation system ensured that the arrowhead bends at the horizontal and not at a diagonal, which looks far better in my opinion. In fact I think all the stabilised screenshots look better than their non-stabilised brethren. That said, I didn’t want to restrict future use of the arrow class, so whilst it defaults to stabilised, one can easily turn this off on a case by case basis (Click for larger image):
In the above screenshot I have stabilised the red and blue arrows, but have switched off stabilisation for the yellow arrow.
Now that I have these arrows in place, I can finish off the orders system, which I will show off next week. In many ways this bit of coding is a milestone, as it is the first time that map markers have been used in the game and its inclusion provides a firm foundation for any other marker types I wish to include in the future. I think these markers a light years ahead of the rather dull tubes that one sees in other 3d wargame systems.
I’ll leave you with one last arrows screenshot – not that I’m arrows mad!
Honest! (click for larger image)
Laters
RobP













































