CSDGN Tale of the Lazy Programmer.

1Aug/100

Things I miss in Java and C++

What I miss from C++
There are a handful of things I honestly miss in Java. Mostly because I am a bit twiddler.

For example, this fun bit of C++. The only way to do this in java is big and messy and slow, for multiple reasons. Java lacks anything that allows the simple automatic memory sharing behavior this shows, you have to convert between types. This is mostly because of Java’ type safety. I sigh and say, “OKAY, fine, that just how you are, you are very type safe, this is the result.” However, there is something else, which Java doesn’t have an excuse to not have! Unsigned types, honestly. How hard is it to add unsigned types, unsigned types are useful, for far more reasons than something like this. Almost every network protocol in the whole of existence uses unsigned data. Usually data in most binary data formats are unsigned. I guess they didn’t expect people writing in this to access the filesystem, use a network. I guess that is possible. Maybe they didn’t think anyone who used Java would ever want to have unsigned data (wrong, as you can see by my case).

"The omission of unsigned integral types from Java is somewhat controversial, but they are in fact inessential, if perhaps convenient nonetheless."

Convenient, definitely, inessential, somewhat so, Unwanted, definitely not.

//C++
struct {
	union {
		union {
			uint16_t r16_1;
			struct {
				uint8_t r8_1;
				uint8_t r8_2;
			};
		};
		union {
			uint16_t r16_2;
			struct {
				uint8_t r8_3;
				uint8_t r8_4;
			};
		};
		uint32_t r32_1;
	};
} registers;

For you who are not in the know, when it comes to C++, union basically allows you to share memory between two variables. This is useful for many things, but the above is what I use it for the most. What it does in this case, because they are anonymous unions and structs, allows me to share memory between the 8′s the 16′s and the 32, so changing one would change the ones that are built on top of it, or under it. Changing r8_1 would change r16_1 and r32_1, but changing r16_1 could only change r32_1 and r8_1/r8_2. Which allows me to do fancy stuff.

registers.r8_1 = 0xF;
registers.r8_2 = 0x1F;
printf("%04X", registers.r16_1);

Would produce “1F0F”. This is pretty straight forward in this case but this next one is less so.

registers.r8_2 = 3 << 2;
registers.r16_1 = registers.r16_1 >> 3;
registers.r8_1 = registers.r8_2 << 1;
printf("%04X", registers.r16_1);

What does this produce? Can you even begin to guess? I can but I have been doing this a long time. It produces “0102″, or 0×0102. We put 0x0C into r8_2 which makes it 0x0C00, rightshift 3, puts one bit over the byte border, so now r8_2 is only 0×1, and r8_1 is 0×80. But we take that 1 in r8_2 and left shift it 1 and assign that to our r8_1, which becomes 2.

Another thing I miss from C++ is the numerated enumerations.

enum {
	a, b, c, d, e, f
}

This is another victim of the strong typing however, since while these map to integers in C++, a=0, b=1. In java they are unmappable. (Does casting work?)

What I miss from Java.
Its somewhat more simplistic syntax and class system. Unfortunately, that wouldn’t work in C++, since there are hard defined uses for headers and source files. Without headers, libraries would be impossible (that is to say, hooking would be impossible, since headers provide the map required to access the compiled code). Without source files, compiling wouldn’t happen. (That is to say, source files are more required than header files).

Aside from that, the thing I probably miss the most from Java would have to be some of syntax sugar.

23Jun/100

Programming This and That

I seem to do much chatting about things other than programming. Mostly because I usually find programming so routine there is no real point for me to talk about it.

Lately I have written and tested a simple Regex engine (works well, but lacks many advanced features). A Math expression parser (works well), a cross platfrom irc bot framework (no advanced features), a 3D OpenGL Java based programming game (incomplete), written a kD-Tree implementation (works), mucked about with image formats. Awhile ago I even tried my hand at a Gameboy interpreting emulator (never finished).

I have been considering if I should try making a game of some sort. I am not really lacking in skill in programming, however most current generation gamers want not only gameplay, but graphics. That is where I hit a speed bump. I can ignore those for the most part (you know since it is just for fun, if I like). I have even caught myself practicing what I would say if I had to sell my programming skills to a game developer.

Sorta like so. “It all depends on the scope of your project. If you want a massive 3D system, with character models with an adaptive IK animation system and complex physics system, well I probably can’t do that.. Well actually I probably could, but I would be really annoyed, that is to say, I wouldn’t want to do it. Since that is a difficulty well beyond a single developer.”

Did I mention such a system would be a pain to write? Well it would be. Since I would have to look up how many things worked, and perhaps even new api for the animations and graphic system (directx/opengl scene graphing) and integrate a physics library.

12Apr/100

Netbook of Feats

Some may of noticed (assuming I have any readers), that I have a database searchable version of the netbook of feats up. I went out of my way considerably to parse it and its balance scoring. There are many values that can be sorted by I do not have UI for. So expect me to add UI for these in the future.

Each part of the balance is split up differently. All sorted in an purely numeric InnoDB table. The full text searches only the name, short description, categories, and copyright name (MyIsam). Please be nice to it.

It is missing a few of the feats that had html in its description. I will add those manually at some point.

Filed under: News No Comments
1Apr/100

EVE Online

Here I am going to speak a little more about games again. Eve Online, I tried it awhile ago, and it wasn’t the most terrible game in existence, however I dislike for one very simple reason. Their learning systems depends wholly on how long you have been paying them. Thats right, you don’t work hard, or grind monsters, or mine, or whatever else to learn skills, you character learns them at a set pace, which basically equates to for them, longer and more money you give us, the more skilled your character is. Honestly that is a bit annoying to me. I mean sure I can see learning time, or limiting how much you can learn in a given period, and while there are ways to optimize skill learning to a degree. I don’t want to wait around for a year to start having fun.

Oh yes that is another thing, permanent death is really possible, I mean there is a clone system and such, but dieing is really quite possible. Losing those years of hard work.

Truly anal people like me, who in a game of hard work, work our asses to hell and back. Like in Pokemon I usually out level the next gym leader since I trained my Pokemon to ex nauseam. People like me who could find some training engaging instead do not, as you generally log off and do nothing. So you are paying for a game that you do nothing in, and takes you almost a year to get to start to do anything really interesting (that is to say, being able to afford to be part of massive space battles). what. the. fuck.

Tagged as: , , No Comments
28Mar/100

Manga

I have read a lot of Manga recently, so much in fact I needed a calculator to figure out just how much Manga I had actually read. This has actually been going on for a few months now. But in total I have read nearly a 200,000 pages worth of manga. I could get into details, but the sheer magnitude of the number is a bit much.

In the more I have included the short list version, the long list is… long.