[QUOTE=mechanarchy;35278877]But i'm under the impression opengl hates you doing shit like that because there's usually functions that do the same thing and only need one call to opengl instead of many like i'm doing here[/QUOTE]
There's a few solutions to reduce the number of calls to glDrawArrays. The obvious one is to use GL_LINES, pack the data into a larger buffer and then use a single DrawArrays call. Alternatively you can continue using GL_LINE_LOOP with primitive restart, although this requires you to provide an index buffer. In this situation where you know that each loop is a quad you could also consider using a geometry shader that accepts a point containing each of the 4 verts as attributes and outputs 4 lines. You could also consider instancing a quad and providing per-instance transformations. Each is viable and likely to perform differently depending on your target hardware.
Anyone have any recommendations on a 3d engine for Python? I've tried PyOgre, but failed to get it working. And are currently looking into Irritch. Any other good engines out for python?
Can anyone explain implementing a sound engine such as OpenAL?
I understand you have a limited number of sources (32 or 64 on generic devices, a bit more on some specific devices), and each of these sources act as a 'channel' of audio. Each source is tied to a buffer and is given a position, volume, and so on and plays.
I'm asking more in the context of having lots of sound sources. Do you have a Source for music and then one for UI, and then the rest are split up among the game implementation, with Sources jumping to whatever currently needs to play a sound? What happens when you run out of sources, do you skip additional requests? Do you stop the earliest and play the latest?
[QUOTE=Anderen2;35281337]Anyone have any recommendations on a 3d engine for Python? I've tried PyOgre, but failed to get it working. And are currently looking into Irritch. Any other good engines out for python?[/QUOTE]
[URL="http://www.panda3d.org/"]Panda3D[/URL].
FP are you shitting me?
Why does XNA have a bunch of racing variables built in but doesn't have support for drawing a bloody triangle without a bunch of shaders?
That brings me to my question: How do you use DrawUserPrimitives?
[quote]Both a vertex shader and pixel shader must be set on the device before any draw operations may be performed.[/quote]
It's likely that this is a ridiculously simple process, but how do I add friendly fire to my source mod?
Quick question:
If I have an int elapsedTime which is the time in ms since the last draw call.
Does 1000/elapsedTime = fps?
[QUOTE=Hypershadsy;35284549]FP are you shitting me?
Why does XNA have a bunch of racing variables built in but doesn't have support for drawing a bloody triangle without a bunch of shaders?
That brings me to my question: How do you use DrawUserPrimitives?[/QUOTE]It doesn't require a 'bunch of shaders' but it does require at least one provided shader if you're calling the drawing functions manually. Shaders are not that difficult however, and some Xna classes have their own drawing methods (Model, and SpriteBatch are two that I can think of) that don't require any user shaders at all.
[QUOTE=Hypershadsy;35284549]FP are you shitting me?
Why does XNA have a bunch of racing variables built in but doesn't have support for drawing a bloody triangle without a bunch of shaders?
That brings me to my question: How do you use DrawUserPrimitives?[/QUOTE]
If you really don't want to write your own shaders you can use the built in effects such as the BasicEffect class. The built in effects are reasonably comprehensive and on Windows Phone 7 you have to use the built in effects.
Don't need help with this but I'm curious. When coding a text box how does positioning the "text cursor" work, with different characters being different widths?
So I've been trying to set up a Slick 2D project but I keep running into a problem when it comes to running the program.
I get the error:
Can't load IA 32-bit .dll on a AMD 64-bit platform
I know I'm importing the libraries correctly because when I do the same steps at my school on theri 32 bit platform it's fine. I know I have to use the x64 libraries on my laptop, and I am, but it still doesn't work...
However, when I try doing the same steps(except on my laptop I use the x64 libraries) on my laptop I get this error.
Any ideas?
Would it be smart to set the maximum calculations of a game to be say 1/60th of a second, but re-render the window even though nothing will be moved during the re-rendering (because nothing is calculated and as such nothing is moved)? Or should I just cap FPS? This is for a networked game, where I think 60 packets would be good enough (or possibly 30, but it's LAN so I don't think that's too much of an issue) but I am also interested in a single player game.
[editline]25th March 2012[/editline]
Oh and I just got the new SFML snapshot and for some reason I cannot target the window, nor move it. How do I enable it to do that?
[editline]25th March 2012[/editline]
Oh right I had to poll for events.
[QUOTE=bean_xp;35287447]If you really don't want to write your own shaders you can use the built in effects such as the BasicEffect class. The built in effects are reasonably comprehensive and on Windows Phone 7 you have to use the built in effects.[/QUOTE]
So I initialized a BasicEffect in Initialize() and called myBasicEffect.GraphicsDevice.DrawUserPrimitives and it throws the same exception.
I did some googling, and I apparently need to call myBasicEffect.CurrentTechnique.Passes[0].Apply(); beforehand, but now it just says [quote]The current vertex declaration does not include all the elements required by the current vertex shader. Normal0 is missing.[/quote]
But I never told it to handle normals, I explicitly told it to use VertexPositionColor.
I don't think there's anywhere on the Internet that tells how to do any of this correctly, every thread I've seen just ends in an unanswered question.
For networking, say I have a standard packet be 256 bytes large. What if I have more entities than can fit in a single packet? Should I send two packets instead? If so, then what if one gets lost. I would receive half the data but not the other half. How should I deal with the need to send multiple packets? And should I send multiple packets or pack all info into one large packet? Like instead of sending the co ordinates of each player in separate packets, should I send all information in the same packet?
why not just use tcp (or udp) rather than what seems to be your own protocol? not to mention if you were writing your own you'd have to handle acknowledgements and lost / corrupt stuff yourself. It seems you're using SFML, which lets you use either TCP or UDP. TCP will handle lost and corrupt packets automatically.
Generally packets will have a sequence number, so if you're expecting packet 40 but get packet 41 then you know 40 was lost. But then you have to let the server know you need a retransmission of 40. So what do you do with 41, throw it away or buffer it? What about time outs if you don't hear from clients after X amount of time? It's a pretty complex thing when you want a really reliable protocol, just use TCP if you want every packet delivered and in order.
I use UDP, TCP I heard is really bad for games because it is sequenced and has to resend lost packets, and packet loss is not such a bad thing for a fast paced game so I'm not worried too much about that.
Also UDP has no built in acknowledgement, flow control, or really anything so you have to code that yourself.
[editline]25th March 2012[/editline]
I don't need really reliable networking, a few packets lost is not a real issue.
so then why ask if you need to resend lost packets if you don't have to? for the actual game part if what happened a few time units ago isn't vital and only what is happening now is then who cares about any lost packets? only request retransmission of vital stuff (or use a tcp connection for that). i would try sending player positions in separate packets so that way as many players as possible can update rather than have everyone lag if you miss a packet (not to mention I think there would be a greater chance of a huge packet being corrupt than a small one, does UDP handle corrupt packets?). the only networking stuff i've done is for nice turn based stuff so TCP was the better option and all data was vital.
The reason I was asking about resending packets is because it seems odd if only some of the objects get updated and the others do not.
[editline]25th March 2012[/editline]
It seems it would be smarter to send info in one packet rather than in many (limiting at probably 20 packets a second), really lags up the game the more packets sent. I was thinking sending the info of the player for 3 ticks (1/60th of a second) since I only send packets every 1/20th of a second, because if I only send 1 tick and stop moving half way it jumps the player forward a few pixels.
[QUOTE=WTF Nuke;35294343]For networking, say I have a standard packet be 256 bytes large.[/QUOTE]
Never send 256 byte packets. Ethernet frames are typically 1500 bytes. Prefer to send packets that are just under this limit. Maybe ~1400 bytes.
Or, just send one really huge packet. The Internet Protocol should split it automatically when it hits a device with a smaller MTU than the size of the packet.
[QUOTE=WTF Nuke;35294343]What if I have more entities than can fit in a single packet? Should I send two packets instead? If so, then what if one gets lost. I would receive half the data but not the other half. How should I deal with the need to send multiple packets? And should I send multiple packets or pack all info into one large packet? Like instead of sending the co ordinates of each player in separate packets, should I send all information in the same packet?[/QUOTE]
For simple, repetitive actions like position updates, etc, send as much as you can in as few packets as you can. Serialize everything and send it all at once. Quake based engines keep track of old serialized gamestates and delta-encode against the most recent one that it knows the client has received (i.e. if it knows that the client has game-frame [i]n-3[/i], then it only sends the stuff that has changed since frame [i]n - 3[/i] in the frame [i]n[/i] update)
This might be overkill for you, though. Carefully assess your requirements before proceeding.
For major game state changes, you'll probably still want reliable transport. Some games have a separate TCP connection for this, while others build a reliable layer on top of the existing UDP connection. Personally, I'd go with the latter solution, as it gives you the flexibility to have separate reliable 'streams' and such over one connection, or provide reliable non-ordered streams or unreliable ordered streams, etc. There probably libraries out there that would do this for you.
Thanks for the tips Robo, appreciate it.
Right now I'm using [B]GL_TRIANGLES[/B] for the mesh, but how can I change this to work with [B]GL_TRIANGLE_STRIP[/B]?
[CODE]
int tWidth = 40;
int tHeight = 40;
Point[] vertexes = new Point[(tWidth * tHeight) * 6];
int k = 0;
// Run through every array index
for (int x = 0; x < tHeight; x++) {
for (int y = 0; y < tWidth; y++) {
// q1 q2
// |---------|
// | |
// | |
// | |
// |---------|
// q3 q4
int q1x = x;
int q1y = y;
int q2x = x + 1;
int q2y = y;
int q3x = x;
int q3y = y - 1;
int q4x = x + 1;
int q4y = y - 1;
vertexes[k++] = new Point(q1x, 0, q1y);
vertexes[k++] = new Point(q2x, 0, q2y);
vertexes[k++] = new Point(q3x, 0, q3y);
vertexes[k++] = new Point(q3x, 0, q3y);
vertexes[k++] = new Point(q2x, 0, q2y);
vertexes[k++] = new Point(q4x, 0, q4y);
}
}[/CODE]
How would I go about implementing MIDI controls into Garry's Mod ?
How to move box from position A to B?
[cpp]
float gox,goy;
function GoHere(float x, float y)
{
gox = Math.sin(x)*10;
goy = Math.cos(y)*10;
}
...function here
while(true)
{
if(Math.abs(box.x)-Math.abs(gox)>5)
box.x+=gox;
if(Math.abs(box.y)-Math.abs(goy)>5)
box.y+=goy;
}
... end of function
[/cpp]
this makes it move somewhere random.
[QUOTE=rute;35304493]How to move box from position A to B?
float gox,goy;
function GoHere(float x, float y)
{
gox = Math.sin(x)*10;
goy = Math.cos(y)*10;
}
...function here
while(true)
{
if(Math.abs(box.x)-Math.abs(gox)>5)
box.x+=gox;
if(Math.abs(box.y)-Math.abs(goy)>5)
box.y+=goy;
}
... end of function
this makes it move somewhere random.[/QUOTE]
You can get the angle between them:
[code]
float angle = Math.atan2(go.y - box.y, go.x - box.x);
[/code]
then move like this:
[code]
box.x += Math.cos(angle) * 10.0f;
box.y += Math.sin(angle) * 10.0f;
[/code]
and you'll need something to stop it moving too far.
[QUOTE=farmatyr;35302595]Right now I'm using [B]GL_TRIANGLES[/B] for the mesh, but how can I change this to work with [B]GL_TRIANGLE_STRIP[/B]?[/QUOTE]
Don't bother. We're moving away from triangle strips. They aren't useful.
Don't duplicate vertices. This is what's really harmful, as it will reduce the effectiveness of vertex caching. Instead, only keep the unique vertices, and draw them by index using glDrawElements.
Indexed triangles w/ vertex cache optimization gives you the best performance in the general case. There might be something quicker for simple, square heightmapped terrain, but I'm not sure.
[QUOTE=ROBO_DONUT;35305996]Don't bother. We're moving away from triangle strips. They aren't useful.
Don't duplicate vertices. This is what's really harmful, as it will reduce the effectiveness of vertex caching. Instead, only keep the unique vertices, and draw them by index using glDrawElements.
Indexed triangles w/ vertex cache optimization gives you the best performance in the general case. There might be something quicker for simple, square heightmapped terrain, but I'm not sure.[/QUOTE]
Many thanks.
Will take a look at it in the morning.
[QUOTE=Elv02;35289640]So I've been trying to set up a Slick 2D project but I keep running into a problem when it comes to running the program.
I get the error:
Can't load IA 32-bit .dll on a AMD 64-bit platform
I know I'm importing the libraries correctly because when I do the same steps at my school on theri 32 bit platform it's fine. I know I have to use the x64 libraries on my laptop, and I am, but it still doesn't work...
However, when I try doing the same steps(except on my laptop I use the x64 libraries) on my laptop I get this error.
Any ideas?[/QUOTE]
Sorry if I'm late, but Slick2D ships with an incomplete version of the LWJGL natives. Download the 64-bit natives from [url]http://lwjgl.org[/url] and put them in the appropriate lib/natives folder and it should work.
I'm trying to create animations using for loops on my TI84.
[code]For(X,1,10)
Recall Pic 4
ClrDraw
RecallPic 5
ClrDraw
End[/code]
It goes extremely fast and flickers a lot though, is there a better way to do this?
[QUOTE=LaughingStock;35308158]I'm trying to create animations using for loops on my TI84.
[code]For(X,1,10)
Recall Pic 4
ClrDraw
RecallPic 5
ClrDraw
End[/code]
It goes extremely fast and flickers a lot though, is there a better way to do this?[/QUOTE]
Just do a series of the most intensive functions on your calculator? Maybe make another program called "DELAY" or something that does said function X number of times, based on the value of some variable you set before calling it. At least this is what I do.
[QUOTE=Rayjingstorm;35308259]Just do a series of the most intensive functions on your calculator? Maybe make another program called "DELAY" or something that does said function X number of times, based on the value of some variable you set before calling it. At least this is what I do.[/QUOTE]
I was thinking about keeping the frame on for a bit longer before clearing the screen but I'm not sure how to do that.
Sorry, you need to Log In to post a reply to this thread.