Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Jul 2011
Offline Last Active Today, 07:25 AM

#5131020 From C to ?

Posted by on 13 February 2014 - 06:23 AM

I'd probably go C# right now. Java left me a bitter taste and not in the good way.


If you want an even more bitter taste, try using C# with Windows Metro... They cut out loads of classes for their core profile and does tend to cause quite a few headaches.


Whilst C++ is a perfectly robust language, the only one I have known not to evolve in any radical way (for many years) is C.


... Oh wait, you say that there is now <stdbool.h>? C99 is Madness!

#5130636 Examples of "SDL Game Development" in ANSI C?

Posted by on 11 February 2014 - 04:09 PM

For some of your tasks, perhaps something like this could help:

struct Texture
  SDL_Surface* surface;

struct Sprite
  struct Texture texture; // *Not* a pointer to the struct
  int frames;
  int x;
  int y;

What is quite cool about this is that a Sprite can now be passed into a Texture function (in C, I don't even think you would need to cast it). i.e

struct Texture* tex = texture_create("someimage.png");
struct Sprite* sprite = sprite_create("someimage.png");

This technique is used in large C libraries like Gtk+. It also means if you do this form of "poor man's inheritance" on all your structures in the game, you could use a generic type of Object as the array type for example.

When using the popular component entity system (preferring composition over inheritance), I find using C is much more feasible for games development.

#5127995 old interpreter cint

Posted by on 01 February 2014 - 12:38 PM

I use CINT on UNIX for our build scripts where it "just works". I have never tried it on Windows. You will generally need binaries of a library in order to use them and you will often need to write your own binding layer since although CINT is C/C++ it is not running natively so you will need to bind it to native libraries (as is also required when using Python, .NET, JS and others) since there is no linking stage.


Fyi, CINT is a bit obsolete these days, it has been replaced by cling (http://root.cern.ch/drupal/content/cling). This is much more modern and uses clang / LLVM as a backend. Using C/C++ as an interpreter is still very much alive at CERN smile.png


You might also be interested in Pico C (http://code.google.com/p/picoc/). It is really light in comparison to CINT but you will still need to implement bindings to "non-core" libraries yourself.



There are also more heavy languages which you can embed like JS and Python.

The mentioned "Mono" is much heavier than JS and Python and unless you only ever use bindings that someone else has written, you will still need to be able to build native libraries and write the managed/scripted wrapper yourself anyway. I find developers always seem to forget this fact when using .NET, Java etc...

#5127795 Engine with C++ scripting?

Posted by on 31 January 2014 - 12:56 PM

For C++ interpreters, there is CERN's CINT project (http://root.cern.ch/drupal/content/cint) which supports scripting in both C and C++.

I really like it and use if for our expansive build system at work but I personally would not use it for creating games.


There is also Pico C (http://code.google.com/p/picoc) which looks much more usable for game scripting (though you would need to hook it up to the chosen engine manually). It is C only (no C++) but with the popularity of the component entity system these days, OOP is not really critical IMO.


If I were, you, I would do without the scripting part and look into something like Irrlicht. This is simply a 3D engine with a C++ API. Yes, a lot of people seem to not like it but frankly, the license, the ease of use and the portability of it is great for beginners.

The GoldSource engine was quite cool for mod development before Steam/DRM came along but you will need pretty decent knowledge of C/C++ before you will be productive using it. It doesn't spoon feed you unlike products like Unity or even in some respects like Irrlicht (less tutorials, documentation etc...).

#5123939 Classes and use of 'New'

Posted by on 15 January 2014 - 01:07 PM

  std::vector<std::shared_ptr<Car> > cars;

Looks ugly as sin* but provides fantastic functionality.


1) Deterministic destruction

2) No leaks

3) Exception safety

4) The pointer is guaranteed to remain the same even if the std::vector is resized. (i.e cars.at(7).get())


* Actually, the C# IDisposable pattern is much uglier when trying to get deterministic cleanup or resources.

#5119469 Have you made a game engine

Posted by on 27 December 2013 - 06:29 AM

Sony likely decided to use FreeBSD as the basis of the internal OS on the PS4 purely due to the permissive BSD 2-Clause license rather than any technical superiority that the OS has over Linux.

