1. It's easy. Depends on what exactly do you need: game loop is simple and is neatly described in wiki
For classes, you might probably want to use libraries
I should clarify this - I understand enough to get a (very) simple game going on, but I work entirely in the single main.lua file. I know this isn't the way to do it and I'd like to know how to structure a game in LOVE. Say... an asteroids type game - in Java I'd probably have a movable object class and use that to create a player and asteroid class (each containing their respective, relevant functions).

2. So far, I succeeded to display the fractal when n = 1, but higher when it is higher than 1 it does not work at all.

n = 1

n = 2

Here is my code to subdivise my square :
point2 is a typedef of GLFloat[2]

Code:
```void divide_square(point2 a, point2 b, point2 c, point2 d, int m)
{

point2 vertices[4];
point2 temp[4];

if(m>0)
{
int j;
for (j = 0; j < 2; j++)
{
vertices[0][j] = a[j] / 3;
vertices[1][j] = b[j] / 3;
vertices[2][j] = c[j] / 3;
vertices[3][j] = d[j] / 3;
}

float xdist = abs(b[0] - c[0]);
float ydist = abs(a[1] - b[1]);

std::cout << m << " " << xdist << " " << ydist << std::endl;

//carre 1

temp[0][0] = a[0] - xdist;
temp[0][1] = a[1] - ydist;

temp[1][0] = a[0] - xdist;
temp[1][1] = a[1];

temp[2][0] = a[0];
temp[2][1] = a[1];

temp[3][0] = a[0];
temp[3][1] = a[1] - ydist;

divide_square(temp[0],temp[1],temp[2],temp[3], m-1);

//carre 2

temp[0][0] = a[0] - xdist;
temp[0][1] = a[1];

temp[1][0] = b[0] - xdist;
temp[1][1] = b[1];

temp[2][0] = b[0];
temp[2][1] = b[1];

temp[3][0] = a[0];
temp[3][1] = a[1];

divide_square(temp[0],temp[1],temp[2],temp[3], m-1);

//carre 3

temp[0][0] = b[0] - xdist;
temp[0][1] = b[1];

temp[1][0] = b[0] - xdist;
temp[1][1] = b[1] + ydist;

temp[2][0] = b[0];
temp[2][1] = b[1] + ydist;

temp[3][0] = b[0];
temp[3][1] = b[1];

divide_square(temp[0],temp[1],temp[2],temp[3], m-1);

//carre 4

temp[0][0] = b[0];
temp[0][1] = b[1];

temp[1][0] = b[0];
temp[1][1] = b[1] + ydist;

temp[2][0] = c[0];
temp[2][1] = c[1] + ydist;

temp[3][0] = c[0];
temp[3][1] = c[1];

divide_square(temp[0],temp[1],temp[2],temp[3], m-1);

//carre 5

temp[0][0] = c[0];
temp[0][1] = c[1];

temp[1][0] = c[0];
temp[1][1] = c[1] + ydist;

temp[2][0] = c[0] + xdist;
temp[2][1] = c[1] + ydist;

temp[3][0] = c[0] + xdist;
temp[3][1] = c[1];

divide_square(temp[0],temp[1],temp[2],temp[3], m-1);

//carre 6

temp[0][0] = d[0];
temp[0][1] = d[1];

temp[1][0] = c[0];
temp[1][1] = c[1];

temp[2][0] = c[0] + xdist;
temp[2][1] = c[1];

temp[3][0] = d[0] + xdist;
temp[3][1] = d[1];

divide_square(temp[0],temp[1],temp[2],temp[3], m-1);

//carre 7

temp[0][0] = d[0];
temp[0][1] = d[1] - ydist;

temp[1][0] = d[0];
temp[1][1] = d[1];

temp[2][0] = d[0] + xdist;
temp[2][1] = d[1];

temp[3][0] = d[0] + xdist;
temp[3][1] = d[1] - ydist;

divide_square(temp[0],temp[1],temp[2],temp[3], m-1);

//carre 8

temp[0][0] = a[0];
temp[0][1] = a[1] - ydist;

temp[1][0] = a[0];
temp[1][1] = a[1];

temp[2][0] = d[0];
temp[2][1] = d[1];

temp[3][0] = d[0];
temp[3][1] = d[1] - ydist;

divide_square(temp[0],temp[1],temp[2],temp[3], m-1);

}
else
{
square(a,b,c,d); /* draw triangle at end of recursion */
}
}```
Honestly, I don't understand much OpenGL and I don't know how to subdivise my square. Is some of my code is good, or am I totally wrong ?
And please forgive me. This code is horrible I know, but I'm only trying to make it work.
Funny x 1 (list)

