Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 16 Mar 2011
Offline Last Active Aug 31 2015 03:13 PM

#5127478 How is CSG done?

Posted by on 30 January 2014 - 09:56 AM

This question is one of the reasons I am much happier with programming that doesn't involve anything low-level. Since this is way higher tier math for my understanding when it comes to implementation, and there is not much info on this floating around the internet, I decided to ask here.


Here is the link http://en.wikipedia.org/wiki/Constructive_solid_geometry


I would like to know how is this calculated, and how do people store this kind of data when they make an engine (first thing that comes to mind, when looking at level editors). I find this interesting since I would need to store entire geometric data (vertices, faces, normals) and uv's along with this when I get the end result of the csg operation.

#5056740 Are There Any Video Tutorials for Coding Level Editors?

Posted by on 25 April 2013 - 02:59 PM

I doubt that you can find such thing. Programming level editor can be seen as programming regular programs just, these have special functionality. You would start by creating window and the rest of the window related stuff (like buttons, tool bars, etc), and also rendering your level to specific part of the editor window or separate window to see what is happening as you create your levels. Once you know how to put stuff on screen, it will become simple matter of making program that can manipulate 3d objects and such to place them as you would wish, and do rest of level related stuff.

#5054314 Platformer game "events"

Posted by on 17 April 2013 - 03:25 PM

The way I would do it is to check for true/false value of players action so the thing would remain quite simple for example:


if (player == interact_pc)


   PhysicsUpdate = 0;

   EnitityUpdate = 0;

   ShowDialog(text, options);





if (player == ForbiddenAction)


   npc = hostile;




You can always make some sort of trigger object that executes a script or some other predefined action if the conditions are met.

#5030407 Motivation

Posted by on 09 February 2013 - 11:02 AM

Sometimes everyone have lack of motivation, and this is natural. The way I deal with motivation is that I try to remember why did I want to make a game in first place. If I am in the mood I try and find some 'Making  of ...' videos of my favorite games - this helps me great deal in boosting motivation. I also try to avoid more difficult parts of programming that I am not good at, until I can't do that anymore and do all necessary research on how to solve the given problem. You always can pick up a book, if possible one that is not dated yet and contains viable information and the code in it actually works. If this is not exactly an option you also always can search the web for pdf or other articles and materials on the subject you are interested in. Sometimes only revisiting something you are interested in, can boost your motivation on overcoming difficult parts of making a game, and possibly creating snowball effect.

#5030122 SDL + OpenGL V-Sync

Posted by on 08 February 2013 - 11:26 AM

When I tried your code with or without SDL_GL_SetSwapInterval(1); and check with fraps it rounds down to 39 frames (this is 40 - fraps sometimes calculates -1 for some reason). So your code works correctly and does perform v-sync.


 I finally was able to capture a frame without it.


If you can't see any screen tearing while testing or when recording video of your program than it is not an issue. If it is only one frame (in every 100 for example) it is most likely un-noticable by the naked eye.


Do you think this was just a bug in the software that I used to take the screenshot?


This is a possibility, too.

#5029939 SDL + OpenGL V-Sync

Posted by on 07 February 2013 - 08:32 PM

It must work, you are probably doing something wrong. For me it works 100%, with this function, I create window, context and setup everything I need to get started.


SDL_Window *MainWin;
SDL_GLContext MainContext;

int InitWindow(const char* title, int width, int height, bool vsync, int OGL_Major, 
	int OGL_Minor, int StencilSize, int DepthSize, int AA)
	// init SDL subsystems
	if(SDL_Init(SDL_INIT_VIDEO) == -1)
        return 1;

	// setup OpenGL version

	// setup stencil buffer
	SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, StencilSize);

	// use double buffering

	// setup depth buffer
    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, DepthSize);

	// setup anti aliasing

	// create main window
	MainWin = SDL_CreateWindow(title, 

	MainContext = SDL_GL_CreateContext(MainWin); // attach OpenGL context to window

	// init GLEW
	if (glewInit() != GLEW_OK)
		fprintf(stderr, "Failed to initialize GLEW\n");
		return -1;

	SDL_GL_SetSwapInterval((int)vsync); // vsync

	return 0;



Note: I use GLEW to load OpenGL extensions, I am not sure if that also works for linux.

#5029580 SDL + OpenGL V-Sync

Posted by on 06 February 2013 - 06:11 PM

My understanding is that SDL 2.0 was supposed to be SDL 1.3, but they renamed it to 2.0 for some reason. Older versions used OpenGL to some extent and now SDL 2.0 is made to support newer OpenGL 3 and up context. So it is actually major change from the previous, but then again SDL 1.2 supported pc that are now very very old (single core cpu's and such). Is it less cross-platform? It isn't supposed to be.

#5029422 SDL + OpenGL V-Sync

Posted by on 06 February 2013 - 09:31 AM

 I get an undefined reference to SDL_GL_SetSwapInterval when I try calling that.


Sorry, forgot to mention this requires SDL 2 to work.

Undefined reference is indication that you are not linking correct libraries.


I see that you want to make this work on linux - aside from SDL 2 see this http://www.bitsphere.co.za/gameDev/openGL/vsync.php

#5029270 SDL + OpenGL V-Sync

Posted by on 05 February 2013 - 08:39 PM

The easiest way to do this is to add Sleep(17); in your main loop. This will cap your framerate to 60 and you will have kind of v-sync. For me also works SDL_GL_SetSwapInterval((int)vsync); this will cap your framerate to refresh rate of the screen and you will have v-sync.

#5029207 Fear of the many many different types of PC's

Posted by on 05 February 2013 - 04:37 PM

1. Think about which is the least capable pc configuration (for your target audience) that can run you game at playable speed

2. Check if your game has any issues with hardware (nvidia vs ati)

3. In case your game has multiplayer check if your the least capable machine is able to run this part at playable speed

4. You should check if your game works with other hardware combinations (if possible) to avoid any problems after release. (Red Alert 3 had may issues and it is AAA game)

5. If all from above have good result you are mostly good to release your game.


Testing is key here.

#5027567 Game programmer

Posted by on 31 January 2013 - 10:26 AM

I would not suggest to learn more than one programming language, well maybe knowing more than one won't hurt but you might find your self knowing more programming languages but not to be very proficient in any of them. Keep in mind game programmer as such makes games work on the core level - he programs what is essentially logic of the game. He does not bother with graphics or sound apis and similar stuff. But since you might want to make entire game your self, you should probably learn one graphics api of your choice (directx or opengl), when you understand everything from above list (or most of it). Make small progress from small game to another small game not necessarily larger in scope, just to learn better game programming. There are examples all over the internet search this forum to find out this question has been asked many many times in past.

#5021849 Religons in games

Posted by on 15 January 2013 - 11:23 AM

Religion in civ games was from the start or at least civ 2 if i am not mistaken. All it does is gives some sort of benefit to you civilization, so it is not exactly a religion, but on the other hand you can build tamples for that religion.

#5021825 Religons in games

Posted by on 15 January 2013 - 09:52 AM

So this is something like a guild (or faction) system. You join on faction, so they can give you missions and stuff (saw this in some old space simulator games).  I would suggest to avoid using real names of the religions, pick some other names for them and change small details so people that are against certain religion can't detect this so easily. If you don't than there is a risk you get bad kind of attention (like TheChubu said), last thing you want is someone starting religious flame war around your game.

#5014855 How easy is it to collaborate on a game remotely?

Posted by on 27 December 2012 - 03:09 PM

You should have asked how hard it is to collaborate on the web. Well if you can get a team or just a few people to work with you and can menage to get something other than email for comuncation like free forums or such, than collaboration will persist as long as there is motivation.

#5014746 What makes an RTS great?

Posted by on 27 December 2012 - 11:33 AM

Somebody may disagree with me on this but Starcraft (or Starcraft 2 which is practically the same) has everything one would want from RTS game. That is base building, multiple races, multiple resources, near perfect balance inbetween. But for me in all RTS game after a while it boils down to -> do this, this and this in exactly this order, under certain amount of time and you will win.