Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Character Database [Test Release]

I figured since Tdata's request was asking about such a program, I would make another thread, that talks about the program I made to fulfill his request. 


The project isn't finished, by any means, but it gives a decent example of my work, and I figured I'd upload the most recent build and source:
I still have to finish up the Associated Pictures, but I did fix a few glitches, they're not worth listing since they relate to the user interaction/response code, so I won't bother.  Props to anyone who's willing to scan the source and tell me if it's programmer friendly or not.

Edit
I figured I'd add a small aside, and explain part of what's making it take so long.  First, the obvious visual aspect of the program, ensuring that it has a consistent look and feel, and that things behave the way they should.  Then there's the fact that there's multiple ways to do the same thing, just for the sake of ease.  Here's an example, since I'm working on the associated pictures now, it should help illustrate this nicely:
characterdb-example.png

Basically, you have three ways to add/remove/modify any given item, be it magical abilities, weapons, stories, or associated pictures.  There's two ways with the Professions/Ranks since they offer an add item in the list, and the file menu displays add/remove/properties when they're tabbed to (when they have focus, as in the keyboard will directly affect what's selected).

Naturally all this comes at the cost of development time, but I think it's worth it since different users will use different methods.  Some will prefer the context menu, others will prefer the file menu, and yet others will prefer the buttoned approach.  For primary users of keyboards, the context menu is appealing, as is the file menu.  If you don't have a context menu button and don't know the Shift+F10 shortcut, the file menu can be quicker.

As you might have noticed, I have a bug in the screen shot above.  I apparently forgot to associate the 'Remove Picture' file menu item and remove button with the selection of members (or lack of members) in the associated pictures, the obvious result of the bug is the menu item is always 'enabled', which isn't good.  Imagine trying to remove nothing (I verify everything at every phase anyway, so it's not like an error would occur, but I'm prone to mistakes like everyone else).  Simple fix.
 

Tdata

Sponsor

Works great, except that the add Hometown doesn't seem to do anything.  Even I can follow the source with relative ease.  I may not be able to ever code as clearly... :smile:
 
Tdata":13hlw79v said:
Works great, except that the add Hometown doesn't seem to do anything. 

I knew I was forgetting something ;]

Also, I want to add a bit of an aside:
Since this version is not finished, the file structure of the finished version will differ from as it is now.  That means that whatever data you save in the current version, you'll have to manually transfer yourself by using the older version of the program, and copying the data over, bit by bit.  The reason for this is the process used in serialization: it's written down in exact form, so when it loads, it expects it in the same order it was saved in.  If the old format has information missing, glitches occur.  I didn't take the time to write a contextual reference point in the serialization/deserialization routines, so there wasn't really any way to tell what 'version' of the file I was reading from.  I hope that isn't a problem.

Edit (11/29/2008 - 2:23:39 a.m.): The only reason I've been lucky enough to avoid this flaw is when I add something, I typically add it to the serialization routine, with the de-serialization code commented out, until I can save a proper version of the test database in the new format.  Though I only do this once, so it's not something I keep a great track record of.
Edit (11/29/2008 - 8:01:10 a.m.): Well I decided that I'd take some time to develop another ownerdrawn control for this project.  Not strictly for this project, but because I can see uses for it in the future.  An Ownerdrawn ListView control.  The specifics of which I'll discuss later.
 
Gotta love serialization. I could read through the code, but I understood bits and pieces. It's been at least 2 years since I've worked in a .NET program.
 
Right now I'm having fun figuring out how to structure the ImagedListView control.  The buggers at MS decided to make the entire system 'closed' so I'll have to resort to a hack to handle certain aspects (such as certifying that all elements are of a certain kind).

I'll still have to base everything off their constructs, to ensure the proper message chain is maintained; so when they enter a custom item, it's still entered into the list via windows API, since just masking things won't work.  The issue is going to be tightly controlling everything, it'll take a little while to map out the innards so that the original functionality isn't broken.  Figure while I'm at it, I'll add a complex sorter system that will allow you to define complex sort relationships with (the option for) custom sort handlers for each column.  Basically altering the sort by setting a given column's SortOrder, it'll notice the change, and restructure the complex sort system maintained by the ImagedListView.  I'll add a simple sort handler to the ImagedListView so that you can clear/alter it directly, of course.  There will also be sort behavior defined on the ImagedListView itself, Complex, Simple and None, with a boolean to determine whether the user can change the sort behavior.

