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
Ferg
May 6, 2007

Lipstick Apathy

HB posted:

It's a system architecture focused on game development. It's more comparable to something like SDL rather than a game engine.
Now I'm all confused. I was under the impression that SDL was more of a DirectX-style thing for multiple platforms?

Adbot
ADBOT LOVES YOU

PerOlus
Jan 26, 2003

We'r even, seņor!
SDL has stuff that handles sound and control-input as well.

I had viewed XNA more as "simply" a good IDE for game development, but considering that it seems to have easy tools for sound and graphics, I guess it could be seen as related to SDL.

I'm a fairly experienced C++ programmer (with visual studios), are there any good resources for learning C# going from that? I have googled etc, but you guys might have better tips.

Sex Bumbo
Aug 14, 2004

PerOlus posted:

I'm a fairly experienced C++ programmer (with visual studios), are there any good resources for learning C# going from that? I have googled etc, but you guys might have better tips.

I went from mainly C++ to C#, it wasn't too difficult really. You could probably read most C# programs and be able to figure out what's going on (unlike, say F#).

I wouldn't bother picking up a book, good programming practices are easily translatable. Some important things to learn would be:
properties
foreach
.NET Containers
generics
delegates
difference between structs and classes
don't use pointers because they're almost always unnecessary

Learning the basics wouldn't take long at all for an experienced C++ programmer. Then there's some fun things like attributes and reflection but you can still make lots of cool stuff if you never bothered learning about them.

Sex Bumbo fucked around with this message at 21:52 on Dec 5, 2007

Citizen Erased
Mar 20, 2004

Wash Me Away

tyrelhill posted:

Use the view matrix. I'm a little rusty with DirectX since I've been using OpenGL a lot lately, but I'm pretty sure this is correct.

code:
D3DXMATRIX mat;
D3DXMatrixIdentity(&mat);
D3DXMatrixRotationAxis(&mat, &AxisToRotateAround, TheAngle);
D3DXMatrixTranslation(&mat, TranslationX, TranslationY, TranslationZ);
YourD3DDevicePointer->SetTransform(D3DTS_VIEW, &mat);
Then just draw your object at the origin. Make sure if you're drawing other objects to set the view matrix back to an identity.

This is my opinion but never use Euler Angles for stuff like this, they get really messy after you move them around a lot.

Unfortunatly one of the things I need to do with the geometry after I've transformed it is export it to an .obj file. Because of that, I can't just transform by the view matrix at draw time or such, I physically need to change the x, y, z values of each vertex in the ring. Anyone got any clue on how to do so?

rrenna
Jan 10, 2006

Don't know if anyone's interested but me and two other guys made a space shooter called "DKP: Zero" a prequel to a game that doesn't really exsist. We did it for a final project for college but I've put it on the net and put some world rankings up for a few friends who enjoy playing it.

Hopefully someone here can appreciate it, it was mostly a learning process to get a feel on the ins and outs of XNA and our next game will be a little more professional.

The package of things you need has the wrong version of DirectX bundled with it, you need 9.0c november refresh but my friend bundled an earlier revision by accident...

https://www.dkp-zero.com

Sex Bumbo
Aug 14, 2004

Citizen Erased posted:

Unfortunatly one of the things I need to do with the geometry after I've transformed it is export it to an .obj file. Because of that, I can't just transform by the view matrix at draw time or such, I physically need to change the x, y, z values of each vertex in the ring. Anyone got any clue on how to do so?

You want to rotate verts so that they face an arbitrary direction and then translate in that direction right? You have the rotation done too? Can't you just add the direction to all the verts?

tyrelhill
Jul 30, 2006

Citizen Erased posted:

Unfortunatly one of the things I need to do with the geometry after I've transformed it is export it to an .obj file. Because of that, I can't just transform by the view matrix at draw time or such, I physically need to change the x, y, z values of each vertex in the ring. Anyone got any clue on how to do so?

Do the math on paper then, its not that complicated.

TSDK
Nov 24, 2003

I got a wooden uploading this one

Citizen Erased posted:

I think this has been addressed twice now in this thread but I can't wrap my head around it in the context of my application:

I have a ring of verticies that are at an arbritrary position in local 3D space which I want to rotate to face an arbritrary direction and then translate in that direction by n units.
Using row vectors:

p := sum of all positions / num verts (the origin of the ring in other words)
q := position to look at
T-p := Translation matrix along vector -p
Tn := Translation directly 'up', n units
R := Rotation matrix to 'look at' q-p, from the origin
Tp := Translation matrix along vector p

