Sunday, May 31, 2009

21 Things Evidyon Should Watch Out For


Well, I needed to use a number so it might not be 21...but the guy reviewing Darkfall Online, a game I read about today and thought "crap! they did what we're doing" sure made me feel good about our project.  It looks like they went to release, several years late, with problems that we've already solved or are in the process of solving:


As one commenter put it, "I thought I'd stumbled into a re-re-review of Age of Conan."  Ouch.



Steps remaining to implement quests:
- Generate action-trigger UserEvent on alt-click
- on action-trigger UserEvent, check until one succeeds:
nonself actor - if valid:
if npc: send quest trigger to server
if player/monster: show name instantly
self actor - if valid, pull up stats menu
location: ??? if location has items, examine the stack???
send location quest-trigger to server
- on server, on for quest trigger :
validate distance to target
if actor, get actor's list of quest triggers.  break after the first trigger that activates.
if not actor or not triggered, check location's trigger(s)


Quest trigger flags:
preconditions:
currently on quest (quest)
not on quest (quest)
then action:
check end quest (quest)
OR give quest (quest) -- must check to be sure client isn't on too many quests...

NPCs can each give 2 quests and end 2 quests.  They don't necessairily have to end the same quests that they begin--this allows for delivery quests.  They are given 2 quest commentary slots where they can say something when a player is on a quest (to give hints, etc.  again it doesn't have to be the same quests that they give or end!)