3. This is an odd problem.

I'm writing the Game Of Life in Java and at seemingly random times the KeyboardListener will not even function. Does anyone know of this issue? I can't replicate the issue and it seems to only happen on my laptop. My desktop is fine with it however.

Just wondering if anyone has seen this before. Its quite annoying.

4. This is an odd problem.

I'm writing the Game Of Life in Java and at seemingly random times the KeyboardListener will not even function. Does anyone know of this issue? I can't replicate the issue and it seems to only happen on my laptop. My desktop is fine with it however.

Just wondering if anyone has seen this before. Its quite annoying.
We need to see your KeyboardListener class. It's most likely a problem with your laptop.

I got a Java question:

Can anyone show me an example of sending a Vector class or Array with elements to a Input/OutputStream, adding some data, and getting the Vector class/Array back?
Does the code change if it's a Socket's Input Stream?

5. You need to export with normals, texture coordinates and vectors, it's currently optimized to be fast and not very tolerant. Sorry about that.

Actually, if you send me that file, I'll submit an update that parses it.
Alright, it's literally the default Blender cube exported with default settings though.

http://www.4shared.com/file/hxkP58hY/cube.html

6. I want to create some LoD on a sphere such as:

How should I do it? considering im planning on having a cube normalized to a sphere.
Quad tree is the natural option so should I have a node base class, and then an inherited class for each of the 6 sides (this will just change the X,Y,Z values of the operations to reflect the side)

Or should I do it this way, using some sort of octree?
Programming King x 1 (list)

7. I think I've asked something like this before but I'm really not understanding network prediction, specifically for weapon firing.

