Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Avenging Dentist posted:

Let's be honest though. Probably 1% of the people in this thread are ones who will be bumping up against performance limits on any reasonable machine these days.

Depends on how bad of a programmer they are.

Adbot
ADBOT LOVES YOU

terminatusx
Jan 27, 2009

:megaman:Indie Game Dev and Bringer of the Apocalypse

Bob Morales posted:

Depends on how bad of a programmer they are.

So I think AD is saying then that 99% of the people posting here are bad programmers. what a jerk!!

terminatusx fucked around with this message at 21:04 on Jul 20, 2009

Tap
Apr 12, 2003

Note to self: Do not shove foreign objects in mouth.
Hi guys, I'm thinking of starting a project that I've been wanting to begin for a while now. I'm currently in the research phase, and I need some help / suggestions.

I've got basically zero game development experience, and some programming experience (I'm a PHP - I know - programmer for a small marketing company). What My vision is a mixture of class selection and art style of Team Fortress 2, and and the gameplay and look (2d) of Soldat.

Lets assume I have the art finished for the game, now I need to pull it all together and program the thing.

What I need to know is:

  1. Language to code the game in - I was thinking of maybe learning Python and using the PyGame library and doing the netcode in Python as well. I'm assuming Python is a strong enough language to handle this type of thing (basically a 2d side-scroller).
  2. Tools to use - what are some tools for debugging, testing, creating maps, etc.. that game developers consistently use. I figure some of these will be language dependent.

Thank you gentlemen.

hlfrk414
Dec 31, 2008

Tap posted:

What My vision is a mixture of class selection and art style of Team Fortress 2, and and the gameplay and look (2d) of Soldat.

Have you seen this?

Tap
Apr 12, 2003

Note to self: Do not shove foreign objects in mouth.

hlfrk414 posted:

Have you seen this?

HAHA, no I haven't.

Oh well, I actually have something fairly similar in mind, but not quite the same.

qwertyasdf
Nov 11, 2003

So is everyone using XAudio2 for sound now, or are people still sticking with DirectSound? I have been working in DX9 for graphics to avoid vista lockin.

qwertyasdf fucked around with this message at 06:04 on Jul 23, 2009

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
Having tried DirectSound and then switched to XAudio2, I can say that the latter is much less awful to deal with.

krysmopompas
Jan 17, 2004
hi

Addict posted:

So is everyone using XAudio2 for sound now, or are people still sticking with DirectSound? I have been working in DX9 for graphics to avoid vista lockin.
If you were starting from scratch, or wanting to do a serious revamp of what you've got, you'd be doing yourself a disservice by not going with it.

It's just built on top of dsound on XP, so it avoids any compatibility issues. These days, they've got XWMA support solid, fixed various bugs relating to pitch shifting and routing voices of different rates to one another and added the ability to change a source voice's format on the fly*; so it's a really, really solid api.

*Lean on the ability to change the source voice format, use a pool of voices and don't rely on create/destroysourcevoice. Creating and destroying a source stalls until the xaudio thread is idle, and will result in you having a very bad day.

xgalaxy
Jan 27, 2004
i write code
I used XAudio in XNA when it first came out and it was a horrible horrible experience. Unless XAudio2 is completely different or the C++ API is vastly superior to the XNA one then I will not touch it with a ten foot poll.

I deal with FMOD mostly these days. Can't really beat its cross platform capabilities.

xgalaxy fucked around with this message at 02:37 on Jul 24, 2009

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

krysmopompas posted:

Lean on the ability to change the source voice format, use a pool of voices and don't rely on create/destroysourcevoice. Creating and destroying a source stalls until the xaudio thread is idle, and will result in you having a very bad day.

This is probably a good idea and would resolve the issue I had where exiting the app before a sound effect stopped playing would cause a crash (because I destroyed the XAudio interface before I destroyed the voice) :barf:. Not that I ever work on my game anymore.

krysmopompas
Jan 17, 2004
hi

Avenging Dentist posted:

This is probably a good idea and would resolve the issue I had where exiting the app before a sound effect stopped playing would cause a crash (because I destroyed the XAudio interface before I destroyed the voice) :barf:. Not that I ever work on my game anymore.
You should always clean up all source voices and submix voices before killing the mastering voice and shutting down the device - in the debug libs it asserts if you kill a mastering voice without disconnecting all child submix or source voices attached to it.

