|
Princess Kakorin posted:It makes sense, I'll throw something together when I get home. If it does work, I wish the blogs/tutorials I've read would have stated that in the begining. Well, the good news is that it kinda works. But now, when I try to make a Reader/Writer class, it freaks the gently caress out and crashes the IDE. I've gone back through and made a program from scratch and followed tutorials exactly, but this stuff apparently doesn't work. gently caress XML and having it "being easy to implement with XNA!" Princess Kakorin fucked around with this message at 02:19 on May 20, 2011 |
# ? May 19, 2011 20:22 |
|
|
# ? May 26, 2024 20:38 |
|
Does anyone have any experience with both pymunk and/or pybox2d? I'm looking into making a 2D physics-enabled game in Python using PyGame and I'm trying to figure out which library is easier/faster/supported/more fully featured.
|
# ? May 20, 2011 21:05 |
|
Princess Kakorin posted:Anybody know what the deal is when you get this error when _trying_ to use XML?
|
# ? May 20, 2011 23:41 |
|
I'm working on a Marble Madness clone using OpenGL + SDL. Basically I have a grid with varying heights and a ball which you control with the arrow keys and you can use the mouse to zoom in/out and rotate the view around the center of the grid. My question is concerning the movement of the ball. If I press up or down / left or right the ball will move along the z or x axis (see mspaint drawing), but I'd like it to move along the axes drawn in green. I guess I have to use the camara position somehow to calculate the new axes which I want to use for the ball movement but my stupid brain can't figure it out. I've tried some stuff with no luck. Any tips or guide?
|
# ? May 22, 2011 00:43 |
|
If the camera is always fixed then you can hack it by just replacing the down input with a 45 degree motion output. Otherwise you'll have to do a little trig involving rotating the input to the camera's view vector. The way I do it in my game is to build a euler angle (pitch yaw roll) and then convert that into a matrix (that function is part of my math library) and then your new velocity is m * v where m is that matrix and v is the old velocity. Does that make sense?
|
# ? May 22, 2011 01:01 |
|
I think I get it. So, let's say an arrow key is pressed so I set the velocity v to v = (vx,0,vz) (the ball rolls on the y = 0 plane). Then I'd use the rotation of the camera (I have this stored) to generate a rotation matrix (r) and I'd multiply them to get the actual velocity relative to the camera.
|
# ? May 22, 2011 01:09 |
|
Yep, exactly.
|
# ? May 22, 2011 01:10 |
|
Great, I'll try this later and hopefully won't gently caress it up. Thanks!
|
# ? May 22, 2011 01:16 |
|
Has anyone implemented rewind-the-world synchronization for a real-time online game? In Valve's model, they record what they call a snapshot on each frame, which I take to be a record of the entire game state. Then when they want to update a player's state, they send the delta between the snapshot that the player last confirmed receipt of and the current snapshot. The part that I'm wondering about is snapshot creation and delta compression. Are they serializing the entire game world and then finding the delta between the two serializations, or are they making some sort of copy of the world and then creating a delta that is a set of steps for going from one state to the next? Are there other implementations?
|
# ? May 22, 2011 15:33 |
|
Twernmilt posted:The part that I'm wondering about is snapshot creation and delta compression. Are they serializing the entire game world and then finding the delta between the two serializations, or are they making some sort of copy of the world and then creating a delta that is a set of steps for going from one state to the next? Are there other implementations? If you use immutable data structures, making a "copy" of an object is a no-op, and making a "modified copy" of the object means you make a value which shares a lot of substructure with a preexisting value. Then you can look at two values and see what subtrees of the data have changed by comparing pointers or version numbers or some other technique. So you don't serialize or traverse the entire state of the game, you just traverse proportionally to the size of the difference. Another implementation is to just make a list of changes. Both can be useful.
|
# ? May 22, 2011 15:47 |
|
Source stores only player positions and model animation information. They have a rotating vector of the last x frames. They do no delta compressions but the structure is not so big anyway. When they want to know what a player was shooting at x seconds ago they find the appropriate entry and rebuild the model data for that past frame.
|
# ? May 22, 2011 15:57 |
|
http://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking posted:Game data is compressed using delta compression to reduce network load. That means the server doesn't send a full world snapshot each time, but rather only changes (a delta snapshot) that happened since the last acknowledged update. With each packet sent between the client and server, acknowledge numbers are attached to keep track of their data flow. Usually full (non-delta) snapshots are only sent when a game starts or a client suffers from heavy packet loss for a couple of seconds. Clients can request a full snapshot manually with the cl_fullupdate command. Is this wrong?
|
# ? May 22, 2011 16:52 |
|
That's talking about updating entities over the network. I thought you were talking about storing player past positions for purposes of lag compensation. Lag compensation happens completely on the server with no network traffic involved. It's really just a modification of the raytrace routine when someone shoots a gun.
|
# ? May 22, 2011 19:56 |
|
Oh, I'm talking about keeping all of the players in sync with the game world. Sorry for the confusion.
|
# ? May 23, 2011 00:56 |
|
I've been working on a 2D graphics library in C# that will work well with OpenTK. I'm fine tuning the sprite batching, but the cool thing about mine is how it handles drawing the sprites. The idea is to make calls that look like this. code:
http://mannagum.codeplex.com/releases/view/66880 -- release files There is documentation, and the sampler project contains a few examples (switch screens by pressing 1-3) Thanks.
|
# ? May 23, 2011 02:47 |
|
PnP Bios posted:I've been working on a 2D graphics library in C# that will work well with OpenTK. I'm fine tuning the sprite batching, but the cool thing about mine is how it handles drawing the sprites. I really like this idea instead of having a draw method that is overwritten like 7 times and takes anywhere from 1 to 9 parameters.
|
# ? May 23, 2011 15:27 |
|
HolaMundo posted:I'm working on a Marble Madness clone using OpenGL + SDL. Basically I have a grid with varying heights and a ball which you control with the arrow keys and you can use the mouse to zoom in/out and rotate the view around the center of the grid. I think that the simplest would be some vector math. If you want to move it "down", simply create a vector pointing it in the direction you need it to move, normalize it and scale it by how much you want it to move. This has the added bonus of being able to add movement in any direction if you decide to add mouse or gamepad input. It's been ages since I've done OpenGL so I don't know what it's structures are, but in XNA it would be something like: code:
|
# ? May 23, 2011 18:16 |
|
poemdexter posted:I really like this idea instead of having a draw method that is overwritten like 7 times and takes anywhere from 1 to 9 parameters. The only problem I can see is that it's creating a lot of objects so the garbage collector is going to be working overtime. But I figure anybody who is worrying about cache misses would be writing their game in C already. I would definitely appreciate a second set of eyes to see if I'm missing anything obvious.
|
# ? May 23, 2011 19:10 |
|
The Saddest Robot posted:I think that the simplest would be some vector math. If you want to move it "down", simply create a vector pointing it in the direction you need it to move, normalize it and scale it by how much you want it to move. This has the added bonus of being able to add movement in any direction if you decide to add mouse or gamepad input. The problem was I didn't actually knew which direction was "down". I solved this by doing what Vino posted and it's working. Thanks anyways.
|
# ? May 23, 2011 19:24 |
|
PnP Bios posted:The only problem I can see is that it's creating a lot of objects so the garbage collector is going to be working overtime. Is there any reason you have to copy the entire object every time you do a transformation instead of just transforming in place and returning a reference? For example the code code:
code:
|
# ? May 23, 2011 21:15 |
|
PDP-1 posted:Is there any reason you have to copy the entire object every time you do a transformation instead of just transforming in place and returning a reference? For example the code The question then becomes, how do you know which is the last call? No drawing actually takes place during the draw command. It just queues everything up, and all the magic happens in EndSpriteBatch() One option I do see is only making one clone. You don't want to pollute the original sprite. I will play around with this idea tonight and see if it works. Thanks for the feedback!
|
# ? May 23, 2011 22:20 |
|
PnP Bios posted:The question then becomes, how do you know which is the last call? This sorta works... Just not if you plan on retaining the state after making the call. You'll need to some how mark it back as not a clone.
|
# ? May 23, 2011 22:51 |
|
PnP Bios posted:The only problem I can see is that it's creating a lot of objects so the garbage collector is going to be working overtime. Garbage collection issues and cache misses are completely different set of performance issues. Just because someone is using C# doesn't mean they aren't concerned with performance. Especially where the garbage collector is concerned. I would not use a library, especially one designed to be used in a tight drawing loop, that is willy nilly creating tons of garbage. I would find a way to either not create the garbage in the first place, or find a way to recycle it so the gc doesn't kick in.
|
# ? May 25, 2011 01:48 |
|
PnP Bios posted:The only problem I can see is that it's creating a lot of objects so the garbage collector is going to be working overtime. You could have a different object that gets instantiated and returned when you invoke any of the transforms on a sprite and then send that through the pipeline. So calling my_sprite.rotate(1.7) would create and return a new object that is just like the original sprite except it handles the transformations by returning self instead of a new object. That way you're only creating one new object for every set of transformations. I don't know C#, so this may not be syntactically correct, but something like this: code:
Twernmilt fucked around with this message at 16:51 on May 25, 2011 |
# ? May 25, 2011 16:17 |
|
I think you could even use a static transformedsprite there, rather than instantiating once each time, so long as there's no circumstance in which you pass two transforming sprites to the same function. And it even just naturally works with the "pre_transformed_sprite = sprite.Rotate(n).Translate(x,y);" idea too. (If you want to be a bit crazy about it and allow for passing a few transforming sprites at a time, you could use a little static array of say 8 transformedsprite objects and cycle which one you're using each time you call regular_sprite.AnyTransform)
|
# ? May 25, 2011 17:15 |
|
Or you could just drop the fancy interface and just make a Draw(Sprite, float, float, float, float, float) function so all the parameters are passed on the stack. In C++ you could design a class with that kind of interface and it would have zero performance overhead. I don't know C# well enough to say otherwise but my gut feeling is that you can't, and if you're adding any kind of object creation/gc overhead just so the programmers can use a slightly fancier interface that's a bad call.
|
# ? May 25, 2011 17:21 |
|
HolaMundo posted:I'm working on a Marble Madness clone using OpenGL + SDL. Basically I have a grid with varying heights and a ball which you control with the arrow keys and you can use the mouse to zoom in/out and rotate the view around the center of the grid. What you're wanting to do, technically speaking, is project your controls into "marble-space" (ie. that xz-plane) Short-form answer - use dot products. Long-form answer - (I'm doing this without pen and paper so it may not be exactly correct :o ) Say you know each of the 4 'controller' directions, ie. each is a vector in screen-space. If you know your camera orientation, you can find these in world-space. So in worldspace you'd have {joyUp, joyDown, joyLeft, joyRight} The xz-plane is just another coordinate system (with an irrelevant y-axis) you're projecting to. Say it's 3 vectors, {marbleX, marbleY, marbleZ} So to find the projected vector of 'up' just do this newX,Y, and Z are scalars - joy? and marble? are vectors newX = joyUp . marbleX newY = 0 newZ = joyUp . marbleZ finalVec = newX * marbleX + newY * marbleY + newZ * marbleZ and you'd probably want to re-normalize it as well. edit: this is all based on a very important concept to realize about dot products - they're related to the cosine between angles, such that two vectors that are orthogonal/perpendicular will have a dot product of zero, and if they're parallel they have a dot product of 1. More or less, a dot product tells you how well two vectors 'align' because the angle between them is 0 at perfect alignment, cos(0) = 1, and all that jazz. edit of edit: Btw this assumes your vectors are all unit length to begin with. Goreld fucked around with this message at 17:47 on May 25, 2011 |
# ? May 25, 2011 17:43 |
|
Working with RenderTargets, is there any way to switch between them and not lose everything in the old one when you do?
|
# ? May 25, 2011 23:47 |
|
Goons, what 3D modeling program would you recommend off the top of your head? I have some experience with Maya and Blender and I want to just pick a program and get decent with it, I just want to make sure I invest time in a program that has decent longevity and compatibility.
|
# ? May 26, 2011 00:36 |
|
If you're not doing animation and you like manipulating the bare polygons to make low-res meshes or simple mockups, SILO. I loving love Silo, it's easy to use and cheap. The devs aren't really supporting it these days though. If you're not doing animation and you want a powerful tool and you don't mind the learning curve, Zbrush. Otherwise, Maya.
|
# ? May 26, 2011 05:22 |
|
I like wings3d. It's quite easy to learn by exploring, since all operations are in modal menus.
|
# ? May 26, 2011 11:39 |
|
Another game networking question. We want to keep the game logic seperate from the networking logic So our dedicated server will create 2 threads, a networking thread that handles incoming and outgoing messages and a game logic thread that will handle each tick of game and updating objects in the game. The two will talk to each other via event handlers/delegates. This is all XNA/C# with the libgren lib for networking (not using the built in networking since we aren't doing GFWL). My question is this: Is this the best way to do a dedicated server? We've been looking for dedicated server architecture examples or tutorials or blog posts or something, but we're coming up short.
|
# ? May 26, 2011 17:44 |
|
poemdexter posted:The two will talk to each other via event handlers/delegates. I don't see that working very well. Not only would you need locks everywhere but you would need to code your entire game engine with the assumption that state can change at any given time which is pretty much impossible. Look into using buffered states or message queues instead.
|
# ? May 26, 2011 18:59 |
|
Anybody here played around with the Bullet physics library? I was asking some of the Irrlicht people for examples of collision detection for making sure entities don't fall through the game world but do honor gravity, and pretty much they steered me right to that. I assume it's because of the Irrlicht bindings that come with it. The response seemed a little at the time but I guess it makes sense; I'd probably end up bringing in physics in some fashion so I might as well grab the bull by the horns. It did solve my problem in just a few lines of code. But I wonder if I'm going to get into a quagmire when I try to do stuff like check if stuff is successfully smacking down other stuff, projectiles, or generally other stuff that might happen in a game I haven't tried to do.
|
# ? May 26, 2011 19:18 |
|
Paniolo posted:I don't see that working very well. Not only would you need locks everywhere but you would need to code your entire game engine with the assumption that state can change at any given time which is pretty much impossible. Look into using buffered states or message queues instead. each thread would use events to fill each other's message queue. How's that?
|
# ? May 26, 2011 19:26 |
|
Rocko Bonaparte posted:Anybody here played around with the Bullet physics library? I was asking some of the Irrlicht people for examples of collision detection for making sure entities don't fall through the game world but do honor gravity, and pretty much they steered me right to that. I assume it's because of the Irrlicht bindings that come with it. The response seemed a little at the time but I guess it makes sense; I'd probably end up bringing in physics in some fashion so I might as well grab the bull by the horns. It did solve my problem in just a few lines of code. But I wonder if I'm going to get into a quagmire when I try to do stuff like check if stuff is successfully smacking down other stuff, projectiles, or generally other stuff that might happen in a game I haven't tried to do. Pretty much the only documentation is in the demo code (as well as API docs which is pretty good), which thankfully it has a lot of. I remember checking collisions between two objects required me creating a struct inheriting another provided by Bullet and passing that in some function. I thought it was a little ugly but it did tell me if the objects were colliding. General idea is easy to wrap your head around but Bullet does things that I wasn't used to. Then again, I never really started extensively coding in C++ until recently.
|
# ? May 26, 2011 20:14 |
|
Paniolo posted:I don't see that working very well. Not only would you need locks everywhere but you would need to code your entire game engine with the assumption that state can change at any given time which is pretty much impossible. Look into using buffered states or message queues instead. You don't need to lock anything if you use message passing to have the network and game logic communicate and avoid mutating those messages, which isn't difficult. It sounds like that's what he's doing with handlers. poemdexter: If you find any good guides, be sure to post them here. I've been pretty much winging it because I can't find any solid examples. I've been piecing things together from Valve's wiki about the networking infrastructure in Source and blogs.
|
# ? May 26, 2011 20:28 |
|
poemdexter posted:Is this the best way to do a dedicated server? We've been looking for dedicated server architecture examples or tutorials or blog posts or something, but we're coming up short. Integration of networking with the gamecode has actually been getting tighter because if there's any place to classify how important it is that clients are aware of certain things happening in the world, it's the gamecode. Bungie made a publication about Halo 3's networking containing some useful insights and photos of a very large beard. You obviously don't need to State/event architectures work really well and you should probably look in to them. To summarize their architecture a bit, everything in the world has state. Information about state that clients need to know about to display them properly is guaranteed to be updated eventually. Objects are assigned priority, the highest-priority objects that fit into a packet are sent every frame, objects can also have a value which causes their priority to increase by an amount every time they're not sent. Objects that don't receive updates get predicted instead. i.e. if a grenade is flying through the air, and the client doesn't get an update for it in a frame, it guesses that it continued flying. Most Quake series games use delta compression, which is essentially predicting that all objects are identical to their state in the previous frame. Events can be handled as objects with one state and if they can't be sent by the time they expire, they are not sent at all. That's pretty much your modern networked real-time game in a nutshell. OneEightHundred fucked around with this message at 21:02 on May 26, 2011 |
# ? May 26, 2011 20:48 |
|
OneEightHundred posted:What kind of game is this? It's multiplayer asteroids with a dedicated server and clients that act like dummy terminals sending keyboard inputs to the server. I understand the architecture of how things work. I'm actually just looking for implementation guidelines/best practices. Server with 2 threads? Server with no threads and 2 objects inside a loop? Event handlers for recieving messages passing messages between objects or just straight up call a updateGame() method passing what I'm parsing from messages?
|
# ? May 26, 2011 21:08 |
|
|
# ? May 26, 2024 20:38 |
|
Twernmilt posted:You don't need to lock anything if you use message passing to have the network and game logic communicate and avoid mutating those messages, which isn't difficult. It sounds like that's what he's doing with handlers. I saw that wiki as well! I understand the why for networking, just need a little guidance on the how.
|
# ? May 26, 2011 21:09 |