For example. If I tell the server I'm starting to fire my weapon, it's going to simulate weapon firing until it gets told to stop weapon firing. I don't see how client timestamps of these two actions can solve that because it doesn't know the exact time the client held down fire until the stop firing messages comes in, this could come in late due to packet latency. So it's possible that server simulated weapon firing for 5 seconds but client did it for 4.9 seconds, that has a chance of popping off a weapon fire when its off cooldown on the server but the client didn't play the animation and effects. Ammo count is now out of sync (unless I then correct that prediction error but I still didn't see the weapon fire effects for the last fire and I think it would be too late to correct that and play the animation and effects)

I see no possible way to solve that and It's pissing me right off.

8. -snip-
Those abc points make me really confused, try to debug it. If seems that in the second step you put a square outside the original position of the whole carpet.
Useful x 1 (list)

9. I think I've asked something like this before but I'm really not understanding network prediction, specifically for weapon firing.

For example. If I tell the server I'm starting to fire my weapon, it's going to simulate weapon firing until it gets told to stop weapon firing. I don't see how client timestamps of these two actions can solve that because it doesn't know the exact time the client held down fire until the stop firing messages comes in, this could come in late due to packet latency. So it's possible that server simulated weapon firing for 5 seconds but client did it for 4.9 seconds, that has a chance of popping off a weapon fire when its off cooldown on the server but the client didn't play the animation and effects. Ammo count is now out of sync (unless I then correct that prediction error but I still didn't see the weapon fire effects for the last fire and I think it would be too late to correct that and play the animation and effects)

I see no possible way to solve that and It's pissing me right off.

There is a very good explanation of how the Source engine handles network prediction here
https://developer.valvesoftware.com/...yer_Networking
It could be of help.

10. There is a very good explanation of how the Source engine handles network prediction here
https://developer.valvesoftware.com/...yer_Networking
It could be of help.
Not really. I'm aware of it but it doesn't really solve my problem.

11. I think I've asked something like this before but I'm really not understanding network prediction, specifically for weapon firing.

For example. If I tell the server I'm starting to fire my weapon, it's going to simulate weapon firing until it gets told to stop weapon firing. I don't see how client timestamps of these two actions can solve that because it doesn't know the exact time the client held down fire until the stop firing messages comes in, this could come in late due to packet latency. So it's possible that server simulated weapon firing for 5 seconds but client did it for 4.9 seconds, that has a chance of popping off a weapon fire when its off cooldown on the server but the client didn't play the animation and effects. Ammo count is now out of sync (unless I then correct that prediction error but I still didn't see the weapon fire effects for the last fire and I think it would be too late to correct that and play the animation and effects)

I see no possible way to solve that and It's pissing me right off.
Let the client tell the server when and where the gun goes off. The client plays its animations and spawns decals etc. immediately. When the server receives knowledge of the gun going off, it verifies its sanity, calculates where it really hit and tells other clients to display the same animations.

12. That doesn't address the problem at all.

Say you had a weapon that fires every 0.1 seconds. The local client holds fire for 0.9 seconds and predicts fire animations, it's going to play a total of 9 fire animations. When the weapon is simulated on the server, it could simulate for 1 second because of the stop fire packet comes in 0.1 second late. Now the server fires a total of 10 times, the local player misses 1 animation and has incorrect ammo count.

13. Just eliminate the concept of a "stop firing" message and instead send a new "bullet fired" one each time a bullet is fired.

14. Just eliminate the concept of a "stop firing" message and instead send a new "bullet fired" one each time a bullet is fired.
Start and stop firing messages is much better because it allows for continuous weapons like a flame thrower. Having single fire messages still has the same problem anyway I think because of paket latency, there's situations where clients weapon is off cooldown but the server side one isn't.

15. Start and stop firing messages is much better because it allows for continuous weapons like a flame thrower. Having single fire messages still has the same problem anyway I think because of paket latency, there's situations where clients weapon is off cooldown but the server side one isn't.
With individual fire messages the server is guaranteed that it will never fire a bullet unless the client did. Packet latency will never mean that too many or too few bullets are fired, unless the latency is so bad that the server can no longer verify whether the client should've been able to fire. I think that's acceptable.

I don't think you can entirely eradicate out-of-syncing if you're doing prediction.

16. The only way that would work is if the server queued up the fire messages and simulated the weapon until the weapon could fire each one off. I dunno though, I feel like there's a better solution to this. Most games I've seen just samples player input and sends it to the server so doing it that way wouldn't work.

17. I don't know much about network programming but couldn't you send the amount of bullets fired with the "stop fire" message?

18. It wouldn't be useful because the server would have already fired too many shots by the time the end fire packet comes in.

19. Those abc points make me really confused, try to debug it. If seems that in the second step you put a square outside the original position of the whole carpet.
Thanks man ! You made me realise that I was creating my new squares outside the original one.

Now, I want to apply this drawing to each face of a cube, how would I do it ? I know how to draw a cube, but applying this fractal to each side seems a little hard.
Winner x 1 (list)

20. Thanks man ! You made me realise that I was creating my new squares outside the original one.

Now, I want to apply this drawing to each face of a cube, how would I do it ? I know how to draw a cube, but applying this fractal to each side seems a little hard.
There are several ways to do this, I do not know if the easiest would be to create a texture. You simply make a big array of RGB bytes and then loop trough the whole array and set all pixels to black and then loop through all the squares and set all pixels within the square to white.

21. Thanks man ! You made me realise that I was creating my new squares outside the original one.

Now, I want to apply this drawing to each face of a cube, how would I do it ? I know how to draw a cube, but applying this fractal to each side seems a little hard.
Are you doing this in a fragment shader or just generating white squares on a black background?

Edited:

If you're generating squares, you can use a framebuffer and render-to-texture, then apply that texture to a cube.

If you're using a fragment shader, texture coordinates are interpolated for you in the fragment shader, so generate a cube with texture coordinates 0-1 and include a uniform that's the side length of the cube and do some math to get how far along the surface you've gone and run the algorithm on that (or if you've got your algorithm working in the 0-1 range, just use texture coords)

22. It wouldn't be useful because the server would have already fired too many shots by the time the end fire packet comes in.
Yeah sending a stop fire packet is broken and unfixable. ThePuska is right.

23. I don't think I'm going to resort to single weapon fire packets. The only data im sending to the server is input sampled from the player and I want to keep it that way. I think I'm going to try and solve it by timestamping the user commands with the client time and then just try and prevent speed hacks somehow.

24. Hello! I'm using C, and I'm having a bit of trouble with reading files. I have the following code:

```  size_t i;
for(i = 0; i < header.fileCount; ++i)
{
struct file_info info;
toLE32(&info.size);

struct zip_source* source = zip_source_file(archive, filename, fileDataPos,
info.size);

fileDataPos += (info.size + (info.size % paddingAmount));
}```

Basically I'm reading a binary file containing a list of files, their names and sizes. Then I'm seeking to after the list where all the files are stacked against each other, and reading the file's data in to libzip. (The files are padded to be a multiple by 4, with zeros.) However, somehow I'm not reading it properly. When I convert my ZIP to a binary file back and diff a hexdump of it, I get this:

Code:
```< 0000000: e43e 0300 0e00 0000 2f03 0000 5245 4144  .>....../...READ
---
> 0000000: e63e 0300 0e00 0000 2f03 0000 5245 4144  .>....../...READ
101c101
< 0000640: 5449 460d 0a0d 0acd 0000 0012 0000 0008  TIF.............
---
> 0000640: 5449 460d 0a0d 0a00 0000 0012 0000 0008  TIF.............
108c108
< 00006b0: 6372 6e34 0000 0000 0000 0000 00cd cdcd  crn4............
---
> 00006b0: 6372 6e34 0000 0000 0000 0000 00cd cd00  crn4............
116c116
< 0000730: 494e 452e 3100 0000 0000 0000 0000 cdcd  INE.1...........
---
> 0000730: 494e 452e 3100 0000 0000 0000 0000 0000  INE.1...........
310c310
< 0001350: 00cd cdcd 0000 0012 0000 0008 0000 0005  ................
---
> 0001350: 0000 cdcd 0000 0012 0000 0008 0000 0005  ................
2624c2624
< 000a3f0: 0000 00cd 0000 0012 0000 0008 0000 0005  ................
---
> 000a3f0: 0000 0000 0000 0012 0000 0008 0000 0005  ................
2919c2919
< 000b660: 0000 00cd 5645 5253 494f 4e20 320d 0a2f  ....VERSION 2../
---
> 000b660: 0000 0000 0000 5253 494f 4e20 320d 0a2f  ......RSION 2../
3523c3523
< 000dc20: 5645 5253 494f 4e20 340d 0a0d 0a2f 2f20  VERSION 4....//
---
> 000dc20: 5600 0000 494f 4e20 340d 0a0d 0a2f 2f20  V...ION 4....//
13295c13295
< 0033ee0: 0000 cdcd                                ....
---
> 0033ee0: 0000 cdcd 0000                           ......```
I can confirm that the corruption happens before or when adding it to the zip, so it may possibly be a problem with me using libzip.

Two things that interest me is the file size has shrunk (the first 4 bytes indicate file size), and that the text 'VERSION' is being converted to 'RSION' and filled with null padding bytes at the start. So I'm pretty sure I'm not reading in 2 bytes or something, but I can't find where in my code. Euck.

25. I know it's probably a silly issue but I can't find a single .obj exporter that will work with OOGL.

26. Okay, so I narrowed it down to bad padding. My problem now is that I have this horrible code:

```    size_t padding = (4 - (sizeStat.size % 4));

How can I fix this?

27. You can get rid of the if statement like this:

```size_t padding = (3 - (sizeStat.size - 1) % 4);

28. Thanks! I still don't get the fwrite thing.

Edited:

Eh, I just made a 3-byte array filled with stuff I'll use to pad.

29. Are you doing this in a fragment shader or just generating white squares on a black background?

Edited:

If you're generating squares, you can use a framebuffer and render-to-texture, then apply that texture to a cube.

If you're using a fragment shader, texture coordinates are interpolated for you in the fragment shader, so generate a cube with texture coordinates 0-1 and include a uniform that's the side length of the cube and do some math to get how far along the surface you've gone and run the algorithm on that (or if you've got your algorithm working in the 0-1 range, just use texture coords)
I'm generating squares. So, if I understood, I need to render those squares in a FBO, render-to-texture that, and use the generated texture for my cube ?

http://www.songho.ca/opengl/gl_fbo.html#renderbuffer

Is this a good tutorial about it ?

30. I'm generating squares. So, if I understood, I need to render those squares in a FBO, render-to-texture that, and use the generated texture for my cube ?

http://www.songho.ca/opengl/gl_fbo.html#renderbuffer

Is this a good tutorial about it ?
Renderbuffers can't be used as textures, instead attach a texture with glFramebufferTexture2D. A good texture size would be 512x512 or 1024x1024. Since the pattern never changes, you could just do this once during initialization and just use that texture.

Other than that, the tutorial is good. Basically just do what the example is doing, only you don't need to generate/attach the depth renderbuffer. Only do the color buffer (since you don't need depth for your texture).
Useful x 1 (list)