Naturally this will take about a day to code, perhaps longer, but I've already got a good idea of how to do it, it's just a matter of doing so, assuming I don't hit any 4 hour snags like with the ImagedComboBox.  I tried to alter the drawing mechanisms to enable a fade in/out on select, but there's no good documentation, or examples, on how to update items in the combo's drop-down, so I ended up having to scrap the idea.  All I figured out was that the OnDrawItem event handles OCM_DRAWITEM message to get the OwnerDrawn system started.

Aren't custom controls fun? @_@
 
Well let me know what you think of the program.  Just remember that since it's not quite done, when the final version is released, you'll have to manually copy your data over, sorry for the inconvenience.
 
I downloaded the binary but it wont let me run it... an error pops up that says

"The application failed to initialize properly (0xc0000135). Click on OK to terminate the application"

how can I fix this problem?
 
thanks. I gotta do some cleaning in my room but when im done ill mess around with it and tell you what I think about it.
 
Alright this is an awsome program. so far Ive found a couple bugs just messing with it. First the hometown doesnt work.( I see this has already been addressed) another thing I found is that I accidentaly added to stories that the character will be in and it wont let me delete one of them.

Ill look and see if I can find anything else
 
ya other than that I really havnt found anything wrong with it. It covers everything that I need so far.


This is really nice.

*thumbs up*
 
hmm when I made a new character the weapons from the first character I made carried over to the next character... same with most of the fields.... If I change them it seems to change the first character's field too
 
That's because to improve the accuracy of things.  The weapons are constant through all characters.  You check or uncheck the weapons the specific character users.  Notice how the background behind the image next to the weapon changes color based upon whether they use the weapon.

This is to ensure that if two characters both use the same weapon (or weapons), you only have to enter them once.  This reduces the chance of you misspelling the weapon's name.
 
Wow this control will take longer than I thought: originally I thought I'd be able to do a simple visual override; however, the ListView Control isn't that easy to modify.  In order to properly maintain the overall structure, I had to make compromises in my data structure, on top of that, certain things just weren't available, information wise.  I couldn't hit-test for the ColumnHeaders, which meant I was left to surmising based upon the draw events that were sent in by the control (using Control.PointToClient(Cursor.Position)).  This meant that I had to do my own hack-ish hit testing, that took a while to properly map out.  Here's an example: the splitters (things that allow you to resize something) on column headers are 8 pixels to the right, which affects the 'hot' tracking of that column.  The great part was it's not always 8 pixels, when it gets to the right side of the control's client rectangle, that 8 turns into a ratio of 32 pixels, I won't get into that.

The redrawing mechanisms, overall, were just not worth it to override.  Certain things couldn't be handled in a way I was happy with, an example is the SubItems on each ListItem.  They draw individually, but you can't get important tracking information about the specific sub-item state, which negates the point of owner drawing it in the first place.  Then again I guess it depends on what your goal is with the control.

Here's a mock-up view of how I want it to look.  Here's hoping it goes well:
characterdb-listview-mockup.png


The original ListView control didn't give you control over metric information, which was a large part of the problem.  I'll be coding this one, from scratch -_-
 
on the constructor to your Category Panel Controls (like Character Information)

add this to make it very flicker free on resize:
Code:
DoubleBuffered = true;
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
 
Actually,

That control was just something I quickly threw together.

Though I found this works better:
this.SetStyle(System.Windows.Forms.ControlStyles.AllPaintingInWmPaint | System.Windows.Forms.ControlStyles.UserPaint, true);
For some reason on my system, DoubleBuffering doesn't work.  I get an exception from in the .NET framework itself.  Something about it being unable to render, the GetHdc is invalid in the current object state or something like that.

The cause for the flicker is the control regularly clears itself during resize.  Removing the need to erase the background, removes the flicker.  Since the flicker is caused by the interrupt on the monitor picking up on the control's blanked out state.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top