Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 16 Oct 2013
Offline Last Active Mar 01 2015 04:31 PM

#5164791 How To Save A Non-Grid-Based Level For A Game

Posted by Lactose! on 04 July 2014 - 03:01 PM

There are loads of ways of doing it.

How a level is saved will depend greatly on what specific things you need saved, and how the game will interpret them.


One way to solve your specific issue is to store a position and a rotation, either as some floats and some rotation angles or something, or by basically having the entire 4x4 matrix stored in the level's file.

Made-up example:



ObjectName = "MyObject"

ObjectType = "AwesomeObject"

ObjectPos = 100.023f, 39.5f, -882.0f



Then, in this example when loading, the editor/game would see a new object block (from the "Object_Start" keyword), would assign its name and type based on the next keywords, and put it in the exact position you wanted it, based on the position data.

#5164759 encryption my password

Posted by Lactose! on 04 July 2014 - 10:11 AM

Do you have a question or a problem? I don't understand what kind of replies you're wanting.

#5164754 simple SDL framerate?

Posted by Lactose! on 04 July 2014 - 09:55 AM

Is it me or is L.Spiro assuming that framerate limiting is only done for hardware limitations and not to simplify gameplay logic? (it's much easier to do things like physics if you know the interval between frames is always the same)

A fixed timestep solves that.

To repost the link: http://gafferongames.com/game-physics/fix-your-timestep/

#5164660 So... I'm a Molecular Biologist....

Posted by Lactose! on 03 July 2014 - 03:59 PM

While this might only be tangentially relevant, you might want to look at the game SpaceChem. You might find it interesting, and it might give you some ideas in terms of puzzle gameplay with a molecular flavour.



#5164298 Seperated world intro smaller chuncks, object occupies more the none chunk

Posted by Lactose! on 02 July 2014 - 06:40 AM

Spatial partitioning?



EDIT: Also see the references at the bottom for other methods of partitioning.

#5163917 very strange bug (when runing c basic arrays code)

Posted by Lactose! on 30 June 2014 - 02:16 PM

Debuggers help you find and fix bugs quickly

It's almost as if the name of the tool was a hint to what it should be used for.

#5163706 Need more than 1 value to unpack?

Posted by Lactose! on 29 June 2014 - 03:19 PM

When you run it from Notepad++, you haven't passed in any arguments. I don't currently have Notepad++ installed, but I'd guess under the "Run" filemenu there'd be an option to specific command-line arguments.

I may be remembering incorrectly, but I believe Notepad++'s run option just makes you type in the arguments after the (filepath +) filename. Just like the command line.

#5163347 My game's beta is finished but it won't run on other comptuers

Posted by Lactose! on 27 June 2014 - 07:36 PM

in short, initialize your variables!

Like we said on chat :)

#5160573 for loop skipping to the end after first loop

Posted by Lactose! on 14 June 2014 - 07:05 PM

I'm not sure what application you're using to run/debug this in, but I think the following is true for most major IDEs.


A breakpoint will stop the application at the indicated line. From here, you can look at various variables, resume the application, or step through the code.

For stepping through code, you mainly have 2 things -- step over and step into. Step over will continue to the next line in the code, while step into will take you deeper into the code if possible. Basically, on the following line:

int x = getPositionFromCharacter(myCharacter); //Breakpoint here
int y = 15;

Step over will go to the "int y" line, while step into will go into the first line of the "getPositionFromCharacter" function. After stepping through the entire function (or using step out), you'll exit the function and be back where you entered (in this case, the "int x" line).


Common keyboard shortcuts for these are:

F9: Set breakpoint at currently selected line.

F10: Step over.

F11: Step into.

Shift+F11: Step out.


You can also have conditionals for breakpoints, the two I use the most being:

- Only break if the value is a specific thing or if the value changes (conditional breakpoint), 

- Only break on certain hits, e.g. after 2 hits, or ever 6 hits, etc.

In Visual Studio, you can right click on the breakpoint spot to set various types of breakpoints.


In addition, you can also assign variables to a watch list. This allows you to keep track of what the variable is easily. For example, you could add a specific array position (array + index) to watch, and be able to quickly see if it changes in a separate listing (basically saving you having to track it down every time you want to see its value).


Hope that helps :)

#5159812 harder cases of triangle projection

Posted by Lactose! on 11 June 2014 - 11:19 AM

I disagree with Olof Hedman; there is a choice.

fir, you can choose to do it the way you're thinking of doing it, or you can choose to do it the correct way.


Use a "cut pyramid" (a frustum). This requires a near plane, so use a near plane.


I could probably link to some articles explaining why this way is correct, but you've stated your disgust with reading/searching/researching before, so I won't.

The short version is, like Olof Hedman says, math.

#5159268 whats this? javscript/ga

Posted by Lactose! on 09 June 2014 - 09:07 AM

this function probably counts the length of the eye-to-wall
ray casted into wall in some raycaster in js language


It does not "count the length of the ... ray". Counting the length of a ray doesn't even make sense to me, so I'm not actually sure what you're asking here.


You're not sure what the function does. Which part of the description (from your link) is unclear? An answer to this might be able to give a answer that will make your problem go away.

Next, we need to check for walls in each ray's path. Our goal is to end up with an array that lists each wall the ray passes through as it moves away from the player.

Starting from the player, we find the nearest horizontal (stepX) and vertical (stepY) gridlines. We move to whichever is closer and check for a wall (inspect). Then we repeat until we've traced the entire length of each ray.
If understanding the goal of the function is not the problem, what is?
If it's none of those things, what is it? Is it something specific about the code you don't understand? If it is, you should post that specific thing, and give as much information about why you don't understand it, and what you think it might be.
Directing you to google is not being rude. It's saving everyone involved time (including you), and you will need to be able to research simple (or even advanced!) things mostly on your own if you want to get anything done. Of course, asking questions if you're stuck is always fine, as long as you've tried on your own first.
You might disagree with this, but this is how this forum (and every other technical forum I've seen) works. If you don't like it and think it's stupid, maybe what you're looking for isn't actually found on this forum? Maybe you're actually looking for someone to mentor you or act as a teacher?

#5158649 Homing missile problem

Posted by Lactose! on 06 June 2014 - 03:31 AM

rotation = atan2( targety , targetx ) + PI; //from 0 to 2*PI


When using atan, shouldn't you add 2*PI if angle is < 0, and keep as-is if not:

rotation = atan2(targety, targetx);
if (rotation) < 0
    rotation += 2 * PI; //EDIT: Or + 360 if the atan2 function returns degrees instead of radians.

#5155892 Why does game GUI have to be rectangles?

Posted by Lactose! on 25 May 2014 - 11:22 AM

Buttons don't have to be rectangular, but it's generally easier to implement/create a framework for buttons which have a nice geometrical/symmetrical shape.

If you want, you can create buttons which are whatever shape you can think of.


Edit: Being a ninja.

#5155865 Bounding Box Collision Glitching Problem (Pygame)

Posted by Lactose! on 25 May 2014 - 07:48 AM

Keep in mind that if you do that, with large velocities, you can end up with never being able to get very close to a wall. E.g. if there's a 20 unit gap, and your movement speed is 25 units, moving towards the collision thing will make you stay at that 20 gap distance, instead of closing the gap and touching the wall.


Other than that, I agree with splitting input handling and movement logic.

#5154500 What good OpenGL book do you recommend for beginners?

Posted by Lactose! on 18 May 2014 - 03:33 PM

I would suggest the following link. It's online, free and related to current (shader based) OpenGL.