Transform for each vertex

p' := p.T-p.Tn.R.Tp

The only pain in the rear end is if the verts start off pre-rotated and you need to undo that rotation as well (which you can add here: ...T-p.S-1.Tn... ). And also keeping a consistent 'up' direction when generating your look at matrix.

SheriffHippo
Jul 18, 2002
What is a good size for a CTF or Deathamtch map?

Possible examples: UT99's Coret, Team Fortress's 2Fort, or any Counter Strike map.

I am looking for units in terms of a player's height when compared to width and length of the map. (Something like Unreal Units)

samiamwork
Dec 23, 2006
This has been bugging me for a long time now:

GLSL allows me to, basically, assign whatever rgba colors I want to a pixel on a poly. But the blending of that pixel with whatever is already in the framebuffer seems to be determined by fixed-function junk (typically the standard alpha blend). Is this correct? Is there any way to have polys blend with multiply, screen, or any other blending I might want? I know I openGL has provided some minimal control over the blending function but nothing that would get me things like multiply or other photoshop-like blending modes, let alone arbitrary functions.

I really hope that made sense and that this is possible and I've just totally misunderstood things.

krysmopompas
Jan 17, 2004
hi

samiamwork posted:

I really hope that made sense and that this is possible and I've just totally misunderstood things.
You're basically talking about what can be achieved via render to texture, first using it as the render target, then reusing the texture to apply your fancy blend mode to a final render target. The blend mode applied to the render target is most unfortunately fixed-function for the foreseeable future.

krysmopompas fucked around with this message at 04:00 on Dec 7, 2007

Doc Block
Apr 15, 2003
Fun Shoe
Yeah, just use framebuffer objects. They're similar to the render-to-texture extension and pbuffers, but are faster and easier to use.

So, basically, you set up an FBO with appropriately sized textures (one for the background layer, one for the foreground) attached as color attachments. You render whatever into the background "layer", then render something into the foreground "layer". Then you bind to FBO 0 (the default framebuffer provided by the window system), bind a shader with the foreground and background "layers" as texture samplers, and render a quad that covers the screen. The shader then performs whatever blending operation you want.

This is basically how post-processing effects in games are done.

samiamwork
Dec 23, 2006

kewlpc posted:

Yeah, just use framebuffer objects. They're similar to the render-to-texture extension and pbuffers, but are faster and easier to use.

drat. I was afraid of that. I was really hoping to avoid using FBOs, but if that's what I have to use, that's what I'll use.

Thanks guys.

edit: Typo.

samiamwork fucked around with this message at 19:39 on Dec 7, 2007

Doc Block
Apr 15, 2003
Fun Shoe
What's wrong with FBOs?

Citizen Erased
Mar 20, 2004

Wash Me Away

Stanlo posted:

You want to rotate verts so that they face an arbitrary direction and then translate in that direction right? You have the rotation done too? Can't you just add the direction to all the verts?

Someone else just suggested to me that if I have a vector for the direction I want to move in before the rotation (say (0,1,0)) and I rotate this with the verticies, I could just add this vector * the amount I want to move to the vertcies and it should move them in the direction I want after the rotation. I wont be able to try this for a while, does this sound like it would work though?

haveblue
Aug 15, 2005



Toilet Rascal

samiamwork posted:

drat. I was afraid of that. I was really hoping to avoid using FBOs, but if that's what I have to use, that's what I'll used.

Thanks guys.

Sorry, that's the only way to do it at all. No current 3D API allows reading directly from the render target.

quote:

Someone else just suggested to me that if I have a vector for the direction I want to move in before the rotation (say (0,1,0)) and I rotate this with the verticies, I could just add this vector * the amount I want to move to the vertcies and it should move them in the direction I want after the rotation. I wont be able to try this for a while, does this sound like it would work though?

Yes, but you'll want to periodically regenerate the direction vector from scratch to avoid error accumulation. In general, you don't want to perform endless stacking transformations on the same data when using floats- it's better to have an unchanging base value which is transformed into a current value each frame it is needed.

haveblue fucked around with this message at 17:25 on Dec 7, 2007

Avenging Dentist
Oct 1, 2005

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

zigb posted:

code:
// Instead of defining flags like:
#define FLAG1 = 1 
#define FLAG2 = 2
#define FLAG3 = 4
#define FLAG4 = 8
... 
// They use left-shifts to do the same thing, in a much more readable (to me) manner: 
#define FLAG1 = 1<<0
#define FLAG2 = 1<<1
#define FLAG3 = 1<<2
...

Too bad they're still using #defines. :barf:

samiamwork
Dec 23, 2006

kewlpc posted:

What's wrong with FBOs?

Nothing's wrong with them. Even if I had my magical programmable blending I'd probably have to use them anyway. I was mostly just confirming my suspicions.

forelle
Oct 9, 2004

Two fine trout
Nap Ghost

samiamwork posted:

drat. I was afraid of that. I was really hoping to avoid using FBOs, but if that's what I have to use, that's what I'll use.

Thanks guys.

edit: Typo.

Strange this should come up. I'm facing OpenGL fixed function blending woes right now myself.

The imaging extensions add a few more blending modes (min, max, and so on) which might help.

But the one that is really getting me, does anyone know of an efficient, NVidia compatible way, to perform a channel swizzle (copy A to R for example) that doesn't involve multiple buffer ping-ponging or using the color matrix extensions (which would be fine, but is a software only path even on Quadros)?

What I really want is

1. Render Something with blending
2. Render the same thing in a different mode that will copy the result R from step one into A
3. Render something else blending using the new A value.

Something like glCopyChannels(GL_RED,GL_GREEN, GL_BLUE, GL_RED) (which doesn't exists alas)

For efficiencies sake I really need to do this using the fixed function blending (or other) pipeline.

Doc Block
Apr 15, 2003
Fun Shoe
Again, use FBOs. Set up an FBO with two color attachments. Render Step 1 into color attachment 0. Switch to color attachment 1 and, using color attachment 0 as a texture, render a quad that covers the screen using a shader that just puts the red channel into the alpha channel.

Then, when rendering Step 3, use color attachment 1 as one of the textures, with a shader that uses color attachment 1's alpha as its own.

But that's the complicated way of doing it. The simpler way would be to set up an FBO with only one color attachment, render Step 1 into it, then switch back to the default FBO, and render Step 3 using a shader that takes in your FBO's color attachment as a texture and uses its Red channel as alpha.

Either method should be faster than the way you outlined since you'll only be rendering the scene from Step 1 once instead of twice.

Also, you do know that on modern hardware the fixed-function pipeline is just emulated, right? So using a well-optimized shader shouldn't be any slower than the "fixed-function" shaders that the driver loads. In fact, in either the upcoming version of OpenGL or the one after it all the fixed-function emulation is going to be removed.

forelle
Oct 9, 2004

Two fine trout
Nap Ghost

kewlpc posted:

Again, use FBOs. Set up an FBO with two color attachments. Render Step 1 into color attachment 0. Switch to color attachment 1 and, using color attachment 0 as a texture, render a quad that covers the screen using a shader that just puts the red channel into the alpha channel.

Then, when rendering Step 3, use color attachment 1 as one of the textures, with a shader that uses color attachment 1's alpha as its own.

But that's the complicated way of doing it. The simpler way would be to set up an FBO with only one color attachment, render Step 1 into it, then switch back to the default FBO, and render Step 3 using a shader that takes in your FBO's color attachment as a texture and uses its Red channel as alpha.

Either method should be faster than the way you outlined since you'll only be rendering the scene from Step 1 once instead of twice.

Also, you do know that on modern hardware the fixed-function pipeline is just emulated, right? So using a well-optimized shader shouldn't be any slower than the "fixed-function" shaders that the driver loads. In fact, in either the upcoming version of OpenGL or the one after it all the fixed-function emulation is going to be removed.

Cheers for your reply.

As I mentioned in my post, for efficiencies sake I cannot afford to swap between two color attachments (ping pong) and keep them in sync.

I am rendering tens of thousands of particles, the results of which need to be correctly composited with the results of all the previous particles. Your method would require swapping on each particle which would slow us to a crawl.

The blending mode that we require cannot be directly implemented using the blending hardware (blending is still "fixed function" be it programable under the hood or not).

We can however split the function into two parts if we could efficiently swizzle the RGBA channels (i.e. render and blend some initial parameters in R, then render again, swizziling R into A before the blend).

The only way to do efficient Read-Modify-Write for large numbers of particles is using blending. We can swizzle channels using the color matrix functionality of the imaging subset (via an inplace copypixels and an appropriate matrix) but this drops to software on Quadro 4600 and 5600 cards.

joe87653
Jul 9, 2002

joe87653 fucked around with this message at 07:54 on Mar 28, 2014

StickGuy
Dec 9, 2000

We are on an expedicion. Find the moon is our mission.

forelle posted:

I am rendering tens of thousands of particles, the results of which need to be correctly composited with the results of all the previous particles. Your method would require swapping on each particle which would slow us to a crawl.
Have you considered presorting your particles?

forelle
Oct 9, 2004

Two fine trout
Nap Ghost

StickGuy posted:

Have you considered presorting your particles?

It is our last ditch approach. The particles are spawned based on user input (painting) and there can be a arbitary number of them created in a arbitrary order.

Pre-sorting would mean re-rendering at least a subset under the new particle for each new particle added rather than a much more efficient in place rendering.

If we can't find an elegant (read nasty hacky quick) solution we're gonna go this route.

For efficiency we will probably use a combination of bucketing and viewport / scissor / stencil buffer to minimise particle redrawing.

Roll on programmable blending.

forelle
Oct 9, 2004

Two fine trout
Nap Ghost

Mr_PK posted:

I don't know if this is what you need or not, but in OpenGL you can use glColorMask(). This lets you limit what channels you want to render to. For example, you can only render to R and B, then do a second pass render to render to G and A.

http://www.cs.utk.edu/~vose/c-stuff/opengl/glColorMask.html

Cheers for the reply.

We use color masking to control what gets written, but it is only half the solution. If only GL had a "render R as if it was blue" my life would be sooo much easier. :)