I think any version of the GPL license makes game studios itchy ;)

Then again, talking about licenses at this stage of engine development is perhaps not very productive. Get the engine built first and you can always swap out the parts using unworkable licenses.

#5119286 Have you made a game engine

Posted by on 26 December 2013 - 06:49 AM

At work we have been making a C++ 3D engine which favours portability above all else. The technology used varies per platform (The only common part is OpenGL).


Some of the tech used for desktop platforms is Xlib/glx, libpng, openal, libogg/libvorbis.

The consumer platforms (Android / iOS) use the underlying platform's stuff but wrapped with C APIs similar to the desktop counterparts to minimize #ifdefs and other changes to the core games.


All the model loading, animation and physics is bespoke and written in C (with C++ wrappers) so is perfectly portable to everything.


To get it up to a usable state ready for games it took two of us a couple of months. It is unlikely to be as advanced as Hodgman's but as an "indie" studio, we currently need to battle with tablet / phone support and all the gimmicky short lived technology that it brings.

#5118382 SDL or Unity?

Posted by on 20 December 2013 - 10:26 AM

SDL and Unity are quite different things. SDL is usually more of a core library rather than a complete game making product.

I wouldn't be suprised if the Linux version of the Unity player uses SDL as a static library. (The HTML5/WebGl / Emscripten version will)


For 2D development, you do not need a complete game engine so unless you are a beginner, I highly recommend SDL (_mixer and _image) since it provides image loading, audio etc...


If you are a beginner with an interest in programming, I still recommend learning SDL since you will learn more (i.e event based programming) and it will look better on your CV. It will also allow you to step up nicely to OpenGL if you go that direction.


I know Unity has recently made a push to hoover up the 2D indie game development market but it still doesn't provide much. 2D animation is simple using tools like Spine (http://esotericsoftware.com/) (or you can write your own in a couple of days).

2D collision is also very straight forward so Unity doesnt really provide much more there either.


Tbh, I recommend anything other than Unity for 2D games but you might want to see what others on these forums suggest. ;)

#5118335 Shaders (GLSL) in one file? Is it practical?

Posted by on 20 December 2013 - 04:56 AM

As Kaptein suggested, as you load the file into your program, you just prepend the correct ifdef before the shader source code before sending it to OpenGL.

Another way of doing this could be as follows.

char *sources[2] = { "#version 330\n#define VERTEX_PROGRAM\n", sourceFromFile };
glShaderSourceARB(shader, 2, sources, NULL);

This basically send the define to OpenGL just before the rest of the shader source.

#5117820 glTexBuffer and Texbuffer Objects samples

Posted by on 18 December 2013 - 06:35 AM

glTexBuffer is part of the OpenGL 3.1+ standard.

glTexBufferARB is part of OpenGL as an ARB  (Architecture Review Board) extension.

