Feb 08 2012

More on custom terrain editing

Tag: Full Games,MMORPG Tycoontrevor @ 7:13 pm

It occurred to me today that my post yesterday was kind of uninspiring.  ”Oh look, I can make hills that are slightly sharper than the ones which I was making before.  Yay.”

I wanted to make a point about the flexibility of the system, so I present you with the letter “A” stamped into the terrain.  Doing this required no code changes;  just creating the brush texture (which I’ve pasted over the screenshot in the image), and editing two data files (one to tell the cursor how to use the image, and one to add it as an action bar button).  All up, it took about five minutes.  (About half as long as it took me to write this post)

I don’t imagine that anyone will actually want to create a world with the letter “A” stamped into the terrain.  But this approach is extremely flexible, and should make it much easier for folks to customise the interface to make it more convenient for themselves and/or others.

Now I just need to make the GUI not be quite so terrible, visually.


Feb 07 2012

Editing terrain editing

Tag: Full Games,MMORPG Tycoontrevor @ 9:06 pm

Today I started hooking up properly moddable terrain editing tools.  This will both allow me to develop terrain editing capabilities more quickly (and with less code!) and also allow end users who are interested to do so, to create their own terrain editing abilities, including adding additional options to the toolbars.

What I’ve done is set up terrain tools to be able to reach image files, and use those images to determine how they affect the terrain when applied.  50% grey means no change, lighter colours go up, darker ones go down.  By changing the ramping or the shape, you can get terrain editing to automatically make different types of terrain shapes.  In the screenshot here, I have made a much steeper hill than is normally easy to create, just by using a tighter gradient than normal (gradient image shown on the right).

I’ve also exposed a lot more internal variables to be modified via simple text data files.  Tomorrow, I’ll be filling this out a bit further;  adding steep chasms, craters, and similar shapes.


Jan 29 2012

A long-expected party

Tag: Full Games,MMORPG Tycoontrevor @ 6:18 pm

So here’s something I’ve been waiting an awful long time to see; I’ve finally reached the end of the massive AI refactoring job that has been consuming so much of my spare time over the past few months (that’s overstating it; I’ve really only been feeling up to outside-of-work coding for a few hours per week, so this hasn’t actually taken up all that much of my time), and have merged it back into the main development trunk of MMORPG Tycoon 2.

What does this mean? Well.. not a lot, immediately; mostly it’s doing the same things that it was doing before, just with much more well-organised code. There are probably a few new bugs in the AI which weren’t there before (as this new implementation hasn’t been as extensively tested as the old one). But the architecture of the system is much, much better now.

For example, the handling of human-controlled PCs and AI-controlled PCs move through almost identical code paths. This means that human-controlled PCs now receive experience points and level up and get quest completion credit, the same way that AI-controlled ones do. The Bartle type of a PC is now stored on the subscriber, not on the individual character.. which means that no matter how many alts a subscriber makes, they’ll all have the same Bartle type, as you’d expect (which wasn’t the case, before). Similarly, the various desires (“socialise” vs “gain level”, etc) are now on the subscriber instead of on the PC, so a subscriber could now theoretically meet a desire to socialise by logging in with a different character, which was not previously possible.

But more important than that, all of the AI logic has been pulled apart into clean(er) modules, so it should now be much, much easier for me to insert new AI behaviours, such as adventuring as a party or as a guild.

I have also begun work on supporting different xp allocation mechanisms. Previously, MMORPG Tycoon 2 allocated experience points to every PC who thought they were attacking a monster when it died, whether or not they actually ever hit it (and similarly, any PC who chose to run away after damaging the monster would receive no XP if it was killed immediately afterward). Now, monsters keep track of who has damaged them, and award XP to those PCs. This also will be important for supporting party-based adventuring.

So what’s up next? Well, I’m really wanting to push ahead with some world editing interface work, and I’m thinking really hard about whether the MMORPG Tycoon 1-style spline roads are really a good choice, here, or whether a more traditional “tile grid”-based road system would make more sense for a game that’s played from this close up. The problem with spline roads is that a slight movement to a long road can require huge amounts of terrain modification — often I have to rebuild almost a quarter of the visible terrain in order to cope with a path that’s now taking a slightly different direction. Maybe the simple tile grid layout would help localise changes more. Although I really do like the freeform paths, I must confess.

Anyhow, moving on! There’ll be some general life news later in the week, as well. Further details then!


Oct 09 2011

Profiling is fun

Tag: Engine,Full Games,MMORPG Tycoon,VectorStormtrevor @ 6:02 pm

Actually, that’s a dirty lie.

Profiling is fun when it shows you something big that’s easy to fix.  Profiling is a lot less fun when everything is equally slow.  But luckily in my case, there was something big to fix.  :)

I noticed the other day that editing roads in MMORPG Tycoon 2 had become extremely slow.  (Well.. actually I noticed that roads didn’t draw at all.  It was only after I fixed them not drawing that I noticed that they were slow to edit).   This was odd, because I have videos of early road editing, where it hardly touched the frame rate at all on a system much slower than the one I’m using now.  So after some profiling, I found that creating their procedural geometry was taking up about 75% of the whole processing time for the frame when they were created.  This was extremely bad when editing them, especially (because they’re regenerated every frame, when they’re being edited, or when the ground under them is being edited).

Those of you who were at Freeplay will remember the part of my talk where I discussed optimising games, and when to do it (or rather, when not to do it).

For those who weren’t there, the tl;dr version is this:  don’t optimise anything unless you have timing numbers that proves it’s slow relative to the rest of your program, and against which you’ll be able to judge your progress.  Ideally, you get these numbers by using a profiler of some sort.  (Visual Studio has one built in, modern Xcode uses Instruments while old Xcode used Shark, under Linux you have gperf, etc)

What I didn’t say in that talk (and which I’ve regretted ever since), is that there’s a second criteria which can make it acceptable to optimise some code, even if you don’t have performance numbers.  Here is that other criteria:

Continue reading “Profiling is fun”


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.


Next Page »