joe87653
Jul 9, 2002

joe87653 fucked around with this message at 07:54 on Mar 28, 2014

forelle
Oct 9, 2004

Two fine trout
Nap Ghost

kewlpc posted:

But that's the complicated way of doing it. The simpler way would be to set up an FBO with only one color attachment, render Step 1 into it, then switch back to the default FBO, and render Step 3 using a shader that takes in your FBO's color attachment as a texture and uses its Red channel as alpha.

Thank you!!!!

I owe you an apology. We just got this method working a treat.

Yay completely accurate floating point Photoshop-style brush painting fully accelerated in hardware.

(Full speed with huge brushes that PS chokes on too)

Doc Block
Apr 15, 2003
Fun Shoe
Glad I could help.

But in return you have to tell us more about your program.

forelle
Oct 9, 2004

Two fine trout
Nap Ghost

kewlpc posted:

Glad I could help.

But in return you have to tell us more about your program.

I would love to be able to say something, but for the moment I'm NDA'd upto the hilt and I work for an organisation that takes that sort of thing VERY seriously.

I hope at some point in the near future to get permission to talk about it and even start giving it away. I'll make sure I post here first when I can.

t_rf
Nov 24, 2006
Space Creeps

I put this game up yesterday - my first commercial/indie effort. There was an earlier version up a few months ago but it wasn't really good enough at that point to get anywhere in the cutthroat-casual market that is Flash games. I think with the high scores and recording and various improvements I've made since then it might do a decent business. The recording function in particular is something I don't think any previous Flash game has done.

Something a bit disconcerting is that most people don't seem to be finishing their games. 500 plays today and I've only got five scores up - and the server isn't broken, the log shows plenty of people connecting normally to get the game of the day. They just aren't following through by sending a finished recording. But I know from the first version that Flash gamers find the whole targeting thing too complicated - which is unfortunate given that it's also a big part of makes the game unique.

Even so, I'll probably still do another revision with slicker graphics down the line. Most of the elements look OK, but it's really missing that cohesive, polished look.

If I were to go all-out on it, I'd convert the game to 3d with Papervision or something :v: But it's hard to justify.

vanjalolz
Oct 31, 2006

Ha Ha Ha HaHa Ha
I just stopped at an unfinished game. I wanted to know what the game was about, so i jumped straight into single player (not hard mode).

I was given the option of placing towers, and my first attempt was to drop them on the red blocks, which failed. I couldn't see a really-really good place to put my first tower, I suggest that you make one blatantly suggestive point for level one to guide the player.

After placing my tower, I had to face it in a direction. I failed at this too, because I wasn't sure if the three things on red blocks were on my team, or if I was one and the other two were computer players. I had a feeling this might be some kind of Tower Defence map, but I couldn't see an obvious point for monsters to spawn.

Afterwards, a ship thing came out and suicided or something, not sure what was meant to go on there, my single lone tower did nothing. Next round I was asked to place five walls. Again, I had no guidance and no reason to place them in a strategic way so I just click spammed on the screen. Same with the three towers.

