i don't know how to connect everything together
how to insert them with opengl in the code
what exactly is a game engine
MyEmail {l Wrote}:1. Learn C inside and out, repeat the process for C++, and repeat for every other language you encounter. Each time it gets easier and easier. The more languages you know the more marketable you are.
MyEmail {l Wrote}:In a interview someone may ask you something like: "In C, how would I swap the first 4bits and last 4bits of a unsigned char variable?"
charlie {l Wrote}:You're better off with Java or C#/.NET or HTML/JS or Python or Lua. Something higher level where you get up and running a lot more quickly and are worried about implementing your game logic and not surviving the madness of pointers, address allocation, and the many other complexities that come with the C/C++ territory.
Take inspiration from indie games. The likes of Minecraft and Revenge of the Titans are not done in C/C++ because it would take too long.
As computing power continues to increase, the need for runtime efficiency (the primary benefit of C/C++) declines. At some point it will become irrelevant - and in many ways it already is. Only the bleeding edge high-end graphical games - those at the forefront of the industry - require the power of C/C++ and even that has been reduced to mostly engine routines with the advent, and lately ubiquity, of scripting in games.
MyEmail {l Wrote}:In a interview someone may ask you something like: "In C, how would I swap the first 4bits and last 4bits of a unsigned char variable?"
That sums up C/C++ nicely for me. Pointless.
mdwh {l Wrote}:charlie {l Wrote}:MyEmail {l Wrote}:In a interview someone may ask you something like: "In C, how would I swap the first 4bits and last 4bits of a unsigned char variable?"
That sums up C/C++ nicely for me. Pointless.
I don't follow your logic. Just because it's possible to do something that you think is pointless, doesn't make the language pointless. This is a criticism of the interview question, not the language.
Surely you can do bitwise operations in Java too? Is Java therefore pointless?
mdwh {l Wrote}:MyEmail {l Wrote}:In a interview someone may ask you something like: "In C, how would I swap the first 4bits and last 4bits of a unsigned char variable?"
That sums up C/C++ nicely for me. Pointless.
I don't follow your logic. Just because it's possible to do something that you think is pointless, doesn't make the language pointless. This is a criticism of the interview question, not the language.
Surely you can do bitwise operations in Java too? Is Java therefore pointless?
MyEmail {l Wrote}:What I do know is that I mastered 8 languages in a little over 3 years.
MyEmail {l Wrote}:Not to attribute anything to myself, but perhaps learning so many languages is a challenge for other people.
Zlodo {l Wrote}:MyEmail {l Wrote}:What I do know is that I mastered 8 languages in a little over 3 years.
Beware of the dunning kruger effect, it can impede your ability to learn quite a bit.
http://youarenotsosmart.com/2010/05/11/ ... er-effect/
farcodev {l Wrote}:Learn the logic and be yourself structured is more important and harder than learn 8 languages IMHO
MyEmail {l Wrote}:I was speaking from experience, so in essence I have "gone to the chess tournament and won 1st place".
MyEmail {l Wrote}:That's where you missed the point. Learning more languages gives you all that and more. I still wish C++ macro's weren't so gosh darn limited, and had more Scheme-like functionality. Oh snap, I can implement a pre-compile perl hook to add that functionality for me! Now I have the power and simplicity of C with the absurd power of Scheme-like macros. :O Its dumb things like that that people who don't know multiple languages can never do. They are stuck with limited functionality in the C-macros while I dance around them with a vast set of macro tools.
Zlodo {l Wrote}:You were judging you were an expert from your own clearly limited experience. 3 years is not enough to become an expert at any language and therefore to be able to judge yourself whether you are an expert, much less 8 languages.
Zlodo {l Wrote}:Or perhaps they prefer to avoid doing this kind of things because it frankly sound like an awful idea.
Zlodo {l Wrote}:It doesn't solve the biggest problems with the standard C preprocessor
Zlodo {l Wrote}:but it's a source of headache that shouldn't be done lightly.
// The extra functionality I have added allows the macros to literally write code in a Scheme-like fashion:
// __PREPROCESSOR_OUTPUT__ is the output this macro produces that is substituted wherever this macro goes (if no reference to this is made the output of a macro behaves like a normal C-macro)
// ##= is a operation like += instead performing the ## equivalent
// #foreach will loop through each preprocessor variable and store it in the requested ident
// #for works like a C for loop
// #local_define defines a variable locally inside the macro (and sub-macros called within that macro). It does not leave the scope of the parent macro.
// #typeof is replaced by the type of of its argument (if it is already a type it returns the type)
// NOTE: this is only the tip of the iceberg :D
// used to create unique identifiers for constructors, much the way C++ works under the hood.
#define OBJECT_CONSTRUCTOR_IDENT(objectType, ...) \
__PREPROCESSOR_OUTPUT__ = objectType ## _constructor_;
#foreach(__VA_ARGS__, arg) __PREPROCESSOR_OUTPUT__ ##= #typeof(arg) ## _;
// creates the unique identifier of a constructor for automaticaly calling while hidding in standard C syntax
// the object is passed via the first variable called object
#define defineConstructor(objectType, ...) OBJECT_CONSTRUCTOR_IDENT(objectType, __VA_ARGS__)(objectType * object, __VA_ARGS__)
// allocates a object by a perticular constructor (note: this version unrolls the loop--using sparingly and beware big executables!)
#define allocObject(objectType, count, ...) \
objectType * objects = calloc(number, sizeof(objectType)); \
#for(0, count, i) { \
OBJECT_CONSTRUCTOR_IDENT(objectType, __VA_ARGS__)(&objects[i], ...); \
} \
__PREPROCESSOR_OUTPUT__ = objects;
// a wrapper to allocObject() to mimic C++
#define new(objectType, count, ...) allocObject(objectType, count, ...)
typedef struct someStruct_t {
s32 someValue;
} someStruct;
void defineConstructor(someStruct, s32 someValue) {
object->someValue = someValue;
}
s32 main(s32 argc, c8 ** argv) {
// allocates 10 someStruct's, passing the value 5 to the appropriate constructor
someStruct * test = new(someStruct, 10, 5);
printf("%d\n", test[4].someValue);
return 0;
}
// Original code
typedef struct someStruct_t {
s32 someValue;
} someStruct;
/*
Expanded macro 'defineConstructor' called on line 46 in 'main.c'.
Original:
defineConstructor(someStruct, s32 someValue)
Output:
OBJECT_CONSTRUCTOR_IDENT(someStruct, s32 someValue)(someStruct * object, s32 someValue)
Expanded macro 'OBJECT_CONSTRUCTOR_IDENT' called on line 1 of macro 'defineConstructor' in 'main.c'.
Original:
OBJECT_CONSTRUCTOR_IDENT(someStruct, s32 someValue)(someStruct * object, s32 someValue)
Output:
someStruct_constructor_s32(someStruct * object, s32 someValue)
*/
void someStruct_constructor_s32(someStruct * object, s32 someValue) {
object->someValue = someValue;
}
s32 main(s32 argc, c8 ** argv) {
/*
Expanded macro 'new' called on line 52 in 'main.c'.
Original:
new(someStruct, 10, 5);
Output:
allocObject(someStruct, 10, 5)
Expanded macro 'allocObject' called on line 1 of macro 'new' in 'main.c'.
Original:
allocObject(someStruct, 10, 5);
Output:
someStruct * objects = calloc(10, sizeof(someStruct));
#for(0, 10, i) {
OBJECT_CONSTRUCTOR_IDENT(someStruct, __VA_ARGS__)(&objects[i], __VA_ARGS__);
}
__PREPROCESSOR_OUTPUT__ = objects;
Expanded macro 'OBJECT_CONSTRUCTOR_IDENT' called on line 3 of macro 'allocObject' in 'main.c'.
Original:
OBJECT_CONSTRUCTOR_IDENT(someStruct, 5)(&objects[i], __VA_ARGS__);
Output:
someStruct_constructor_s32(&objects[i], __VA_ARGS__);
*/
someStruct * test = NULL;
{
someStruct * objects = calloc(10, sizeof(someStruct));
someStruct_constructor_s32(&objects[0], 5);
someStruct_constructor_s32(&objects[1], 5);
someStruct_constructor_s32(&objects[2], 5);
someStruct_constructor_s32(&objects[3], 5);
someStruct_constructor_s32(&objects[4], 5);
someStruct_constructor_s32(&objects[5], 5);
someStruct_constructor_s32(&objects[6], 5);
someStruct_constructor_s32(&objects[7], 5);
someStruct_constructor_s32(&objects[8], 5);
someStruct_constructor_s32(&objects[9], 5);
test = objects;
}
// Original code
printf("%d\n", test[4].someValue);
return 0;
}
Users browsing this forum: Bing [Bot] and 1 guest