For giving quests:
- it is implied that a player cannot be given a quest that they already undertook
- a player can only be on one quest that an NPC gives at a time (the npc won't give you a second quest)
- if an NPC gives 1 or more quests but the triggering avatar doesn't qualify for any of them, the NPC has a phrase for both if the actor could qualify for one in the future, and one for if the actor could never qualify
- if a triggering avatar qualifies for a quest, but is on too many quests already the NPC says something
- the NPC has a phrase for if an avatar qualifies for a quest.  when spoken, the server will cause the quest description box to pop up on the client's screen.  this will also display the quest (and the ability to cancel the quest) in the player's UI
- NPC has text both for avatar accepting and declining a quest.


For ending quests:
when triggered, if the NPC will cause the client's quest-state to be checked:
- if the time limit has not been reached:
- if the client succeeded, say something and do success action
- if the quest's time-limit has been exceeded:
- if client failed by time limit, say the time failure phrase & do failure action
- if the client succeeded at the quest, say something & do success-over-limit action
- if quest not terminated (has not succeeded or failed):
- if client failed by an irreversible reason, say the reason text and do failure action.  ex. irreversible reasons are are lost competition, too many deaths, changing map and too many pks
- if still not terminated, check the in-progress quest commentary

For in-progress quest commentary:
- if the player is on a referenced quest and trigger-clicks the npc, the npc says something to them about the quest based on how much time is left:  just getting  started (<5>, in-progress (> 5 minutes, <50%)half-expired (>50% expired but more than 5 minutes left), nearly out of time (<5>

Locations can end quests too, but without all of the fancy phrases.  This is to be used for ending quests at a location.  For instance, you are given a quest and teleported into a shrine where reaching the end will give you 1 point added to strength.  If you change maps (i.e. leave the shrine) the quest is failed.  The quest has no requirements to complete it, so anything that triggers termination of the quest results in a success.  For this, each location just has the index of a quest for which it examines termination and performs the quest-configured success/failure actions.


Phew!  Welp, now I feel like I have something better specified to implement.




Do be doo...8 pm and it's time for the Simpsons
Also, SCORE quests can be compiled & triggered XD

Saturday, May 30, 2009

I'm still 20 for another three weeks


You know your code project is huge when you can start a recompile, get some coffee, take a shower, return, write a blog post, start up your SVN server computer, commit the changes and it's still goi...oh wait it just finished :D


I gave Unseen Studios a file-header and added it to a bunch of files.  Anywho, I'll be implementing quests today so let's see how that goes.

Wow, it's eleven already?
Implementing quests is genuinely hard!  It's quite an interesting challenge though--there are lots of things to paramaterize.  For instance, we should be able to define competitive quests where a certain number of people succeeding at the quest causes the rest to fail (i.e. frontiering).  Another flag specifies whether meeting criteria for termination causes an instant or delayed effect.  For frontier quests, when the time limit is up everyone fails and they are teleported to a given location.  For delivery quests with a time limit, if the limit is succeeded the quest isn't failed until the player talks to someone involved with the quest and they inform them of the fact.  Also, some quests are succeeded by simply arriving at a given location or talking to an NPC--these external triggers force a quest to succeed, so it's not even necessary for a quest to be innately competeable.


Somewhere along the way I lost my list-of-three.  Gotta keep it going!
  1. Finish building the quest server format
  2. Create the quest client format
  3. Integrate quests into the game compiler

Played a bit today and noticed a bug with the auto-refresher in the bazaar.  Fixed it, will release change with next update.  Also reducing timer to 10 seconds instead of 15 so there are 3 refreshes per cycle.




(I'm just talking myself through this and organizing my thoughts)
It's possible that I could be trying to be a bit too general with the quest system.  I was doing some mental simulation on how to format competitive quests, and I think competitive quests might better be modeled as a different kind of quest altogether.  Quests of the natural type are independent of each other:  multiple players can get the "kill bugs" quest at different points in time (or simultaneously) and complete it without any affect on one another.

Competitions, however, are generally launched simultaneously, can have a limit on participation, have an end-trigger that affects all involved parties, and when terminated ranks participants and performs an action on each based on their placement.

For instance, a frontering quest could be a competition whose end is triggered either by time limit (5 minutes) or by a participant finding 10 Red Charms.  When either of these is triggered, all players are ranked and given prizes: an individual succeeding at the quest (finding all 10 before the time limit) gets the success prize.  Others could get a ranking prize.  All participants are teleported back to the frontiering geosid where they started.

Ranking prizes would be difficult to hand out properly, however, since a frontier could begin with only 2 participants, which would make 2nd place accessible with zero effort.  Perhaps it's better not to have these at all.





Aha!  Just had an awesome idea:  since action-click (right-click for a RH mouse) will be used to activate information about NPCs/locations for quests and stuff, why not use it for the player too?  I'll make it so that right-clicking yourself brings up the central avatar menu.  This should make it really intuitive to navigate the world since everything's consistent!

Se7en
That's how you do that right?  Still working.  Do be doo.  Compiling code has been written, stubbed out the encryption stuff.  Time to add it to the main editor...w00t!


eleven again...sigh
Watchin' hockey.  Sa-weet.  Editor compiles quests correctly for both client and server, double-sweet.  Both client and server can load!  Working on GlobalQuestManager.  Recognized need for being able to specify the creation of indices in database.cfg, have been wanting to do this for a while so I finally got it working.  Just add a * in front of the name and suddenly a linear search turns into a binary or even hash-speed query.  Will be very helpful once more queries are being executed. ...tested, works perfectly!

Yawn!  No bed until 11:30.  That's my schedule:  7 AM to 11:30 PM.  YEAH!  I'm sleepy though so I'm going to work on the new website's layout.

Friday, May 29, 2009

Nineteen

Articles!
  1. http://chrishecker.com/Do_Your_Job_Well,_Please
  2. http://chrishecker.com/Kurt_Gödel_is_Laughing_His_Ass_Off_Right_Now
  3. http://www.uwlax.edu/faculty/will/svd/index.html
  4. http://somethinbeautiful.blogspot.com/2009/05/cool-art-with-folded-paper-paper.html
When I got right down to it, designing the questing system wasn't all that difficult.  I'm implementing a quest creator tool now that, thanks to the way I redesigned the editor's save format, will be the first tool that's separate from the main game-file compiler and should let Joe/Erich build quests that can be easily merged with the main game.

Four
Wow, it's 4 already?  I've been hard at work on the quest editor, and things are going great.  I created an Evidyon tool-project template so that the next tool can be created much more quickly, and have finished writing out all of the quest data structures.  I'm just implementing some actions then I'll crank this thing up and see what happens.

One of the tricky problems I had to solve was how to get a localized editor (i.e. an editor for quests) that references data outside of that which it loads (such as items) to be able to edit those references.  Long story short, I added a "recursive" flag to the load method of the sql database resource storage so that these other resources can be loaded in name-only generic format.  Then, I made it so that references could be set simply using path-names.  I haven't tested it yet (later tonight) but this should allow the editor to save into the main game file without the need to actually know how it works--so even if the data format or structure types of the rest of the file change completely, an out-of-date local editor should still work fine.


I've decided not to include quest initiation or termination NPCs or locations inside of the quest definition itself.  Why?  Lots of reasons:
  1. The manner in which quests are given is more flexible--you can get one automatically by entering a dungeon, for example
  2. We can have several NPCs give the same quest but have different dialogue for doing so
  3. The termination points for a given quest can also be edited independently of the quest itself.  Since changing the map and NPCs are events that occur outside of the quest editor (and the quest editor can't "see" the map or edit the NPCs)
  4. This could allow for a quest to have multiple endpoints!

Another interesting quest item: there are now 3 termination methods.  Success, success over time limit and failure.  This is an effect of the time limit possibly not being a failure-condition.  We can have quests that give different rewards based on whether or not you met the time allotted.

2235
Quest editor done--tool template complete, will be refined as I make more tools.  Note to self:  when item are required to finish a quest, they must have been generated after the quest was initiated.  So store the ID # of the next item to be generated and be sure only items created after that point qualify.

Thursday, May 28, 2009

What's the Simplest Thing that Could Possibly Work?

After much coding this evening, a break reading YCombinator News has come through for me again.  When designing my code tomorrow, this is the thought to keep in mind.

Day 18

The walls are kindof annoying, but definitely necessary.  I'm going to work on those some more this morning, then maybe do some quest stuff since that's more engaging.


Ten
I'm EVEN MORE officially a business--I've got my own Employer Identification Number!  =D

Eleven
I found a very useful DX FAQ here:  http://tomsdxfaq.blogspot.com/


This DX development has made me realize that writing a new map engine is going to take a LOT more work than I had anticipated.  Although the basic standalone system is fairly straightforward, integrating it into the game is going to be much harder.  First, if I change the map renderer then the map format is going to have to change on the client to support the new information on visibility/occlusion and walls, which means rewriting the editor's mapping component (both the compilation part and the visualization part).  Since the editor changes, the server will also have to change to read the new format.  Add in debugging time for all of this, and this project will probably take two weeks before it settles down into something useful--but in that time, I could have coded a significant number of other features.

Since the game does work without this map update and I'm not 100% sure it will fix the major bug I'm trying to nail down (BSOD), I think it would be best to develop in parallel:  work both on the map and on features that the game doesn't have at all, splitting my days between them.  Comparing the time I've spent working on the map so far (3 days) with its results (nothing new) with the time I spent working on gameplay updates (1 day) with its results (massive), I'm afraid I'll tinker away all my time with the map, mid-June will roll around and the game will still be lacking major features.

It's effective (if sometimes tedious) to fix and/or unify components that has been implemented, since you know how they are supposed to work--but unless they're fundamentally broken, it may not be the best use of time.  I'd say the map is at 80% right now, and I could get it to 95% with a week of work.  Quests and frontiering are at 0%, and I could pull them up to 50% in a few days.


Three
Fixed the installer and significantly updated it.  Added a very basic license agreement and rules.  Also put in a nice lookin' Evidyon banner at the top!  Also, I found that all I need to do in order to have the installer overwrite previous version is remember to update the version number each release.  I wish there were a way to make that automatic... Looks like it hasn't been updated since 2.5.0

Going to work on Vista file-permissions bug.

330
I'm now a file-permissions guru.  Basically, the Program Files directory has moved for programs that actually need to update themselves.  Unless you want to splay your program over multiple folders, it's now the Common Files directory.  Also, you can use the following function to find configured folders so I'm using it to put screenshots into "My Pictures" instead of the Evidyon install directory.


Four
Found AppVerifier from Microsoft.  Using it to test Evidyon for errors--let's see if it helps find BSOD!

...bummer.  That was a waste of time.  Oh well.



Installer works great now, tested the new version.  Also completetely revamped the instructions document, complete with fun Evidyon ASCII text.  Woot.


sixthirty
I now know Python, as well as how to write Excel spreadsheets with it.  It would be very powerful to write quest scripts with Python--my only reservation is the sensitive execution time of the server.

Wednesday, May 27, 2009

floor(exp(2.84))

Fixed some problems with the last release.  Item drops now work properly, and order of equipped items doesn't affect their chance to drop (so you can't protect items by equipping them last, for example).  Also fixed going evil too rapidly--if you took 6 hits to kill someone, it would count you as 6 pks instead of 1.

Alignment now regenerates more quickly.  +1 unit per day seemed very slow--it's upped to 4/24 hours.  However, the first 20 hours after your last pk counts as a day so players who log in often regenerate a bit faster.  Also, after 48 hours the rate drops to 2/day and is capped at 30 so that inactive characters don't gain a huge amount of alignment.


Two
tweak tweak tweak!

Three
The living room has been reorganized.  I've got my double-strength green tea with honey.  Time to pwn some code.

Seven
Lots of code done.  Working on quest system since I got bored of messing with walls.  Nobody has any good articles, looks like I'm on my own again.

Eleven
Skype rocks my socks.

Tuesday, May 26, 2009

Sixteen Candles

After our group meeting yesterday, I worked hard on the alignment & PK system for Evidyon and churned out a bunch of new code.  The only things left to do before I can release this update are (1) implement the "Evil Town" where players who go evil and are killed spawn, and (2) do a bunch of testing to make sure everything works.

Eleven
Evil spawn point is implemented.  Rebuilding the editor and going to get started testing.

Whoops, forgot that actor templates need to have an alignment parameter.

Noon
After much testing, the system works great!  The hour counter was more difficult than I anticipated but using GetSystemTime, SystemTimeToFileTime and some hints from RtlTimeToSecondsSince1970, I managed to make it work.  I can use this same system for handling account time, too!

One more thing to do before I release:  put alignment on the player's stats screen.

Four
Back from a long lunch.  Alignment is on the stats screen.  I'd like to add race/class display to the screen also (temporary hack for now, this screen is going to be redone anyway).  Fixed a small bug I found in the server code that caused evil players to register as PKs.

Another cool idea for PKers I wanted to write down:  after a PK, you get a glowing red effect around you for a few minutes (so you're easily identified as a killer!)

Monday, May 25, 2009

I'd have 15 cents...

If I had a nickel for each time I've written a Direct3D rendering state manager.  See how I worked today's number in there?  Pretty slick.

Anyway, the new terrain renderer is SO COOL I don't know what I can say about it.  It's coming soon and supports a ton of features, and I've finally solved some problems that I had been ignoring (point-light effects being one of them).  I'm integrating it with the other components and I'm unifying all my D3D rendering code in the process.  New (very simple) component I'm just about to write handles lights on the map.  This will essentially "allocate" lights for effects.  Since D3D can only handle 8 enabled lights at a time and the lights have to be repositioned based on the camera's location (the world moves around the camera, not the camera through the world...weird, yes), this manager will let other classes allocate and free lighting structures so that magic effects can illuminate the world.  Groovy.

Also, found a memory leak bug in the client's actor effect binding allocator.  Uploading quick update to fix that.  That reminds me, I should mention that I'm adding another new effect binding type:  scenery binding.  This will let scenery have special effects attached, so swords can have sparkles and glow.  To create the special effects for weapon attacks might be a bit difficult. Right now when an actor gets hit, it just sets a "blood" flag in the update packet.  It doesn't specify the actor that hit it, since it's obvious to a player watching and was (up till now) immaterial to the game client.  However, if a fire-sword bursts into flame when it hits a monster...that means the sword needs to register a hit or the monster needs to say who hit it. AH!  The former is much more simple to do, since landing a hit is always recorded on the server.  I can add a "special hit effect" to weapons and pass the sfx id into the attack structure, then just generate the sfx if valid when registering damage.  Piece of cake.

Ok, finished compiling back to code!

Sunday, May 24, 2009

All Fourteen Ducks in a Row

Apparently the value of  (-5)%3 is not well defined, and is inconsistent between platforms.  Well, nuts to whoever decided that one.  I need negative % for the map code, so here's a fun hack:  to make a%b work over a exists in (-c,+c), instead use (a + d)%b where d is some multiple of b that is larger than c.  In other words, just make it positive in a way that doesn't affect the result.

The map editor is going well.  I've finished the framework for the renderer, and not only is it a bazillion times more efficient than the old one, it looks better and is more simple!

1. Map renderer
2. Bugs
3. Map Tool

One
Map still coming along.  Occluded areas are colored slightly darker to make it more obvious one cannot see them.  Going to have to use fog for pits instead of coloring the vertices, but that's not a big deal and it should be that way anyway.  A cool effect though is that I can fog an area and you can't see the pits in it, then if you fall in one you'll go "beneath" the fog and you'll be able to see them.

Two
Took a walk in the gorge, it's a beautiful day.  Also, occlusion works great!

Eight
I'm making a render-state manager that's essentially a mixed speical FX and texture manager.   This'll make it simple to integrate the same effects into the editor and client--right now they were developed separately so even though they do the same thing, they aren't a shared structure.

Saturday, May 23, 2009

Lucky 13 and I Heart DBs

"CREATE INDEX IF NOT EXISTS ..."

I did a lot of optimization on sqlite iteslf using various pragmas, securing it only for single-threaded access and using only pre-prepared statements with bound parameters.  Next, I changed the queries to build the hierarchy using unique keys instead of path strings.  Finally, I created an index for the owner keys that build the hierarchy and the loading time went from 15-20 minutes down to 6-10 seconds.  YEAH!!!!!

I have learned a lot about databases while doing this fix.  Namely, if you're looking for something frequently it should be an integer key and should be indexed.  Also, databases are great but their flexibility and power has to be well managed.


High Noon
Fixed a small problem with dcReference.  Noticed that the swarm spawning density, which implements dcGenericResource directly, didn't implement toString correctly so it wasn't being saved (0 densities everywhere) and compiling caused an infinite loop.  Fixed, and editor works great now.  Going to start on the next list items.   Let's take a look at our beta document.   Says BSOD bug & map tool.  Well, rewriting the map engine is a prereq for the BSOD bug fixes (*crosses fingers*)

1. New Map Renderer, carefully programmed to fix BSOD
2. Get people with BSOD problem to play, if not fixed add testing code for that
3. Vista file-permissions bug, fix installer crappyness, freezing at log-in bug (hopefully fixed by map also)


Thinking on Paper
The map needs to support several distinct features:
  1. Terrain composed of square tiles with different textures in 4 rotated versions
  2. Walls
  3. The ability to black-out sections of the map based on what the user can see (to hide the contents of rooms beyond a wall)
  4. Pits
  5. Second terrain layer for overlays like water, lava, acid and whatnot.
  6. Special effects attached to map
  7. Map triggers.  This is already implemented somewhat, but we need triggers for scripts.
  8. The ability for the server to change elements of the map (?)  Could be useful for switches and such.  This seems like it would be a set of "region flags" that are sent when a new region is entered to describe the state of that region.
  9. Lighting settings so that dungeons are dark, inside it's bright.  Probably a float-variable where -1.0 is always night, 0.0 follows day/night cycle and +1.0 is always day.
Let's see...
region_flag = flag_index > 8 ? 1 : ((flags >> flag_index)&1);
if (region_flag) {
flag_parameters = getParams(region_flag);
switch (flag_parameters.type) {
case SPECIALFX:   specialfx_manager_.createSpecialFX(flag_parameters.specialfx); break;
case SCENERY: scenery_manager_.createScenery(flag_parameters.scenery); break;
case WALL_DOWN: map_manager_.wallDown(flag_parameters.wall_down); break;
case WALL_UP: map_manager_.wallUp(flag_parameters.wall_up); break;
}
}

Yeah that could work!  Up to 8 different triggered effects per 16x16 region, but any number of allowable effect types.

Walls first.  I don't like how a lot of games use a straight LOS algorithm that produces crazy shadows on the map everywhere (ala Diablo).  It's too dark and makes you feel like the game's artificially restricting you.  However, I can't just have monsters waiting in a room while you're standing there on the other side of a partially-open wall looking at them.

I think the solution here is to show all areas of the map that are connected by non-occluding tiles to the one you're occupying, but compute an LOS between actors and only display those that are directly visible to one another.  I can even do a quick/cool "fade in" of the mesh for characters that just came out of a shadow.  This does mean, however, that all solid walls shouldn't be occluding.  This would make characters pop in and out of existence randomly and that doesn't seem reasonable.

So the map needs a new layer for occlusion is the upshot of this.  Layers for now include:
  1. Texture / rotation
  2. Terrain Height (lower than some threshold will color terrain black to indicate a pit)
  3. Fluid Texture (flat plane at -1/4*tile_size depth)
  4. Wall flag, wall height
  5. Occluder (boolean)
  6. Scenery (objects), Animated Meshes (swaying grass?)
  7. Navigability (walk/swim/impassable/prevent teleport/no spells/reduced speed)
And per-region:
  1. Monster swarm spawner
  2. NPCs
  3. Triggers (map teleport, regen HP, scripted event)
  4. Flagged Actions (controllable wall up/down, scenery action ex. open door, special effect)

Ok, let's get started!  This is going to be fun :D

Friday, May 22, 2009

12 Times the Lines

The damn SQLite database just won't load!  It saves the file fine and I can look at it in a standalone editor...but can the program open the file?  No way. RAWR.

1 hour later...
CRAP.  I had already fopen'ed the file and was trying to re-open it with SQLite.  That was pretty dumb.  Still, if it isn't one thing its another--now the loader is very slow.  *fixing*

1 pm
Almost fixed!  :D  Also, here's a good article I read on the Netflix movie-prediction competition while my code was compiling.  Five minutes later, still compiling.  Read an article on how silicon chips are made.

Ah!  I forgot I had not updated the 3-things-I'm-doing post.  Well, I guess it didn't change much:

1.  (Still) changing editor save format
2. Bugs
3. Map tool

3 pm
The performance of the loader is still sucking pretty bad.  The problem is that since the file isn't linear anymore, all of the resources must be looked up by name when they are loaded.  That's a TON of string comparisons.  I think I've found a way around the problem by saving an "index hint" in the record that should allow correctly-saved resources to completely shortcut the comparison, but we'll see what happens...

4pm
I've downloaded the Visual Studio standalone command-line profiler and found this awesome walkthrough because this is just getting silly.  I have to say that the profiler works GREAT.  Unfortunately it told me what I suspected, that the SQLite database is being dumb.  Trying some optimizations.

If only I still had milk so I could drink coffee...and sleep more.  My brain's a bit fuzzy today and I feel like I've been hammering at a problem for a second day that should have taken me only a few hours.

Thursday, May 21, 2009

Eleventh Heaven

Finished the core spreadsheet, for now.  Only design points left untouched: regeneration rates and regeneration spells (healing).  Player HP may need to take a hit, or possibly monster dps increased,  when these are introduced.  ...Actually, everything's calibrated for players being completely killed by a single monster in 4-5 seconds right now anyway so maybe not.  We'll see.

1. Changing editor save format
2. Minor Bug Fixing
3. Map Tool

12:30 pm
Modifiying the save format is going very well.  I should have it done this afternoon.

6:00 pm
I've integrated the new saving method into the editor.  There are some residual problems with how reference links are saved.

Wednesday, May 20, 2009

10tinnabuation

I can't believe it's noon already!  I've taken the morning to do some design work that will help lay the foundation for a balanced game, and things are coming along extremely well.  It's important that we start getting numbers together that jive with each other--after all, most of what the server does is just running gameplay equations.  Unfortunately this takes dev time away from finding code bugs, which is my next task.

As for the list of three things that I'm working on next:
1- Balancing global design equations in a big excel spreadsheet so Erich/Joe/Alex can assign  numbers to the items they make that won't have to be continuously revamped and should stay balanced
2- Changing the way the game editor saves files to use a database.  For many projects I'd imagine this would be a huge change; however, I expect to have it done tomorrow.  This solves a big problem:  it will let me write tools that load and work on only sections of the game file individually without having to know how to handle the parts it doesn't recognize.  For example, I can write an item editor that *only* edits items--even though all of the textures, images, maps, npcs, meshes etc etc are all in the same file, they are transparently ignored by the specific editor.  It can just go in, do its thing and leave.  By being able to make very modular editors, I should be able to improve the overall quality of each.  Included in this "step" is to write an item editing tool using the new editor model to make sure everything is working.
3- Bug fix update

Tuesday, May 19, 2009

To the 9s

Coffe Nutrition Facts
Found the other divide-by-zero bug.  Same story, different day--magical weapon attacks with 0 random damage.  Fix going out with the bazaar update.

As far as that goes, the bazaar works quite well though I'm still worrying about how to handle gold. Gold needs to be tradeable and droppable just like an item--problem is, it's not completely an item since we don't want it cluttering players' inventories.   Maybe if there were a "bank" (or perhaps storage?) where putting gold would stack it up into the fluid number in the corner if the screen, and from there it was spendable, but to trade or drop it you would have to carry it around as an item.  Seems like it would be a bit annoying, but I can't think of a better way at the moment that doesn't require making a whole lot of hacks into the other systems.


Adding the items into trade was really easy.  All I did was add a parameter to the network message for currency (SUPER easy thanks to the serializer...omg I love that code) and in the trade controller for how much was offered on each side.

In the course of developing that, I realized I could create a generic "user inputs number" prompt fairly easily using the code I'd already written from the Bazaar and changing the GUIModule code slightly so that it gets passed messages after they are sent to the subcontrols.  The upshot is that with only a few lines I can stick in prompts anywhere they're needed, and they correctly block the user from interacting with all other controls.  W00t!  I love modularity.

After thinking about the problem for a while, I decided NOT to treat currency and items the same way.  For one, items have a lot of special processing and are used throughout the server.  Adding more special processing would just complicate things, and all I really needed to do was to be able to drop items on the ground.  Since dropping 1 gold several times on a single square of the map should still result in just 1 pile of gold if I implemented it along with items this wouldn't be possible.  Long story short, gold is stored alongside items in the world regions in a separate map.  There are a few lines for special processing, and gold will persist as long as the region is active--it's never "cleared" like items are.  It would be trivial to add this, but I think it's kinda cool that it doesn't work that way because then you can tell if an area's been active recently by whether or not there's gold present.

I think this update's ready.  Entering gold into the system is a bit hacked in right now (fixed chance 1/20 to drop any gold, drops 1-10 randomly 90% of the time and 20-30 the other 10%), but I think it'll let gold start working its way into the system until I put something more final into place.  Also, I'm going to list some items in the bazaar for players to buy so they can see some cool stuff.  I'll make up some new items just to have something interesting for them to ogle.

Only other  minorly sucky point: gold looks like a big chest on the ground.  It'd look much cooler as a nugget or a pile of coins or something.


3 pm
I gave in and made the pile of coins icon.  Ahh, much better.  Also I moved beam so it's not coming out of the crotch anymore--it's actually coming out of the hands, or closer to where they're going to be when I add that animation.

4 pm
Update's out.  Works like a charm.

Monday, May 18, 2009

Eight, eight my office is great

Today marks the official start of summer development.  I'm done for the semester and it's time to get down to development.

First things first: checking out my office space.  A few words, "superb" and "comfortable" come to mind.  I have dual screens on a big desk, sunny south-facing windows, a big LCD TV with Wii Fit and a full-size refridgerator.  Doesn't get much more luxurious than this.

moving on!

I'm going to have to power through this Bazaar GUI creation.  We'll see how it goes.  On a side note, I'm not sure what I'll do when I'm on post 73 and can't come up with a clever title.  I might have to break this silly pattern.

I was looking for GUI design stuff last night and found Welie.com, a website that just lists all kinds of different GUI elements.  It's pretty fantastic.


5:30 pm
Bazaar is up and running!  Now just to make it a bit prettier, do some thorough testing and release it.

7:30 pm
Interesting article on making apps that "go viral".  Complete with fun mathy viral coefficient.  Bazaar has been tested, fringe cases (listing bazillions of items) seem taken care of.  Just need to be able to drop gold on ground and get it into players' hands somehow (autobuyer?) and away the economy goes!

Sunday, May 17, 2009

Still crashing on the 7

The server's still getting divide-by-zero errors.  It's so weird that I'd have multiple ones that all show up in the same release.  This one is much more mysterious.  It's *probably* being caused by a buffer overflow of some sort.  Symptoms:  corrupted stack variables, debugger trace doesn't go all the way back up the call path, it breaks down in areas that should never break (the STL in hash_map, ws2_32.dll, ...)


6 pm
Server hasn't crashed yet.  Murphy's law, attaching a debugger to a normal run makes it work great.  Wtfs abound.  Also, bazaar's coming together.  Got items display on the client like a charm.  GUI is still a huge pain, not sure what I can do about it yet but I have to think of something because there's no way taking 2 days to add a single set of menus is sustainable.

I did some work with the hp equations and realized what curve I really want:  exponential rise up to a straight-line.  All dps should be based on hp.


7pm
The bazaar is almost finished.  There HAS to be a better way.

Saturday, May 16, 2009

On the 6th of the season, I found the divide-by-zero

For the last week, Evidyon has been plagued by an "integer divide-by-zero" error that crashed the server several times a day.  A perfect example of a Heisenbug, it occurred after a seemingly random amount of time, never on my test code and nobody knew what was causing it.  I had the insight to install MSVC++ 2008 Express on the server, transfer over the PDB and catch the error the next time it occurred.  The first couple of times the error looked like it was coming from the enet_host_service method, but the stack was all messed up and it just didn't seem like a logical place for the errror to occur.  This morning, however, I attached the debugger in a different way (attach to the process when it created the exception, then hit "break all", then OK on the dialog) and it took me into the melee combat controller.  A few updates back I changed how characters calculate their damage, and apparently some had a zero range--so when damage = base_damage + rand()%damage_range was invoked, damage_range was sometimes zero and a modulus by zero invokes a divide-by-zero exception.  Bam!

1pm
Changed the view perspective.  It's MUCH better looking now.  Also added day/night lighting effects--nothing fancy, though.  Update went fairly smoothly.  The EXE was corrupted in the upload though and something weird happened.  Recompiling fixed it.

2pm
Another problem has reared its ugly head: melee damage is fuxed.  Players are doing far less per hit than they should be.  I'm going to work on this after bazaar, since it deals with armor/weapon damages/etc.  They're all linked.

4pm
Coded EvidyonGUIActionButtonList, EvidyonGUIModule_BazaarCategories, EvidyonGUIModule_BazaarCategoryItems and EvidyonGUIModule_Bazaar.  Added actions to the UserActionQueue, fixed a minor oversight with the tell-items network message.  *phew* coding UI is tedious.  Going to get through it though.

5pm
I didn't fix the error.  Stupid % not being dominant.

Friday, May 15, 2009

5

Wolfram Alpha is incredible! You can get almost any information you want with it... now I don't know what to use it for, but I'll keep it in mind for future assignments.

Watched an old Xenimus PVP movie.  Good examples of style.

I've learned a lot more about DLL "hooking" by reading some articles about wallhacks.  Most of them are l33t h4x0r types, but this article on GameDev.net is really good.  He gives full source-code for hooking a d3d9 application.  I'd love to have it as a drop-in profiling/debugging tool for Evidyon so I could hook the game on various computers and see what's going on.  Unfortunately, although it works on the two simple samples I tried (vertices tutorial, meshes tutorial) it *doesn't* work on Evidyon!  Somehow, the DLL (which swaps out the Direct3DCreate9 method) only gets loaded *after* the method is invoked...so it never has a chance to be called!  Unless there's a way to up the priority of this library then I'm not sure it can work.


In fact, there is a way!  Thanks to this Wikipeda article on DLL injection, if I put the DLL in c:\windows\system32 and add it to the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs it is loaded whenever user32.dll is brought into memory by the program.  I played around with this a little and thanks to some code I found on the web originally for creating your own wall hacks, was able to intercept several method calls on IDirect3DDevice8 objects from D3D8.DLL.  Groovy.



Reading this article on how software is developed for the Space Shuttle inspired me to write out the following idea I had for small-scale robust software development that I'd like to try at Unseen Studios once it grows a bit:

Each project is tackled by three teams:  Specifiers, Programmers and Verifiers (or in less stoic lingo Dreamers, Hackers and Smashers).  Everyone working on a project is either a Programmer, Verifier, Specifier-Verifier or Specifier-Programmer.  Only management can be just Specifiers.  Assume gaining "points" is motivating.

Verifiers gain points when they find a bug in the code or something missing from the spec.  Programmers gain points when they find nontrivial unspecified behavior in the spec, or discover a way to shorten the current development cycle.  An example would be reusing old code instead of writing new code.  Programmers also gain points when code they've written gets reused.

Thursday, May 14, 2009

IV

Articles read this morning while watching the news:  Being a Better Programmer, Raytracing on a Grid, Computing LOS for Large Areas, Tile-Based FAQ, Game Coding Complete:  Smart Design Practices.

A couple of those articles are from Amit's Game Programming Information, which has really good information of tile-based games that is applicable to Evidyon's map.

Interesting side note, this was the article that defined my coding style for a long time.  I really liked the spaced-out, easy-to-read and well-commented code written this way.  Honestly, I still do like that style--but now I use a modified Google style because I can write code more quickly and I can see more on the screen at the same time.  Using OCAML (Java) -like function names is my major difference from Google's code spec.  If you ask me, their way of naming methods is a major flaw that probably confuses a lot of their coders--functions look exactly the same as every single variable.  Maybe I'll write something on it at some point.


In preparation for registering Unseen Studios, I've just purchased UnseenStudios.org, UnseenStudios.net and UnseenStudios.info for the astronomically huge price of $16.  Woot.  I'm just glad nobody else got to this first.  Then again, Xenimus.com has been around for almost a decade now and noone has purchased Xenimus.net.  That reminds me, would it be an effective marketing campaign to purchase unused domain names related to other games and redirect them to Evidyon?  After all, I'm sure people visit incorrect domains all the time...and if one were to post "worldofwarcraft.biz" links, chances are many people would visit, and if the investment brings in even 1 new player then it's paid for itself.  Hmm...  is it incredibly apparent that I've been studying for my entrepreneurship exam all day?

Wednesday, May 13, 2009

Day Three

Still sick.  Final test in Entrepreneurship tomorrow.  That reminds me, I really need to register Unseen Studios as a company asap.

Read the Game Developer magazine that came this morning.  It has an interesting article on asynchronous resource loading using fibers.  Cool idea because fibers stay within a thread, so that works around the problem of both concurrent resource access and DX's hatred of multithreaded apps.  There was also an ad for Intel's Graphics Performance Analyzer that seemed particularly interesting.  I signed up and downloaded it (327 MB!)

I hope to get the Bazaar finished today, but we'll see how it goes with my head feeling like it's stuffed with cotton...


The Intel GPA tool is really interesting!  I managed to get it working on my machine, and it lets me just snap frames of data and analyze exactly what's going on with them at some later date.  Even better, I can modify the current state and see what happens to rendering times and such.  Very cool.  One thing I tried was to enable lighting on the skeleton meshes to see what was screwing them up.  ...and now, all of a sudden, lighting works again!  Wtf!  Before, it was causing the skeleton meshes to lose a limb when rendering.  Now it's perfect.  *sigh*  Lighting does look cool though.

I also found another nifty tool for redirecting inter-module Win32 function calls created by Microsoft Research.  It's called Detours.  It should really be called Hijacks.  Or perhaps Highway Robberies...you can pretty much do anything to any program with it.  I'm surprised they provide this tool, it seems like they're doing a virus hacker's work for them.


Bazaar is going very well.  Mostly done with server-side interface, about to start coding DB stuff.  Not quite sure how to do commission at the moment--i.e. should it just be yoinked from the player, or should they be able to see how much it costs?  Probably the latter.  I want to base it on how many items they player's already listed, though--that way we don't have to institute max # of items listed, just have a really high price for listing more than a few items (so high that almost nobody will pay it).


Bazaar server-side (client interface, database, network messages, request processing) almost finished.   Cool way of handling more items than a single screen:  just have the server cache items on a screen and rotate them every few minutes.  That way, not only does the bazaar look "active", it also reduces server load since the bigger DB queries are very spread out.  Other nifty side effect: you can watch other players buy items, since they're just marked "sold" in the cache and still sent out to players browsing a given category.

Now that I have long blocks of time to devote, I can completely focus on spending an extra hour teasing out all the nuances of designing new code.  As a result, the bazaar's design is rock solid.


There's no way to describe how freeing it is to code when there's nothing else on my mind.  I haven't had this luxury in a very long time.  It's going to be a good summer.

Tuesday, May 12, 2009

Visual Leak Detector

I <3 VLD

  Simple and effective--copy in the files, link the library and read off memory leaks in the exact same way you do compiler errors.

Not only that, it has a stack trace that Visual Studio recognizes (so actual lines of files are linked) and gives you a preview of the leaked memory.  It deserves a post of its own in his blog because it's helped me on so many occasions, and did so once again today.

Day Two

TurboSquid doesn't suck as much as I thought! Years ago I was turned off of TS, but they have a cool set of models there that Richard sent and TS will convert them for free to a usable format.  Groovy.

Also, good armor models $50 over at the3dstudio.


Of course, upgrading to VS2008 broke Evidyon on some computers since it now uses v9.0 of the CRT, and the installer only added v8.0 to users' computers.  Re-compiled installer and uploaded new version.

Added MD5 password hashing to passwords last night.  Temporarily disabled since the DB will have to change.  Or will it?  I could send password as a MD5 string and store the string in the DB...32 characters = 32 bytes as opposed to 32 hexs = 16 bytes.   *sigh*  I guess that's ok.


Added names to trade screen.  Serializer code I wrote yesterday is **fantastic**--normally it would have taken 10-15 minutes to make the change just because editing network messages used to be a huge pain.  New system took 30 seconds.

I noticed that the fastsync gets fuxed for 1 cycle when a client logs off since the type counter goes OBO (noticeable behavior: XP bar flashes full).  Changed some stuff that might fix that.

I must say that upgading to VS2008 was a great idea--the debug mode is substantially faster than in 2005.  I can run two clients and server all from the debugger without lag.  Doing just client/server was enough to bring down 2005's debugger.


Fixed problem with items disappearing too quickly from ground.  I'm now convinced that I should sit on a problem for a little while and let my mind work out the background stuff.  I had thought it was a very difficult thing to fix up-front that would require rewriting the item removal system.  Turns out it took about 5 lines of code doing it a way I hadn't initially considered.  Solutions just seem to pop into my head sometimes.

Added list labels to all screens that were missing them (inventory, storage, geoling, use item, cast spell)

Added "name:" label on create character screen, cleaned up some memory leaks (see VLD post :D)-< )

Removed "Lacertus" spell from knights.  Not sure why it's not working, but better not to have dangling features.   Added button sounds, they work beautifully.  Added footstep sounds, they're also great!  Forgot that removing a spell screws up all the key indices.  Key bindings are reset.  Upgrading to version 2.14 and releasing.



Read an article on Cuckoo Hashing.  Pretty nifty way to have a hash table with no linked lists.  Basic idea is to have a hash table for which each possible member generates two distinct hashes, and can be at either location in the table.   Should one spot be filled, it can take the other.  Should both be filled, it replaces one and that one is re-inserted (hopefully into its other--blank--hash location).

Single-player level design is also a good article (Gamasutra).

I'm trying to import meshes into fragMOTION and link them to the character models.  It seems to work OK, so the armor meshes I'm about to buy should look great.


Right-click now splits a stack of items in half.  Fixed bug where picking up a stackable item doesn't immediately update the stack's size on the client.  Clicking on a stackable item in inventory (which normally equips an item) re-stacks the item first so you can assemble stacks easily.  Items are now consumed in last-first order when triggered by a key binding.

Monday, May 11, 2009

Day One

Installed Visual Studio 2008 to replace 2005, which has stopped compiling MSI files every week or so. Really annoying, hopefully the upgrade will fix that.

Watched the Human Computation Google talk.

Looked into drag-and-drop with OLE/COM while installer was running. Great tutorial at catch22.net. Stupidly complicated, don't know if it's worth my time to figure out how to use it for the upgraded game editor. I suppose it might be if adding would save editors time adding new content.

Released trade screen update yesterday. Going to clean up code this afternoon and start working on items (not sure what: editor and/or server).


Did a lot of work on serializer class for network messages. Making it really easy to add new functionality. Simple example:

char buffer[512];
typedef
BufferSerializer<Array<char>, int, int, int> Message;
Message::writeBuffer(buffer, buffer + 512, &CopiedArray("hello there!"), 1, 2, 3);


Code copies string and numbers into 'buffer'. To read out data again,

char text[128];
size_t text_chars;
int a, b, c;
Message::readBuffer(buffer, buffer + 512, &CopiedArray(text, 128, &text_chars), &a, &b, &c);


Also making classes for TranslatedArray (instead of CopiedArray) so that big structures can be packed down automatically. Nice thing about templates: all of this code gets optimized and inlined.

Finished integrating new serializer into Evidyon. Cleaned out a lot of dead code left over from the Evidyon Alpha 1.0 and even PV days. Housekeeping, etc.

A Summer in Development

This blog is mostly for my own reference, so I can keep track of what happened summer 2009 regarding the development of Evidyon and my company, Unseen Studios. Many of the posts will only make sense to me, so if you stumble across this wondering "why would anyone ever put this on the web?" my answer is, "why not?"