Sep 19 2011

Some little updates

Tag: Full Games,MMORPG Tycoontrevor @ 10:47 pm

 

So work has been busy, and I haven’t had nearly as much time to code on things here as I would have liked, but I’ve made some interesting progress over the past week or two.

The first thing to mention is that I believe I’ve finally cracked the nut of making the game’s height map look good;  no more weird diagonal diamond patterns visible across changes of surface facing!  (this involves re-triangulating the surface to try to minimise artefacts)  This was especially bad before at sharp creases, such as you can see at the bottom of this extreme hill, or around the edges of darker areas, at the crest of the hill.  It was also often very visible on the mountains at the region boundaries.  But now, it’s pretty much bang on every time.  I’ve been doing this “re-triangulate the mesh to try to hide those diamond patterns” thing for an awfully long time, but it was only today that I finally found the right combination of heuristics to actually make it work reliably.

I’ve also moved from a simple directional-lighting light model to a wrap-around lighting model, which gives the game a much softer look, which also helps with the smoothness.  And is just a nicer look overall, in my opinion.

I’ve also started implementing more ground shaping tools.  Most notably is the ground leveller.  Basically, it tries to flatten out the terrain under your cursor.  There are versions which will only raise terrain, only lower terrain, and which will go in both directions.  This is great for setting up flat surfaces to place buildings upon.  (Since buildings only place their centre point on the ground, it’s common for their corners to be floating, or for the ground to be embedded through the building geometry.  Still TODO is to have buildings automatically flatten the ground under them, when placed.

Oh, and incidentally, grass now flows downhill, instead of always east-west.  I don’t think you can make it out in this screenshot (I’m too far away), but trust me.  :)

I still need to do thinking about how to set up the overall ground editing interface.  The “paint on” interface is nice, but even with the work being farmed out to background threads, it’s hitting the frame rate too hard, when the user paints with a large brush.  I’ve been thinking about having the terrain editing tools work with a grid lattice, which I could easily update in real-time.  When the user is happy with his changes, he could click an “Accept” button, to assign the terrain rebuilding to a game developer.  This would make it work similarly to how placing buildings works;  giving commands to actually be executed by minions.  And it would also solve the problem of needing to rebuild the terrain every frame;  instead, it could just happen in the background, when the developer is actually performing the task.  Need to think about this more;  I’m not sure how the user would specify terrain types on a grid lattice, for example.

I took a stab at continuing with player AI, but rapidly banged my head against the current code setup.  I think I’m going to have to heavily refactor the code, before I can add anything more to it.  It works right now, but it was written in the fastest possible way, way back for my self-induced “Milestone 1″, and at this stage, I’m stumped as to how to add parties to the system, without breaking the quest-following behaviours that are already in there.


Sep 08 2011

A New Look

Tag: VectorStormtrevor @ 11:29 pm

I’ve been maintaining this development blog (on and off) for almost four years, now. In that time,I’ve managed to complete eight “game in a week” games (one of which went substantially over schedule), and one major other project. Professionally, I’ve
been a key member of the programming teams releasing three commercial console games during that time, and have had smaller roles on others. Also during the time since I started this blog, I spent about four months on vacation, about four months unemployed, and am now working for a new employer (where we’re only a few months away from our next commercial release)

In all this time, this blog has remained pretty much unchanged. I guess I was finally feeling like it was time to air the room and let in a little more light, so welcome to the new layout. Clean, simple, and relatively unobtrusive.

Of course, for those of you who read via the RSS feed, there’ll be no visible difference. But for everyone else, hopefully the site will be a bit easier on the eyes, particularly for my longer bouts of rambling.


Sep 01 2011

Minor update

Tag: Full Games,MMORPG Tycoontrevor @ 11:00 pm

Very minor update today, since I didn’t have much time to code, but got a few things implemented.

First, VectorStorm materials now have an optional “layer” value.  This value defaults to zero.  Within a scene, material batches are drawn in order, according to increasing “layer” values.  This allows us to force transparent geometry, such as the extending arrow effect, to draw later than opaque geometry, such as the ground surface.  Note that this only works when rendering is performed via the material batching interface on the vsRenderQueue;  materials applied by directly setting them within a vsDisplayList will render exactly as requested within the vsDisplayList.

Second, I’ve been removing lots of old, dead code.  Most notably, I’ve now removed the carcass of the old combat system.  Now that players and monsters are attacking each other using via configurable attacks, the fake old system really isn’t necessary any longer.  The Player AI really needs some serious refactoring;  I’m probably going to spend the weekend trying to massage the code into a simpler and more extensible state.


Sep 01 2011

The last multithreading post (for now)

Tag: Full Games,MMORPG Tycoontrevor @ 12:12 am

Setting up multithreading code is complicated!

Here’s what’s new:

  • Set up a generic “task management” system for MMORPG Tycoon 2.  Systems generate “tasks”, and tasks are assigned out to worker threads, which work on those tasks, and then let the main game know when the tasks finish.  Heightmap building now uses these generic worker threads, instead of having their own threads.  Right now, there are eight worker threads.  But in theory, it’s probably best to have the same number of threads as the user’s CPU has cores, potentially plus one.
  • Clutter generation stuff occurs using dedicated threads.  I need to convert these over to use the new generic worker threads.
  • The game now waits for all queued up tasks to complete, before rendering the next frame.  This fixes some problems I was having before, where different blocks of terrain were updating at different times and not matching each other, just due to how long they took to calculate in the background threads.
  • Fixed some issues with my OS X semaphore implementation (since OS X doesn’t support unnamed semaphores, for unknowable reasons).
  • Worked around a renderer bug, where anything which had no texture was being drawn opaque, regardless of its material settings.  This affects the live trunk, too;  I’ll bring the fix across at the same time as the various threading fixes I’ve mentioned in the past week or so.  (If anyone needs a quick workaround in the meantime, just remove the line “m_state_SetBool( vsRendererState::Bool_Blend, false );” from vsRendererSimple::SetMaterial() on VS_RendererSimple.cpp, line 958.)

And now, I’m completely sick of dealing with the complexity of threads, and so the next thing on my list will be more player AI.  I think I’m going to work on making players assemble into parties that do quests together.  That ought to be entertaining.

And it raises some interesting questions, which actually come up in the development of real MMORPGs; how to handle characters who are of differing levels, but who want to team up — ignore it?  Boost the level of the lower character?  Lower the level of the higher player?  Not allow teaming between those characters?  And worse, what do we do when a character completes a quest multiple times, accompanying different party members.  Do they get the reward multiple times?

My understanding is that most modern MMORPGs now give credit for completing a quest again in this sort of situation, but older MMORPGs often will not give repeated completion XP.  I wonder whether I need to make this configurable for players, or whether I should just take the modern approach and assume that that’s what everyone will want.

Lots of stuff to think about!