Pooling isn't going to be a magic bullet. A new scenario you'll need to consider is a crash when the data you've sumitted via SubmitSourceBuffer is still in use, but you've deleted it.

DestroyVoice has been safe since it stalls until the audio thread is idle, making it ok to delete the source buffer data immediately afterwards. When you get pooling in you're not going to have that certainty and you'll have to hook into the callbacks to make absolutely sure that the buffer isn't being used any longer before you can nuke it.

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

krysmopompas posted:

You should always clean up all source voices and submix voices before killing the mastering voice and shutting down the device - in the debug libs it asserts if you kill a mastering voice without disconnecting all child submix or source voices attached to it.

It's been a "known bug" in my code for a long time, mostly because I was lazy and didn't want to manually keep track of the sound effects I was using, so I had the voice delete itself when it was done, and really, delete this; is almost always a bad idea. But since I can't/shouldn't be creating new voices for every effect, that method becomes irrelevant.

I'll probably fix this and then promptly forget about this project for another six months, though. I still haven't gotten spatial partitioning working on level geometry...

krysmopompas posted:

DestroyVoice has been safe since it stalls until the audio thread is idle, making it ok to delete the source buffer data immediately afterwards. When you get pooling in you're not going to have that certainty and you'll have to hook into the callbacks to make absolutely sure that the buffer isn't being used any longer before you can nuke it.

I'm already hooking callbacks, and it's one of the main reasons I switched to XAudio, since manually checking the status of sounds being played every N frames was stupid and annoying. Or something like that, I don't even remember what I did originally.

guenter
Dec 24, 2003
All I want out of life is to be a monkey of moderate intelligence who wears a suit. That's why I've decided to transfer to business school!
I was wondering how to deal with ground collision and jumping in a 2d platformer. My first approach, just to get something working, was to set a flag when the character was involved in a collision and the normal was in a vaguely up direction. When you jump, I clear the flag.

It worked alright enough with the exception that both physics and the character were both depending on this flag and, worse, that if you run off the edge of a platform you can jump in midair since you're still considered to be on the ground.

How should this be handled? I was thinking of having physics bodies store a list of contacts they were involved in on the last update and querying that but maybe I'm overlooking a better solution.

Smugdog Millionaire
Sep 14, 2002

8) Blame Icefrog
I'm not writing a game, I'm trying to write an app that will hang out minimized and let me press an F-button to shoot a chat macro into my Warcraft 3 game. There exists a program that does something like this (WC3Banlist) but it's lovely so I want to write my own.
I have absolutely no idea where to start when it comes to actually hooking into DirectX. What I've written so far (not too much) is in C#, so I hope it's possible in C#!

slovach
Oct 6, 2005
Lennie Fuckin' Briscoe

Free Bees posted:

I'm not writing a game, I'm trying to write an app that will hang out minimized and let me press an F-button to shoot a chat macro into my Warcraft 3 game. There exists a program that does something like this (WC3Banlist) but it's lovely so I want to write my own.
I have absolutely no idea where to start when it comes to actually hooking into DirectX. What I've written so far (not too much) is in C#, so I hope it's possible in C#!

You can probably do this simply enough by using either SendInput or PostMessage.

I don't see why you'd have to hook the renderer unless you want to draw over the game.

tyrelhill
Jul 30, 2006
Can't you just write a UI mod in Lua?

FSMC
Apr 27, 2003
I love to live this lie
What's the best way to implement a multi difficulty AI. Should I just have one AI, and have if statements throughout it, checking if it's hard or easy? I thought about subclassing but if I change something in the hard AI, I'm likely going to have to modify the easy AI as well.

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

Unparagoned posted:

What's the best way to implement a multi difficulty AI. Should I just have one AI, and have if statements throughout it, checking if it's hard or easy? I thought about subclassing but if I change something in the hard AI, I'm likely going to have to modify the easy AI as well.
Why not make what needs to be common between both AIs in the parent class? :confused: That's the point of inheritance; your child classes can take as much or as little of their descendents as you want.