This time a bunch of little monsters came out of the ships, and I killed them. Yay, confirmed to be Tower Defence, but it wasn't exciting enough to keep me captivated.

Doc Block
Apr 15, 2003
Fun Shoe
In all fairness, that stuff (and what you're supposed to do) is explained in the tutorial.

t_rf
Nov 24, 2006
It's a good critique. The game isn't really yet set up to forcefully baby the player through every single thing on the screen, and it needs to do that - there's no genre convention to go on for these particular mechanics. For example, this recording, where the player doesn't know how to rotate walls and places targets in the least useful spots, is downright painful to watch.

Also, every map is random so there's no telling if you get an easy one or a hard one. I've considered doing a campaign mode which would serve that purpose. The main target is the competitive players, though, so I've focused on the higher level play and slowly drilled down from there. There's a tremendous metagame having to with whether you kill the creeps earlier(safer, and you can get the clean map bonus) or later(more to kill=more points). Tower usage, wall placement, etc. follows from how conservative your overall strategy is.

Blightie
Dec 27, 2004
Well I have been working on my first major undertaking on XNA, I am trying to get a little spaceflight game going with Newtonian physics. I am having a bit of an issue and was wondering what the best solution to this problem was (I'm a spare time coder, but I am an engineer so maths is not a worry).

Anyway, my issue is with say thrusters on the ship. I can handle doing the physics calculations given say a direction vector but what is the best way to get (and keep) a direction vector for the thrust as the ship rotates?

The way the thing is meant to work is that a given ship will have thrusters in specific locations that can either rotate the ship or force it in various directions. I am just having trouble working out the best way of achieving something like this. My attempts so far have been well less than great and someone here probably knows a lot more than I do. Along with this problem, what would be the best (ie fastest or easiest) way of keeping a ships turrent in the right spot and facing the right way?

Summary: Help with 3d direction vectors for a spaceship's thruster.

Horn
Jun 18, 2004

Penetration is the key to success
College Slice
Does anyone have a good resource of free game friendly models? I've tried :google: but everything I find is high vertex stuff.

t_rf
Nov 24, 2006
Following up on my release and review of Space Creeps, I took a few notes and have a new set of plans for future versions:

Replace puzzle pieces and rotation with only single-square walls. Puzzle pieces add little to the game as it stands - they are very annoying, add additional controls and rules, and block many strategies by random chance. The main restriction should have to do with the external foe, not what pieces you can place.

Create a new interface engine; look at the gui system options available for haXe. The current interface is primitive and brittle in several ways.

Convert and upgrade graphics to vectorized versions. Pixel art can be cool but for this kind of game, the detail of pixelling just clutters up an already busy screen.

Add a short mini-campaign or video introduction to the game, in three or more parts:
1. Sealing walls.
2. Placing towers.
3. Upgrading towers.
Strategy?

Using the recording system for this would be awesome and would require three general extensions:

1. Support custom maps(and in that case....why not allow the players to make and upload maps, too? And then add more kinds of map elements?)
2. Extending the recording system to load data stored in the swf. This shouldn't be too hard.
3. Extending the recording system to allow commentary tags. It would be great if players could do this too, and it could be "modular" (one-per-person) commentary so that you aren't drowned in a flood of youtube-esque spam.

The greatest thing about a web game is that it never "ships." Or it ships as many times as you want. Whichever view you prefer :)

ed: a missing

rrenna
Jan 10, 2006

I'd love to hear some feedback on my game if anyone has the patience.

vanjalolz
Oct 31, 2006

Ha Ha Ha HaHa Ha

rrenna posted:

I'd love to hear some feedback on my game if anyone has the patience.

Have you posted it already, or is it for applicants only?

Sex Bumbo
Aug 14, 2004

Horn posted:

Does anyone have a good resource of free game friendly models? I've tried :google: but everything I find is high vertex stuff.

http://turbosquid.com/ sometimes has good stuff. It has a lot of stuff at least.

If you download the free Crysis demo, that has a lot of textures you can steal. Just don't, you know, sell your game with them.

Adbot
ADBOT LOVES YOU

rrenna
Jan 10, 2006

vanjalolz posted:

Have you posted it already, or is it for applicants only?

Sorry it's up at the top,

https://www.dkp-zero.com

Just go to download and pick the mirror, for some reason my host is being super slow (could be my shoddy web programming).

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