You could use conio on Windows and check the line height with terminfo on *NIX. Should work just fine on OSX, too, since most non-curses terminal apps use it.
I was just briefly wondering if anyone knows what to avoid using in OpenGL 3.2 so that it can still work perfectly with OpenGL 2.
Obviously there are a few functions and a few glsl variables and function calls, but I can't seem to find a comprehensive list anywhere :/
[url]http://www.opengl.org/sdk/docs/man/[/url]
[QUOTE=Overv;30833503][url]http://www.opengl.org/sdk/docs/man/[/url][/QUOTE]
Those are the 2.1 man pages. They say nothing on what is in 3.2 compared to 2.x
I guess I'll just write multiple code paths.
[QUOTE=Chandler;30837248]Those are the 2.1 man pages. They say nothing on what is in 3.2 compared to 2.x
I guess I'll just write multiple code paths.[/QUOTE]
Well, you can compare the lists.
-snip-
Question (duh). If I have a list of 'nodes' not necessarily in any order, how can I make them connected to their neighbors to the sides and down and up. I suck at explaining, so here have some pictures.
A node has a list of nodes called connections, and a position. This is a graphical representation of a list of nodes.
[img]http://dl.dropbox.com/u/5270951/Pics/likethis.png[/img]
What I want is for each node to be connected like this.
[img]http://dl.dropbox.com/u/5270951/Pics/thenlikethis.png[/img]
Thanks.
P.S: Ignore the fact that in the second image, there are less nodes. I removed some due to my fail at art. In the code each line and column has the same amount of nodes.
[QUOTE=bobthe2lol;30839300]Question (duh). If I have a list of 'nodes' not necessarily in any order, how can I make them connected to their neighbors to the sides and down and up. I suck at explaining, so here have some pictures.
A node has a list of nodes called connections, and a position. This is a graphical representation of a list of nodes.
[img]http://dl.dropbox.com/u/5270951/Pics/likethis.png[/img]
What I want is for each node to be connected like this.
[img]http://dl.dropbox.com/u/5270951/Pics/thenlikethis.png[/img]
Thanks.
P.S: Ignore the fact that in the second image, there are less nodes. I removed some due to my fail at art. In the code each line and column has the same amount of nodes.[/QUOTE]
In the first image, there are 25 nodes so you can't build a structure like that out of them ;)
However, if they're guaranteed to be in groups of 3, I think you should utilize that.
Sort the entire list of nodes according to their X-axis. Pop the 3 top nodes (doesn't matter from which side, as long as it's consistent) into another buffer. Sort the 3 nodes you just popped according to their Y-axis.
Now you have a column of nodes in the buffer. You should link them together, and then link them to the previous column. Clear the buffer, then iterate.
edit: will fuck up if they start overlapping each other too much (e.g. top node goes over the bottom node of the [i]next[/i] column). But that could be solved with a more sophisticated heuristic than sorting them according to their X initially. It gets a bit advanced but you could sort the same list in 3 different ways - one way for each node row.
I'm trying to make a game with multiple enemies following you. I got the enemy movement and such ready, but the spawning is a littlebit of a problem for me. I make my enemies with a timer, each 5 seconds the timer will activate, my timer code:
[cpp] class EnemySpawnHandler implements ActionListener{
public void actionPerformed(ActionEvent e){
int randomx = generator.nextInt(1600);
int randomy = generator.nextInt(1200);
enemy = new EnemyEntity(randomx,randomy,50,50,2,2);
firstenemyspawned = true;
System.out.println("Enemy Spawned");
}
}[/cpp]
Now, what is does, is create a enemy that follows me, but, after each 5 seconds, it deletes the enemy it created, and creates a new one. I want the enemy to stay, and then another enemy comes, without deleting one. But, I NEED to keep the enemy name, else I can't control the movement.
Make enemy a collection (e.g. linked list) of enemies?
I never did that, and I would not know how to do that.
Does anyone know, if there is a fix for the Source Engine´s reflective glass - bug?
(the one, which ceases the glass to render or cause visual artifacts if water and or portals are in a visible visleaf)
this is not what are you working on, whoops
[QUOTE=ThePuska;30843613]In the first image, there are 25 nodes so you can't build a structure like that out of them ;)
However, if they're guaranteed to be in groups of 3, I think you should utilize that.
Sort the entire list of nodes according to their X-axis. Pop the 3 top nodes (doesn't matter from which side, as long as it's consistent) into another buffer. Sort the 3 nodes you just popped according to their Y-axis.
Now you have a column of nodes in the buffer. You should link them together, and then link them to the previous column. Clear the buffer, then iterate.
edit: will fuck up if they start overlapping each other too much (e.g. top node goes over the bottom node of the [i]next[/i] column). But that could be solved with a more sophisticated heuristic than sorting them according to their X initially. It gets a bit advanced but you could sort the same list in 3 different ways - one way for each node row.[/QUOTE]
I'm not sure what you mean by groups of three. It should work for any square or rectangle. Here's another, better example of what I mean:
before:
[img]http://dl.dropbox.com/u/5270951/Pics/then.png[/img]
after:
[img]http://dl.dropbox.com/u/5270951/Pics/first.png[/img]
I hope that clarifies. This is a 8x10 rectangle.
Maybe it's not an elegant solution, but what about connecting to the closest northwestern node, closest northeastern node, closest southwestern node and closest southeastern node?
Not sure what you mean. I thought of something though. Its probably quite inefficent. Take the first node in the list, and connect it to every other node in the list. Then remove all but the closest 2 connections, wash rinse and repeat. Not sure if that would work because the nodes aren't nesecarily in straight lines though...
[QUOTE=ZeekyHBomb;30847888][csharp]ICollection<Enemy> enemies = new LinkedList<Enemy>();
//...
enemies.Add(new EnemyEntity(randomx,randomy,50,50,2,2));
//...
for(Enemy enemy : enemies)
enemy.Update();[/csharp][/QUOTE]
I'm doing this in Java
oops
[csharp]Collection<Enemy> enemies = new LinkedList<Enemy>();
//...
enemies.add(new EnemyEntity(...));
//...
for(Enemy enemy : enemies)
enemy.update();[/csharp]
Not that different though :buddy:
I just started learning XNA game studio (and C# in general) and I was learning from the book "Learning XNA 4.0 Game Development for the PC, Xbox 360, and Windows Phone 7", I was following its instructions, and as all good books do, it doesn't give you the code in blocks, but instead section by section. This leads me to believe that I put some code in the wrong section and fucked it up like an idiot. Can anyone help? The problem is probably a newbie one.
[code]using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
namespace WindowsGame3
{
/// <summary>
/// This is the main type for your game
/// </summary>
public class Game1 : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
VertexPositionColor[] verts;
VertexBuffer vertexBuffer;
BasicEffect effect;
public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
Camera camera;
/// <summary>
/// Allows the game to perform any initialization it needs to before starting to run.
/// This is where it can query for any required services and load any non-graphic
/// related content. Calling base.Initialize will enumerate through any components
/// and initialize them as well.
/// </summary>
protected override void Initialize()
{
// TODO: Add your initialization logic here
// Initialize camera
camera = new Camera(this, new Vector3(0, 0, 5),
Vector3.Zero, Vector3.Up);
Components.Add(camera);
base.Initialize();
}
/// <summary>
/// LoadContent will be called once per game and is the place to load
/// all of your content.
/// </summary>
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
// Initialize vertices
verts = new VertexPositionColor[3];
verts[0] = new VertexPositionColor(new Vector3(0, 1, 0), Color.Blue);
verts[1] = new VertexPositionColor(new Vector3(1, −1, 0), Color.Red);
verts[2] = new VertexPositionColor(new Vector3(−1, −1, 0), Color.Green);
vertexBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColor),
verts.Length, BufferUsage.None);
vertexBuffer.SetData(verts);
// Initialize the BasicEffect
effect = new BasicEffect(GraphicsDevice);
// Set vertex data in VertexBuffer
// TODO: use this.Content to load your game content here
}
/// <summary>
/// UnloadContent will be called once per game and is the place to unload
/// all content.
/// </summary>
protected override void UnloadContent()
{
// TODO: Unload any non ContentManager content here
}
/// <summary>
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Update(GameTime gameTime)
{
// Allows the game to exit
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();
// TODO: Add your update logic here
base.Update(gameTime);
}
/// <summary>
/// This is called when the game should draw itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
GraphicsDevice.SetVertexBuffer(vertexBuffer);
//Set object and camera info
effect.World = Matrix.Identity;
effect.View = camera.view;
effect.Projection = camera.projection;
effect.VertexColorEnabled = true;
// Begin effect and draw for each pass
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
GraphicsDevice.DrawUserPrimitives<VertexPositionColor>
(PrimitiveType.TriangleStrip, verts, 0, 1);
}
// TODO: Add your drawing code here
base.Draw(gameTime);
}
}
}
[/code]
Can anyone remember the site that let you search for open source licences, by asking some simple questions like do you wish to allow for people to use your code commercially...
I remember that site had some very simple definitions for most of the open source libraries.
Or anyone know of any other sites that have very simple definitions for OS licences?
[QUOTE=Richy19;30859871]Can anyone remember the site that let you search for open source licences, by asking some simple questions like do you wish to allow for people to use your code commercially...
I remember that site had some very simple definitions for most of the open source libraries.
Or anyone know of any other sites that have very simple definitions for OS licences?[/QUOTE]
There's [url]http://www.opensource.org/licenses/index.html[/url] and [url]http://creativecommons.org/[/url]?
right...
I have a server broadcasting data 10 times a second, every 0.1 seconds.
I had this data being processed when it is received, which is fine locally but when latency was introduced, it had some effects.
For example, there might be a 0.2 delay between getting a packet, then it would receive 2 packets closer together just afterwards. What I'm trying to do is buffer the packets for a second, so I'm inserting them into an array once I receive it, and pulling the oldest entry from the array every 0.1 seconds, in my mind that should compensate for any slight time differences between packets arriving.
I'm getting some unexpected behaviour with it, where the data would be building up. After a bit of digging, it appeared that the code which was meant to cycle through the buffer every 0.1 seconds was running slightly slower than that, resulting in the buffer just building up and up.
Is there any better way of compensating for this or am I doing it the right way, I just need to try and sort out the timing.
Can someone point me in the direction of a general guide to making a world generator?
[QUOTE=Jimbomcb;30863814]right...
I have a server broadcasting data 10 times a second, every 0.1 seconds.
I had this data being processed when it is received, which is fine locally but when latency was introduced, it had some effects.
For example, there might be a 0.2 delay between getting a packet, then it would receive 2 packets closer together just afterwards. What I'm trying to do is buffer the packets for a second, so I'm inserting them into an array once I receive it, and pulling the oldest entry from the array every 0.1 seconds, in my mind that should compensate for any slight time differences between packets arriving.
I'm getting some unexpected behaviour with it, where the data would be building up. After a bit of digging, it appeared that the code which was meant to cycle through the buffer every 0.1 seconds was running slightly slower than that, resulting in the buffer just building up and up.
Is there any better way of compensating for this or am I doing it the right way, I just need to try and sort out the timing.[/QUOTE]
Count how much you have to sleep less
[cpp]static const double sleepyTime = 0.1;
double diffTime = 0, currentTime = getCurrentTime();
while(true)
{
sleep(max(0, sleepyTime - diffTime));
recieveAndHandleData();
diffTime = getCurrentTime() - currentTime;
currentTime += diffTime;
}[/cpp]
[QUOTE=Jimbomcb;30863814]right...
I have a server broadcasting data 10 times a second, every 0.1 seconds.
I had this data being processed when it is received, which is fine locally but when latency was introduced, it had some effects.
For example, there might be a 0.2 delay between getting a packet, then it would receive 2 packets closer together just afterwards. What I'm trying to do is buffer the packets for a second, so I'm inserting them into an array once I receive it, and pulling the oldest entry from the array every 0.1 seconds, in my mind that should compensate for any slight time differences between packets arriving.
I'm getting some unexpected behaviour with it, where the data would be building up. After a bit of digging, it appeared that the code which was meant to cycle through the buffer every 0.1 seconds was running slightly slower than that, resulting in the buffer just building up and up.
Is there any better way of compensating for this or am I doing it the right way, I just need to try and sort out the timing.[/QUOTE]
In your "packet-polling-loop" only save when the next poll should happen like this:
[code]
float NextPoll = 0;
while(NextPoll < GetCurrentTime())
{
NextPoll += IntervallBetweenPolls;
HandlePacketFromBuffer();
}
[/code]
I use that kind of loop in my games for units that have such a small delay between their attacks that they may attack multiple times per frame.
Such a loop will always sustain the "hits/polls/actions per second" very precisely over time.
[QUOTE=Jimbomcb;30863814]right...
I have a server broadcasting data 10 times a second, every 0.1 seconds.
I had this data being processed when it is received, which is fine locally but when latency was introduced, it had some effects.
For example, there might be a 0.2 delay between getting a packet, then it would receive 2 packets closer together just afterwards. What I'm trying to do is buffer the packets for a second, so I'm inserting them into an array once I receive it, and pulling the oldest entry from the array every 0.1 seconds, in my mind that should compensate for any slight time differences between packets arriving.
I'm getting some unexpected behaviour with it, where the data would be building up. After a bit of digging, it appeared that the code which was meant to cycle through the buffer every 0.1 seconds was running slightly slower than that, resulting in the buffer just building up and up.
Is there any better way of compensating for this or am I doing it the right way, I just need to try and sort out the timing.[/QUOTE]
In the source engine if I remember right they interpolate between the last 2 updates + prediction. Perhaps you can do something like that?
[img]http://dl.dropbox.com/u/3724424/Programming/Gifs/game6.gif[/img]
I have a problem with AABB collision resolution.
---
I resolve AABB intersection by resolving the X axis first, then the Y axis.
This is done to prevent this bug: [url]http://i.stack.imgur.com/NLg4j.png[/url]
---
The current method works fine when an object moves into the player and the player has to be pushed horizontally. As you can see in the .gif, the horizontal spikes push the player correctly.
---
When the vertical spikes move into the player, however, the X axis is still resolved first. This makes "using the spikes as a lift" impossible.
When the player moves into the vertical spikes (affected by gravity, falls into them), he's pushed on the Y axis, because there was no overlap on the X axis to begin with.
---
Something I tried was the method described in the first answer of this link: [url]http://gamedev.stackexchange.com/questions/13774/2d-rectangular-object-collision-detect-direction[/url]
However the spikes and moving objects move by having their position changed, not velocity, and I don't calculate their next predicted position until their Update() method is called.
Needless to say this solution didn't work either. :(
---
I need to solve AABB collision in a way that both of the cases described above work as intended.
This is my current collision source code: [url]http://pastebin.com/MiCi3nA1[/url]
I'd be really grateful if someone could look into this, since this bug has been present in the engine all the way back from the beginning, and I've been struggling to find a good solution, without any success. This is seriously making me spend nights looking at the collision code and preventing me from getting to the "fun part" and coding the game logic :(
If anyone needs any kind of further explanation, example, the full game source code, post here or contact me on Steam.
[QUOTE=T3hGamerDK;30862048]There's [url]http://www.opensource.org/licenses/index.html[/url] and [url]http://creativecommons.org/[/url]?[/QUOTE]
Ahh crap, i was looking for this kind of definition [url]http://creativecommons.org/licenses/by/3.0/[/url]
for all the major licences but it seems they only have it for their own licences
@SupahVee: I have the same experience as you. I made my platformer game/engine in February and still I don't manage to fix these collision problems.
I don't see how "resolving the X axis first, then the Y axis" method would work here.
Sorry, you need to Log In to post a reply to this thread.