shodanjr_gr
Nov 20, 2007

Unparagoned posted:

What's the best way to implement a multi difficulty AI. Should I just have one AI, and have if statements throughout it, checking if it's hard or easy? I thought about subclassing but if I change something in the hard AI, I'm likely going to have to modify the easy AI as well.

A multi difficulty AI implementation can be as simple as having the same AI code for all difficulties and only altering one parameter. If you have an algorithm that "explores" possible ways to kill the player/win a chess match/form a tic-tac-toe and then picks the optimal one, you can add a random chance for the algorithm to pick a suboptimal way instead. That chance can increase as the difficulty decreases so the AI can end up making wrong or random decisions. Another way to decrease the difficulty is to reduce how many "moves deep" can an AI look at (if we are thinking chess for instance). If it is an action game, and you have an AI opponent targeting the player with a ranged projectile, you can add an offset to the aim of that opponent. The offset can be zero for the hardest difficulty then gradually increase as the difficulty decreases, making the AI less accurate.

Steve Montago
Nov 13, 2004
Trentos the Freshmaker

guenter posted:

I was wondering how to deal with ground collision and jumping in a 2d platformer. My first approach, just to get something working, was to set a flag when the character was involved in a collision and the normal was in a vaguely up direction. When you jump, I clear the flag.

It worked alright enough with the exception that both physics and the character were both depending on this flag and, worse, that if you run off the edge of a platform you can jump in midair since you're still considered to be on the ground.

How should this be handled? I was thinking of having physics bodies store a list of contacts they were involved in on the last update and querying that but maybe I'm overlooking a better solution.


Not necessarily an optimum solution, but I heard 3D games use a method where they pick a series of points around the object and cast rays at the ground. This allows you to determine the average height an object is over uneven terrain, or whether the object is suspended in the air, or hanging partially over an object, etc. Ray collisions are very fast if you're using any sort of octree method. This should be fine for 2D games too.

You can store a position and velocity vector for each movable object. Each frame, you calculate a position vector for the object falling under gravity, add this to the vector for the object's motion in other directions, and then check the vector for collisions with the environment. If there's a collision, the portion of the vector after the collision point can be projected onto the collising surface. For example, an object moving across the ground will be falling under gravity, and constantly colliding with the ground, but it's vector will projected along the surface so it can still move left and right.

chips
Dec 25, 2004
Mein Führer! I can walk!

guenter posted:

I was wondering how to deal with ground collision and jumping in a 2d platformer. My first approach, just to get something working, was to set a flag when the character was involved in a collision and the normal was in a vaguely up direction. When you jump, I clear the flag.

It worked alright enough with the exception that both physics and the character were both depending on this flag and, worse, that if you run off the edge of a platform you can jump in midair since you're still considered to be on the ground.

How should this be handled? I was thinking of having physics bodies store a list of contacts they were involved in on the last update and querying that but maybe I'm overlooking a better solution.

Can't you just clear the collision flag every frame? So if, as Steve Montago says, you're continiously colliding with the ground, you can jump only if you're standing on a surface. I don't think there would be a problem with that, since you'll always be stationary and standing on the surface in the very next frame - depends how your collision system works in restoring the object I suppose. Taking the raycasting approach would fix that, though.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
You need to find out if the player is on ground every frame to separate ground control from air control as well, which essentially means every player movement frame will require knowing if the player is on the ground.

The easiest way is just doing a small collision trace straight down.

BizarroAzrael
Apr 6, 2006

"That must weigh heavily on your soul. Let me purge it for you."
I am working on (game design) portfolio work and would like to know if XNA is something worth looking into for making small games and prototypes? There's a career fair at the end of October I would like some new stuff for, is it a realistic aim to have anything worthwhile out of it in that time? I've used a number of languages in the past, though not to a high level, and not C# (I've used several other C derivatives though)

Would also like recommendations for books and websites.

newsomnuke
Feb 25, 2007

If you've only got 3 months, then it's not really the time to start learning a new language. Stick with what you know best. (Incidentally, I am also working manically on stuff to show at said expo).

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

BizarroAzrael posted:

I am working on (game design) portfolio work and would like to know if XNA is something worth looking into for making small games and prototypes? There's a career fair at the end of October I would like some new stuff for, is it a realistic aim to have anything worthwhile out of it in that time? I've used a number of languages in the past, though not to a high level, and not C# (I've used several other C derivatives though)

Would also like recommendations for books and websites.

I found C# to be a nice mix of familiar and refreshing, and I was able to be productive immediately. I came in with a mostly C background, with C++ and Java experience. I don't have any books to recommend, I just used MSDN and google.

If you feel like you have a good grasp of the other concepts involved in your game, go for it.

more falafel please
Feb 26, 2005

forums poster

3D math question:

I've got model-space scale/rotation/translation as vector3, quaternion, and vector3, respectively, for a parent bone in a skeleton, and bone-space scale/rotation/translation for a child bone, and I need to get model-space scale/rotation/translation for the child bone (as vector3 scale, quat rotation, vector3 trans). I don't know a lot about 3D math, so I'm kind of winging it:

- make 4x4 scale matrices out of the two scales
- make 4x4 rot matrices out of the two rotations
- make 4x4 trans matrices out of the two translations
- multiply ParentScaleMat * ParentRotMat * ParentTransMat to get ParentTM
- multiply ChildScaleMat * ChildRotMat * ChildTransMat to get ChildTM
- multiply ParentTM * ChildTM to get a 4x4 model-space basis for the child bone
- decompose into scale/rotation/translation using: http://www.ziggyware.com/readarticle.php?article_id=15

But I don't think it works right. Here are some of my numbers:
code:
ParentModelSpace scale: 1.00 1.00 1.00 rot: 0.29 0.56 0.39 -0.67 trans: 0.00 0.00 102.42
ChildBoneSpace scale: 1.00 1.00 1.00 rot: -0.06 0.16 -0.02 -0.98 trans: 8.56 -0.00 -0.78
ChildModelSpace scale: 1.00 1.00 1.00 rot: 0.17 0.64 0.45 0.60 trans: -24.30 -12.23 95.46
Is there a way to do what I want without converting everything to matrices and doing all of the decomposition? Or is there a better way to do the decomposition?

TSDK
Nov 24, 2003

I got a wooden uploading this one
Yes, there is another way without going through the decomposition route. For composite transformations like the ones you've got, rotations (and I'm fairly certain scales as well) can just be concatenated, ignoring the influence of the other transforms.

So the rotation for the child in model space is just the product of all of the rotations from the bone down through the hierarchy to the root. Likewise with the scales (if I remember rightly).

For translations, you have to form a complete matrix from all of the rotation, scale, translation parts of all of the bones down to the root. You then run the vector [0,0,0] through the matrix, and that's the bone's location in model space (or just pull the appropriate row/column out of the matrix, which amounts to the same thing).

TSDK
Nov 24, 2003

I got a wooden uploading this one
Double post!

more falafel please posted:

- multiply ParentScaleMat * ParentRotMat * ParentTransMat to get ParentTM
- multiply ChildScaleMat * ChildRotMat * ChildTransMat to get ChildTM
- multiply ParentTM * ChildTM to get a 4x4 model-space basis for the child bone
I'd double check this as well. The way you've written that looks like you're constructing ParentTM and ChildTM ordered as if you're using DirectX row matrices, and then combining them with an ordering that looks like you're using OpenGL column matrices. Which would be bad.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
You're looking for N where P * N = C

You're solving it as P * C, the correct solution is P' * C

(In other words, concatenate the child to the INVERSE of the parent's matrix to get its location in the parent's space)


Inverting a translate = Negate
Inverting a scale = Reciprocal
Inverting a quaternion rotation = Negate the X, Y, and Z, or negate the W


If you want to do it with matrices, I'd strongly recommend switching to 3x4's as they're less error-prone. If you're using SSE3 or vertex shaders to do transformation then you want them in 3x4 anyway.


Also scale fucks everything up because the correct order depends entirely on whether the scale is before or after the translate.

OneEightHundred fucked around with this message at 22:05 on Aug 4, 2009

more falafel please
Feb 26, 2005

forums poster

OneEightHundred posted:

You're looking for N where P * N = C