glTexBufferEXT is part of OpenGL as a vendor (NVIDIA, ATI etc...) extension (i.e if found you download gl2.h from NVIDIA's website).


So basically, if you use an old version of OpenGL you need to use the ARB or EXT versions.


However, if you use something like libglew, it will match the correct function (pointer) to glTexBuffer so you don't need to worry about what is providing the actual functionality, you just use "normal" OpenGL.


For sample implementations, you might want to look at open-source software implementations of OpenGL (such as mesa http://cgit.freedesktop.org/mesa/mesa/tree/src).

#5117556 Can you help me plot out a long-term plan?

Posted by on 17 December 2013 - 07:01 AM

I guess what I want to do is limit the amount of outside input necessary to build a functioning game. I want to grow as a programmer so that I don't have to rely exclusively on others in that area to create games. Plus, programming is just fun.


If you can get away from relying on products like Unity and sticking with core technology then it will certainly help you keep up as technology evolves (which is why we don't teach Unity at University).


If you enjoy programming and can do this, then you are in a very good position. Personally I would go with OpenGL since it is immediately portable but at the end of the day, the two APIs are very similar so porting between them is much easier than people make out.

#5115935 What should I start with ?

Posted by on 10 December 2013 - 10:43 AM

and udk and torque 3d are the only viable options because ce3 works only with internet [...] and an internet based engine is unpredictable.

have +1 rep on me for realizing that CryEngine is ridiculous for the online requirement smile.png. I am not sure why CryTek is wasting indie developers time with this crap quite frankly.

As for you other options, you do have more than UDK and Torque 3D. A 3D table tennis game should not be too tricky in Irrlicht, Unity or DarkGDK.

OpenGL and Ogre3D might be a bit too "hands-on" when starting out but with enough 3rd party libraries, there is no reason why they should be much more work.

MonoGame is kind of an intermediate between low level OpenGL and a high level game engine like Unity. However it has loads of sample projects that you can grab the code from effectively making it almost as full featured as a game engine.

ThreeJS is also becoming very popular if you can stomach Javascript.

My personal suggestion is start with a 2D game in OpenGL and C++. Keep with these technologies and keep building up your own codebase until you are at a level to make a 3D pong game. That way your experience grows with your codebase. Then at the end of it you can make a game in C++ and OpenGL that really does work on all platforms with suprisingly little modifications.

#5115870 Which game engine to make Zelda-Style 2D game?

Posted by on 10 December 2013 - 05:26 AM

Since one of my first projects was a Zelda like engine, I can try to add a few more bits of info, you might find useful.

1) You don't need any rotations etc since it is all done with spritesheets. This means that you don't really need 3D acceleration which will keep things much simpler for you (and more portable between platforms).

2) Collision can be kept to simple rectangles (since there is no rotation, skewing etc...) so you don't really need a complex maths library.

3) When Link walks under signs or behind buildings you need to have layers but pixel art means that you can use a mask rather than full transparency.

So the following APIs (using various languages) should be ideal since you dont need a full game engine just yet.

C/C++ - SDL
C++ - wxWidgets
Java - javax.swing
C# - System.Windows.Forms
Javascript - HTML5 Canvas

Some tools that might be useful for your game:
http://londeroth.org/~fry/gonstruct <-- Simple level editor
http://graal.in <-- Graal Reborn - A developer site for Graal Online (including versions which include animation editors, level editors spritesheets etc...).

#5115700 Which game engine to make Zelda-Style 2D game?

Posted by on 09 December 2013 - 01:16 PM

For 3DS and Vita, I don't think Unity targets them. It is hard enough to get a Unity license for anything resembling a AAA gaming device, let alone a source license for unsupported platforms.

AFAIK C/C++ and OpenGL are the only technologies that definitely work on all 4 of your requested targets. Even then the OpenGL implementation for the PSP and 3DS is an abstraction layer over the native graphics systems.

If you can relax your requirements to just target iOS and Android, then you can use consumer tools like Unity and Gamemaker with no problems.

#5115653 Win32 programming, relevant in windows 8?

Posted by on 09 December 2013 - 08:32 AM

Personally, I would therefore definitively consider learning Win32. It is maybe not the prettiest, most straightforward quirk-free API in the World, and some things could definitively be better, but it will usually let you achieve what you want, and it really isn't that bad.

Yeah I know what you mean, whenever I try teaching students DirectX programming, they look terrified by the ugly Win32 function / variable naming when opening a simple window to render onto.

It seems a shame that Microsoft keeps getting distracted by things like .NET and Metro instead of creating a decent Win32 GUI wrapper.

Afterall, with OpenGL / Linux programming, I teach them using Qt which uses the equally ugly libXaw / libX11 underneath and they like it much more.


which after registering followed with "you have permission to develop for 30 days". That was an immediate dealbreaker.

I agree, I won't let anyone have that much power over myself or my company. Those arrogant fsckers. The failure of their platform suggests that we are not alone with our opinions ;)


Another annoying thing about Metro, Microsoft were in a position to really start a positive migration from Intel chips to ARM by providing a proper implementation of Windows and development tools. Instead they decided to lock it down so an ARM chip could only be used like an unpopular iPhone. ARM development really isnt any different to Intel (The C++ code can remain 100% the same in many cases), it is only these completely crippled operating systems that make it such a faff. So when people reject Surface RT because "it runs arm :(", that really annoys me. The real reason why they are not selling is because Microsoft is broken.