Skip navigation.

Adel's Blog

Computer graphics, anime, programming, and random stuff.

Misc. Things

  • Trial went somewhat ok. The judge heard a couple of witnesses who said nothing of consequence, and the next sitting is on February 16th. Things are not looking up though - the family of the deceased have clearly expressed that they have no intentions whatsoever to drop the lawsuit. Enough about that.
  • My computer was infected! I've been living happily without an anti-virus for years, and yesterday my computer got infected. I thought knowing the common ways viruses manage to get run on a computer I was safe, but I wasn't. I have two computers hooked together with a cross cable and I wanted to play Soldat with my sister. Long story short, I temporarily disabled the kaspersky firewall on the other computer, the worm/virus/whatever got in through port 445 (it was open because I enabled file sharing between the computers), and the stupid Windows allowed it to execute. Then, it transferred itself to my computer (using the same method: port 445) and also got executed. It closes Process Explorer as soon as you run it, so I tried renaming it to blah.exe and it worked, but strangely, there was no alien process in the list. Yet the firewall was reporting a process named wmisfrh.exe trying to connect to somewhere (there was also a Bulu.exe which I'm guessing is another name for the same pest). How can a process hide itself from Process Explorer? So I just restored a previous image of the HD and I had to reinstall the few programs that I use.
    Lesson learned: disabling your firewall is dangerous! And Windows is stupid.
  • I switched from VC++ 2008 EE to the 2005 version, and from a recent Windows SDK to "Platform SDK for Windows Server 2003 R2". Why? Because to me the 2008 looked and functioned exactly the same as the 2005 one, except it came with .NET 3 (or 3.5 was it?), and the headers and libraries of the Windows SDK but not the docs. And with a crappy internet connection like mine, I needed the offline docs. The switch was not completely smooth. I got a "Resource Compiler Error RC2176", which I resolved by recreating the application icon with the awesome icoFX with the "compress 256x256 images for Windows Vista" option unchecked. Also, I had to add "_WIN32_WINNT=0x0500;WINVER=0x0500;" myself to the preprocessor (VC2008 did that automatically). No big deal.
  • A childhood friend of mine, Zaidoon, came back from the United States. He's been there for ten years. Seeing him was good... brought back lots of memories. We used to do a lot of things together. We caught sparrows and grilled and ate them, we played lots of soccer, chess, and we used to lie to each other like crazy! Good stuff.
  • networks is an awesome freeware program to keep an eye on your download limit (if you have one, which you probably do if you live in a crappy country). Also, TOff is nice (you tell it when, and it will turn off your computer for you). I have yet to try and see if it works to turn off the computer after a download completes.
  • Curvy development is going forward rather slowly. I will therefore put a "soft" end to it by creating a one-week schedule to put in the features that need to be in it before it's usable. I don't know what I'm going to do with it eventually though.

Curvy Progress - Undo and Enhanced Smoothing

, , ,



Nothing special really. The old smoothing code was flawed. Also, the new implementation allows for easy smoothing of a curve without destroying any sharp corners in it. As for undoing things, the implementation is solid and efficient, but still a lot of curve copying needs to take place. This can only be optimized so much. Having an infinite undo queue is therefore not really a viable option, especially with long times of usage which are typical of this kind of application. Unless eviction to hard disk is implemented, a limit (though typically high) needs to be set. For now, it's infinite.

But I'm still having trouble designing the application. Without a well-defined end result it's hard to push on forward efficiently. Should the operation of the thickness modification tool be integrated into the "curve manipulation tool" or should it remain separate? Should there be a separate curve smooth command or should the functionality be kept with the smooth tool and give the tool a "flood" button to smooth entire curves? What about curve alignment and connecting and separation - should they be implemented in separate commands or in yet another interactive tool or both? Lots of questions.

Unrelated stuff:
  • Trial is a week away and I may get locked up :frown:
  • Internet connection has been slowed down, or rather crippled, due to exceeding my "download limit"! 7KB/s WTF!! And the download limit is rather low... seemingly only 7GB. Damn, this is so third-worldish.
  • I haven't left the house since I came back from the hospital (except to the trial and the barber once). That's about 6 months. I am somewhat depressed as one would expect, and I haven't shaved in months. I now have a thick dark beard. I look scary. I'll take pictures of myself for reference before I shave for the trial, haha.
  • Kara no Kyoukai is finally complete. I watched all 7 movies. It's madness. It's too incoherent and not really enjoyable, but I watched it for its high production value (good animation etc).
  • Hidamari Sketch x365 is not really good, but I can't stop watching because Yunocchi is so damn cute :3
  • I can't believe I just said :3 especially with this beard.
  • Naruto Shippuuden has been awesome!
  • The OST of Casshern Sins has a few very good tracks: Roamer, RINGO, Life of Flowers, and Battle mode II. Also, a dog named Friender... epic!
  • Some people want multiplayer in Thief 4!!!!!!11!!1!ONE!

Curvy Progress - Layers

,

I'm making very slow progress working on Curvy "after having finished Dead Space". Looks like I either underestimated the amount of work and design required, or I overestimated my work abilities, or both. Anyway, since no drawing program is even usable without layers, I thought I'd work on them relatively early. The layers window is a customization of a custom tree-view control which I had created for use in the Angel3D Editor's Scene Explorer, although layers in Curvy will not be arranged in a tree but in a regular list instead.

Next to the "Add Layer" and "Remove Layer" toolbar buttons on the layers window, there will also be a "Move Up" and a "Move Down" button to allow the user to rearrange layers (drag and drop is not yet supported in the custom tree view control, and although implementing it should be rather easy, I'll not do that simply because I'm bored with GUI programming after all the work I put in the Win32 Property Grid control).

The Eye icon next to each layer is, not surprisingly, a layer visibility toggle button. The button next to it shows up a window which allows the user to set the properties of the selected layer: its name, transparency, color override options, and curve drawing mode options (wireframe, dots, regular... etc). However I'm still faced with a lot of UI design issues which I wish I had external help with. Like I said earlier, I can't help but think about such issues from the coding perspective and not the user perspective. Should each curve have a color and allow the user to specify a color override on certain layers? Or should a layer have a color and allow the user to override the color of certain curves? Should the layer properties window be integrated inside the layers window, or should it pop up separately when the user presses the layer options button next to the eye button? Ughhh...

Well, anyway, on to working on undoable commands and the undo queue. This will require rewriting a lot of things... FUN!

In an unrelated note, yesterday was the last day of the sixty consecutive days that I had to fast because of the car accident.

Mystery of Invisible Toolbar Separators Solved!

,


The separators that I added to the toolbars in Curvy were not being displayed, but space was being properly reserved for them. After too much investigation and trial and error, I discovered the culprit. Apparently the TBSTYLE_FLAT needs to be set for separators to show. Of course, the reason I didn't discover this right away is because of the following in the "Toolbar Control and Button Styles
" MSDN docs:


TBSTYLE_FLAT
Version 4.70. Creates a flat toolbar. In a flat toolbar, both the toolbar and the buttons are transparent and hot-tracking is enabled. Button text appears under button bitmaps. [...]

TBSTYLE_LIST
Version 4.70. Creates a flat toolbar with button text to the right of the bitmap. Otherwise, this style is identical to TBSTYLE_FLAT. [...]



No it's not identical! I had to set both styles to get the desired appearance. Oh well, on to spending efforts on more significant stuff.

More Traffic Accident Repercussions

It's been about six months since the fated traffic accident I made which resulted in the death of a 16 year-old boy and the severe injury of another. Just when the injured boy was getting better and better, today we found that he had broken his leg again! I don't know how... he probably overestimated the recovery he had made and now it's broken all over again... completely broken. He underwent another operation to put the bones back together with screws, and his complete recovery is questionable. I'm completely helpless. I can't help but keep wondering what it is that I lived through the accident for.

SpinBox, Last Visit

,

With the little time I managed to salvage from playing Dead Space, I paid a final visit to the new "SpinBox" control (for the time being at least). Now it properly draws separators between its three parts (increment, decrement, and drag) and handles hot tracking. Notes:

  • Currently the increment/decrement parts don't work, so they will be hidden in Curvy and Angel3D until they are needed.
  • It draws the arrows on the button by using the "Wingdings 3" font, which, hopefully, comes with Windows (if it doesn't the control will display random characters I guess). This is better than adding a cumbersome dependency on some bitmap.
  • Adjusting the text drawing code to properly position the arrows where they should be required considerable tweaking (lots of bullshit code). DrawText() with proper text alignment flags didn't do the trick because, apparently, each glyph in the font comes with some spacing on some side of the glyph, which Windows seems to consider to be part of the glyph too when calculating the glyph size.
  • The control can be either horizontal or vertical. This only affects dragging; in a vertical spinbox, the drag arrow will be pointing up and down, and the user will have to move the mouse up and down to change the corresponding value. This doesn't affect the alignment of the spinbox parts, which is determined based on the size of the control. If the control is wide, the parts are placed next to each other. If it's long, they are stacked on top of each other. The image above shows this.
  • I really should learn to not talk too much, though I wouldn't blame myself since I haven't really spoken to another human being in months.


Also, unrelated, the video tutorials for the Unreal Development Kit are awesome! BSP brushes suck! Edo Animal Massacre development will begin some time this month and will last no more than 2 weeks to reach a showable playable version (more on that later). Sword of the Stranger is cool... it's enough that Nanashi sounds like Ginko from Mushishi. Consider buying it :zip: .

Property Grid Control... Again

, ,

So I finished the awesome property grid control and I proceeded to use it within Curvy (more on Curvy later). But after a while I was reminded of why I originally hated this particular control - it's ugly! The contents of a property grid control can never look as good as a well-designed dialog box. But the undeniable fact is that, programmatically, the property grid control is A LOT easier to use and also quicker to set up than a half decent dialog box, even when using easy and intuitive tools such as the awesome ResEdit. Creating custom dialog boxes for each and every thing quickly gets tedious and time and space consuming as an application grows. Consider the Unreal Editor for example, it simply has to use a property grid control.

Anyway, I was faced with the issue of placing controls to allow the user to control the thickness of the curves created using the draw tool. So I placed an edit box control to allow the user to type the thickness in. But you really can't expect someone drawing curves to stop and type some value just to change the thickness of the curve. So I replaced it with a slider control. Ok, faster, but more restrictive - the thickness will be restricted to increments of 1, which is stupid. Also, have you ever found yourself trying to set the brush size in Photoshop to 2 and got frustrated because it keeps jumping between 1 and 3? You have to move the cursor just one pixel to the right... son of a bitch!

So, I created an edit box with a slider as a child control underneath it like so:

Of course, this solves almost nothing - it just allows the user to pick the less inconvenient way to alter the curve thickness. So I thought: mapping the slider to the curve thickness should not be done linearly. Instead, we'll use a curve to do the mapping. So I ended up with these two functions:
const FLOAT sliderCurvature = 1.5f;
const INT sliderMax = 100;
FLOAT SliderToThickness( INT nSlider ) { return powf( (FLOAT)nSlider, sliderCurvature ) / (FLOAT)sliderMax; }
INT ThicknessToSlider( FLOAT thickness ) { return (INT)(powf( thickness * sliderMax, 1.f / sliderCurvature )); }

Now the user has finer control over the curve thickness on the left side of the slider, where the curve thickness is small. But still that wasn't good enough - it just assumes the user wants better control in that particular thickness span, which isn't necessarily true. So I decided to complement this with a "resizer" thingy whose concept is "inspired" from the brush resizer in Autodesk Sketchbook Pro. Basically it's a small window that the user clicks in and then drags left and right or up and down to resize the brush.


It's nice and cool, and it's the fastest way to resize the brush, or in our case, modify the curve thickness. But it presented the same problem as the slider - you don't get the fine control that is needed when working with thin curves. The answer to that was to modify the thickness based on the zoom of the view. Typically while working with thin curves (especially less than 1 pixel of thickness), the user will zoom in to see them better. So we just multiply the drag delta by the inverse of the zoom and we get fine control.

That worked very well. It works with thin and thick curves equally well. And I thought maybe I'll do the same thing with the slider control. But then I realized it wouldn't work, because the slider control is designed to allow the user to specify a value within a range, and having a range here doesn't make sense, and to make this practical the slider will have to be stupidly very long. Also, the brush resizer window's visibility should not be imposed on the user, so if a user hides it, he ends up with a crappy alternative. So I decided to replace the slider with a different control. Enter the new spin box control!

The spinbox control is similar to the Windows' "up-down" control, or spin control. The up-down control allows the user to either click the up or down arrows to increment/decrement a value (typically displayed in an edit box), or to click and hold either of those buttons for timed increments. For an example, in XP, go to Display Settings > Screen Saver, and see the "Wait:" setting. It works well for those kinds of things, but it's not very practical for finer control. The spinbox control differs in that it has three parts, two increment/decrement (up and down or left and right, depending on whether the control is horizontal or vertical), and a central drag part. The user clicks on the central part and drags to change the value. Awesomeness if I may say so myself.

Then I started wondering how they solved this in the Unreal Editor. I then found out that they used something similar to the combination I made earlier of the edit box and the slider, except they are integrated into one new hybrid control. But it had two problems - I only found out I could do dragging after seeing it done in the video tutorials, so it's not really intuitive, and the second issue is that dragging the "slider" filled up the undo buffer! Every step added an entry in the undo queue. Ha, amateurs :rolleyes:

Here is how it looks like now. The spinbox control still is incomplete - it needs to draw separators between its 3 parts.


If it's one thing I learned, it's that the requirements of a program should not be set by the programmer himself - he will either end up skipping important things, or spending too much time tweaking and inventing stuff to his liking. Where is Chris when you need him :furious: ? Anyway, I think it would be better to update more often with shorter posts... yeah, that would be more appropriate and useful.

Pure Win32 PropertyGrid control

, , ,


While working on the Angel3D editor, I decided that using a property grid editor would be the easiest and fastest way to go to allow the user to edit object properties, application preferences, tool options... etc. Otherwise I'd have to use many dialog templates, and making those look professional and arrange controls on them in an intuitive way is nothing short of art. But I didn't want to use any .NET-based controls because of all the implications, including the dependency on the .NET runtime and the performance disadvantage of using anything .NET, specifically on load times.

So, I created my own pure win32 property grid control, which took too much work and ended up taking too long to complete to a usable degree, and now that I think about it, I should have just wrapped the .NET control somehow in a dll and used that. I even had to make major modifications to the code twice for it to turn out the way it did. Well it's very useful and neat if I may say so myself, and the editor still loads in less than a second. To hell with .NET, win32 rules!

The control supports multiple item selection, keyboard navigation, and a slew of item types, including edit boxes, sliders, buttons, check boxes, radio buttons, file browsers (edit box + browse button)... color boxes, labels, and of course category items. I'll be making this available for public use some time later. Now back to working on Curvy, which will also make heavy use of my super cool lightweight awesome OMG pure win32 property grid control. Full post about Curvy with screenshots and maybe even a working demo soon.

Trial Postponed

So the trial got postponed till December 29th. Yay for temporary freedom. Things are looking pretty gloomy though. I can't say I'm looking forward to spending two to three years in prison. This wasn't supposed to happen. I'm a hikikomori, damn it... what's the point if I'm going to get into this kind of trouble anyway? I guess that's fate for you. What a horrible concept.

Free stuffs, and prison

, ,


Pic unrelated. Kunio-kun from the Nekketsu something NES game series.
First, the good stuff. Two game engines have become free for noncommercial use. The first is Unity, which seems neat and people have been saying nothing but good things about it. The second is the industry giant Unreal Engine 3! The Unreal Development Kit (UDK) is a version of the engine which Epic is making free for noncommercial use. But one will have to use UnrealScript to do things with the UDK, so no C++, which will likely prove to be a serious limitation.

The 3rd free thing is increased internet connection speed! Suddenly I got disconnected for no apparent reason, then I reconnected and the speed was mysteriously doubled! I don't know why, but who cares. Unfortunately, I may not be able to stick around to enjoy it. Which brings me to the "prison" part of the title.

Following the tragic car accidentI made some time ago, I now have a trial coming up this Sunday. I was supposed to be in prison now, but the kind cops said that given my less than optimal physical condition and the fact that I'm not really a menace on society, they'll leave me be until Sunday. I don't know what's going to happen then. It is as likely for me to get incarcerated as it is for the trial to get postponed for a few months and me returning home until then.

So in these remaining two days, I'll watch all the movies and anime I have that I didn't watch. I'll also try to haste through the work remaining to finish Curvy to a usable and releasable degree. Curvy is a small tool I'm creating for creating line art in an easy and intuitive way. More on that tomorrow, hopefully.
January 2010
M T W T F S S
December 2009February 2010
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31