You're solving it as P * C, the correct solution is P' * C

(In other words, concatenate the child to the INVERSE of the parent's matrix to get its location in the parent's space)


Inverting a translate = Negate
Inverting a scale = Reciprocal
Inverting a quaternion rotation = Negate the X, Y, and Z, or negate the W


If you want to do it with matrices, I'd strongly recommend switching to 3x4's as they're less error-prone. If you're using SSE3 or vertex shaders to do transformation then you want them in 3x4 anyway.


Also scale fucks everything up because the correct order depends entirely on whether the scale is before or after the translate.

No, I've got the child in the parent's space already, so I'm looking for C. Sorry if I didn't make that clear.

TSDK posted:

Double post!

I'd double check this as well. The way you've written that looks like you're constructing ParentTM and ChildTM ordered as if you're using DirectX row matrices, and then combining them with an ordering that looks like you're using OpenGL column matrices. Which would be bad.

Ugh, of course that matters -- which means my decomposition math is all wrong because I got the math from a website that I assume is doing DirectX, but this is another coordinate system altogether (it's some hosed up left-hand inverted Y thing)

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

more falafel please posted:

No, I've got the child in the parent's space already, so I'm looking for C. Sorry if I didn't make that clear.
Just concatenate the transformations to the parent's final transformation then.

Use quaternion multiplication to transform the rotation.

quote:

Ugh, of course that matters -- which means my decomposition math is all wrong because I got the math from a website that I assume is doing DirectX, but this is another coordinate system altogether (it's some hosed up left-hand inverted Y thing)
That doesn't matter. Row and column major matrices are interchangable for processing, as long as you keep them consistent and know how matrix math works so you don't gently caress the order up.

It only matters for the final processing layout, which is going to vary based on CPU capabilities anyway.

(Incidentally, loving the order up is the most common reason results get hosed)

TSDK
Nov 24, 2003

I got a wooden uploading this one

OneEightHundred posted:

That doesn't matter. Row and column major matrices are interchangable for processing, as long as you keep them consistent and know how matrix math works so you don't gently caress the order up.
The in-memory layout is identical for both, so in that respect it doesn't matter, but when you're composing matrices like this it matters a great deal because it reverses the order in which you do the multiplcations - and that's pretty fundamental.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
Of course, my point though is that any operations you do with row-major matrices can be done with column-major ones by just changing the order of operations. It's not like you're "stuck" with the "wrong" type of matrix at any given point. The only time it matters which you are using is when you're actually transforming the verts, because that's when you need to worry about SIMD-friendliness.

more falafel please
Feb 26, 2005

forums poster

There were two problems:

One, I was multiplying parent and child in the wrong order, and two, I'm pretty sure I wasn't decomposing the result right. I did find a class in the codebase that has a 4x4 matrix ctor (with no scale component) and stores rotation and translation. So I used that and did the scale calculation manually to simplify the code, and by gum it worked.

Thanks.

NeerWas
Dec 13, 2004

Everyday I'm shufflin'.

NeerWas fucked around with this message at 21:47 on Aug 9, 2023

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
From the first Google result (Wikipedia):

quote:

In Windows Vista, DirectPlay has been deprecated and DirectPlay Voice and DirectPlay's NAT Helper have been removed.

NeerWas
Dec 13, 2004

Everyday I'm shufflin'.

NeerWas fucked around with this message at 21:47 on Aug 9, 2023

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

Sindow posted:

Yes, I have read and heard that many times but just because it's on Wikipedia doesn't mean it's true :) I was wondering if anyone had actually tried it out and whether DirectPlay will still work without the NAT Traversal

Did you notice how Wikipedia also linked to MSDN which says the exact same thing?

NeerWas
Dec 13, 2004

Everyday I'm shufflin'.

NeerWas fucked around with this message at 21:47 on Aug 9, 2023

Adbot
ADBOT LOVES YOU

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
Honestly, if Microsoft says "don't use this anymore", it's probably not a good idea to use it if you want people to be able to use your software a few years from now. Basically anything in DirectX except for Direct3D/Direct Input is frowned upon these days (unless you count stuff like XAudio2). Some of them still work, but there really aren't guarantees that they'll continue to do so.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply