C/C++ and asm I've always been comfortable with. C mainly because you can do almost anything with it and asm for it's raw speed. I started programming about 30 years ago in assembler on the 8 bit machines, learnt C on the Atari ST with the new asm. I dropped out of programming for a while when I got my first PC because everything was so different and looked a tad too complex, but now I'm at the stage where its just like riding a bike again.
Most, actually almost all BASIC languages I really dislike because I like to have my vars declared. That and BASIC never seems to compare with C. I decided I didn't like BASIC when I ran my first machine code program on a ZX Spectrum.
There's still a lot about the new C++ that I'm picking up as I go along but still for that extra speed when required, standard ansi C can be faster. Especially when it comes to comparing speed when using standard arrays in C to using the STL libraries. STL is a great adaption to C++, string and vector libraries I use all the time.
For people who have programmed for years in BASIC, even standard ansi C can be very daunting and take a long time to learn as a lot of it isn't obvious until it starts to become second nature.
C can be written on any machine as its pretty much standard, but asm, I've done 6502, 6809, z80, 680x0 and now x86 (with mmx and sse).
Just don't throw another BASIC language my way. I can just barely manage with DBP. But saying that, DBP is a fast and solid language. (Well 99.5% solid)...
Regarding reference material for C theres a few posted here:
LINK to FORUM
EDIT: I forgot to include a reason why I like C/C++ and asm. Well, these days within a C compiler you can now directly include assembler in your code to free up those bottlenecks that occur. Visual Studio does a great job of that. Something like these:
double PerlinNoise::Noise(int x, int y) const
{
static double v1 = 0.931322574615478515625e-9;
double res;
int n;
__asm { // going to ignore the ^ power of bit
// n=x+y*57
mov eax,dword ptr [y]
imul eax,eax,39h
add eax,dword ptr [x]
mov ebx,eax // is n
// n=(n<<13)^n
shl eax,0Dh
xor eax,ebx
mov ebx,eax // is n again
// int t = (n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff;
imul eax,ebx
imul eax,eax,3D73h
add eax,0C0aeh
imul eax,ebx
add eax,5208DD0Dh
and eax,7FFFFFFFh
mov dword ptr [n],eax
// return 1.0 - double(t) * 0.931322574615478515625e-9;
fild dword ptr [n]
fmul qword ptr [v1]
fld1
fsubrp st(1),st
fstp qword ptr [res]
}
return res;
}
Which speeds up the noise function when creating textures and heightmaps on the fly...
int TREES::find_closest_opt() // BOTTLENECKING ROUTINE (Optimised slightly)
{
int a = count;
int curr_dist = 8000000;
int xd, yd, dist;
// optimise the bikes positions for local vars and using ints...
int bikex = (int)gg->bike.xpos;
int bikey = (int)gg->bike.ypos;
//vector<TREEXY>::iterator p = trees_xy.begin();
TREEXY *p = &trees_xy[0];
__asm {
mov ecx, [a] // use reg for main loop
mov edx, [p] // use reg for array pointer
while_loop:
mov eax, [bikex]
sub eax, [edx+4] // p.x
cmp eax, -4
jl next_loop
cmp eax, 4
jg next_loop
mov ebx, [bikey]
sub ebx, [edx+12] // p.z
cmp ebx, -4
jl next_loop
cmp ebx, 4
jg next_loop
imul eax, eax
imul ebx, ebx // cache pause here on second imul
add ebx, eax
cmp eax, [curr_dist]
jg next_loop
mov [curr_dist], eax
next_loop:
add edx, 16
dec ecx
jnz while_loop
}
// return the distance of the closest tree
return curr_dist;
}
Which frees up a major bottle neck in collision checking...
There, you cannot do that in BASIC!!!
Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!