31. I'm going through a book (Beginning Game Programming Third Edition, Jonathon S. Harbour) and I got stuck on the program that introduces you to initializing Direct3D. Apparently I made the wrong project type and fucked everything up, so I loaded the project from the CD. Even if I try to compile that, I get

`1>LINK : fatal error LNK1181: cannot open input file 'd3d9.libkernel32.lib'`

Help?

32. What C function do I use to print colored in console?
Funny x 1 (list)

33. I'm going through a book (Beginning Game Programming Third Edition, Jonathon S. Harbour) and I got stuck on the program that introduces you to initializing Direct3D. Apparently I made the wrong project type and fucked everything up, so I loaded the project from the CD. Even if I try to compile that, I get

`1>LINK : fatal error LNK1181: cannot open input file 'd3d9.libkernel32.lib'`

Help?
Looks like a terribly malformed link. Looks like it's d3d9.lib and kernel32.lib.

34. How do I MVP matrix?

Seriously, this is a pain in the ass. All I need to know is what order I load, multiply, etc. the matrices for the vertex shader and in my C++ code. I'm using GLM for the perspectiveFov and lookAt functions.

35. What C function do I use to print colored in console?
ansi escapes on sane systems, funky win32 api calls on windows
Agree x 2 (list)

36. ansi escapes on sane systems, funky win32 api calls on windows
An actual console API is ten times more sane than escape sequences.
Agree x 2 Disagree x 2 (list)

37. An actual console API is ten times more sane than escape sequences.
i'm not arguing either way, i'm just saying that unix systems are generally more sane than windows
Agree x 1 Disagree x 1 Optimistic x 1 (list)

38. How do I MVP matrix?

Seriously, this is a pain in the ass. All I need to know is what order I load, multiply, etc. the matrices for the vertex shader and in my C++ code. I'm using GLM for the perspectiveFov and lookAt functions.
Something like this
```glm::mat4 model;
glm::mat4 view = glm::lookAt(glm::vec3(0, 20, 40), glm::vec3(0, 0, 0), glm::vec3(0, 1, 0));
glm::mat4 projection = glm::perspective(60.0f, 800.0f / 600.0f, 1.0f, 100.0f);
glm::mat4 mvp;
```
in update:
```model = glm::rotate(glm::mat4(1.f), time, glm::vec3(1, 0, 0));
model = glm::translate(model, glm::vec3(-width/2.f, -height/2.f, -depth/2.f));
mvp = projection * view * model;
```

You should post code there's probably other problem like indices etc

39. In C++ I want to have a triangle class, made from 3 verticies each of which will be a float[3]
so the class will probably be something like:
```
struct vertex
{
float x;
float y;
float z;
};

class Triangle
{
vertex a, b, c;
int someVariable;
void someFunctions;
}
```

I will then have a VBO which accepts floats but I want to pass it an array of triangles

How can I make sure that when this gets compiled/executed all the floats/verticies are packed continuously?

40. In C++ I want to have a triangle class, made from 3 verticies each of which will be a float[3]
so the class will probably be something like:
```
struct vertex
{
float x;
float y;
float z;
};

class Triangle
{
vertex a, b, c;
int someVariable;
void someFunctions;
}
```

I will then have a VBO which accepts floats but I want to pass it an array of triangles

How can I make sure that when this gets compiled/executed all the floats/verticies are packed continuously?
A perhaps ugly way is to map the struct as a float[3] array with something that I have forgot the name of but it saves a pair of two different types and exist in boost.
Useful x 1 (list)