Search Amazon.com:
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 $3,400 per month for bandwidth bills alone, and since we don't believe in shoving popup ads to our registered users, we try to make the money back through forum registrations.
«314 »
  • Post
  • Reply
Doc Block
Apr 15, 2003

ProRes 4444 Only


Yeah, shaders with a 1D lookup texture for the palette is probably the best way to go.

Adbot
ADBOT LOVES YOU

Ferg
May 6, 2007



I'm cross-posting this with the XNA thread:

I've added the GamerServicesComponent to my game, but it looks like I need to do something about controls when the Live Guide is open. Say I have a sprite on the game screen that moves left and right with the D-Pad. When I open up the Live guide and I'm hitting left and right to change tabs, my sprite is still moving inside the game in the background. Is there a way to disable controls when the guide is open?

more falafel please
Feb 26, 2005

forums poster

Ferg posted:

I'm cross-posting this with the XNA thread:

I've added the GamerServicesComponent to my game, but it looks like I need to do something about controls when the Live Guide is open. Say I have a sprite on the game screen that moves left and right with the D-Pad. When I open up the Live guide and I'm hitting left and right to change tabs, my sprite is still moving inside the game in the background. Is there a way to disable controls when the guide is open?

The Microsoft.Xna.Framework.GamerServices.Guide has a property called IsVisible. That should tell you whether the guide is up, so you can ignore input.

Ferg
May 6, 2007



more falafel please posted:

The Microsoft.Xna.Framework.GamerServices.Guide has a property called IsVisible. That should tell you whether the guide is up, so you can ignore input.

Awesome, thanks!

While we're on the subject, is there a way with GamerServices to have a gamer's profile display the game they're playing as opposed to XNA Studio? My anal retentive side wants others to see what game I'm actually playing rather than seeing that I'm "just" using XNA studio.

trashmatic
Jan 27, 2006



king_kilr posted:

I'm looking to build a game similar to Operation Space Hog(for those of you who haven't played it, a) check it out, its free, b) it's a 2d scroller space game where you have a ship and you get upgrades and stuff), with the intention of ultimately making it online-coop, I'd like to build it in python(by far my strongest language), any recommendations for what library to use, my understanding is that it would be either PyGame or PySoy, any other advice would be great.

PySoy doesn't make much sense for 2D games and as far as I can tell its developers don't recommend it be used in real projects yet anyway.

Look into Pyglet for graphics/audio/input and Twisted for the networking layer. My experience with both libraries is very limited but they stood out ahead of the rest when I was evaluating these things a while back.

king_kilr
May 25, 2007


trashmatic posted:

PySoy doesn't make much sense for 2D games and as far as I can tell its developers don't recommend it be used in real projects yet anyway.

Look into Pyglet for graphics/audio/input and Twisted for the networking layer. My experience with both libraries is very limited but they stood out ahead of the rest when I was evaluating these things a while back.

Very cool, thanks, the networking stuff I'm going to look at later, first I want to put together the game, pyglet doesn't appear to have linux support, or can I just download the source and put it on my python path.

more falafel please
Feb 26, 2005

forums poster

Ferg posted:

Awesome, thanks!

While we're on the subject, is there a way with GamerServices to have a gamer's profile display the game they're playing as opposed to XNA Studio? My anal retentive side wants others to see what game I'm actually playing rather than seeing that I'm "just" using XNA studio.

It looks like rich presence is not supported in the XNA framework at this point, but supposedly they're working on it. The way MS does rich presence requires some server-side support that I'm not sure they want to support for XNA games.

trashmatic
Jan 27, 2006



I got pyglet through the Arch Linux AUR. But in any case, I think all you need to do is unpack the source tarball and do a 'python setup.py install'.

EDIT: Actually, scratch that. What you really want to do is get the new alpha and just run easy_install on the .egg file. Grab the docs as well, and check out the 'astraea' example game.

trashmatic fucked around with this message at Mar 13, 2008 around 04:24

vanjalolz
Oct 31, 2006

Ha Ha Ha HaHa Ha

Someone asked earlier about a 2D game engine in C#: I've been playing around with SDL.net a bit and I'm fairly impressed with it. AnimatedSprite classes sure do take out a lot of the work.

LordLobo
Dec 12, 2003

Not
gonna
take it
anymore


vanjalolz posted:

Someone asked earlier about a 2D game engine in C#: I've been playing around with SDL.net a bit and I'm fairly impressed with it. AnimatedSprite classes sure do take out a lot of the work.

This is quite awesome - thanks.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!


So I'm working on putting together some basic AI for a 2d sidescroller a la mario. (Although it is a fair bit more complex than Mario, but it's from the same angle.)

Due to the nature of the gameplay and plot, I need to have a number of enemy types that can arbitrarily respond to any other enemy type (and indeed, any unusual object in their environment.) My first thought was to follow the standard object oriented approach -- model it like it exists in the real world. But I realized that would be unbelievably complex, and way more work than needed, and I started to do some reading. One model that particularly stuck out to me was a 'smart-world' or stimulus based approach. Rather than having each AI evaluate what everything in the world meant for their situation, I would drop little 'beacons' into the world that projected a type in a certain radius. So one might be food, or enemy, or loud noise, or fear... etc. Then, the AI for a unit just polls the nearby beacons, selects which is the highest priority, and changes state appropriately.

That seems straightforward enough to me. However, I'm looking into doing some pathfinding for my characters. The easiest (and most coarse) method is just to push them around until they stop moving, and then turn them, and push a different direction. That's what my first prototypes did, and I'm not satisfied. I've read about A* and nodegraphs, and I can see how I might use these to navigate with a flying agent, land based enemies don't seem to make sense. Can anyone point me to resources (or give me some pointers [HA! programming joke!]) on managing 2D navigation?

very
Jan 25, 2005

I err on the side of handsome.

Pfhreak posted:

Can anyone point me to resources (or give me some pointers [HA! programming joke!]) on managing 2D navigation?

It really depends on what kind of terrain you are talking about and how your characters move. Can you give us a better idea?

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!


very posted:

It really depends on what kind of terrain you are talking about and how your characters move. Can you give us a better idea?

Yeah. We're using a physics library, and all of the agents will be affected by it. We are defining the world using textured polygons of arbitrary size. Thus, the world isn't tiled. The agents have a bounding box that defines their collision size, and they currently move back and forth by sliding along the ground. (By altering their linear velocity.)

Does that help? I'm trying to think of a similar game. Abuse is pretty close. (Actually, they make their source available, maybe I'll check that out!)

shodanjr_gr
Nov 20, 2007
Goon from Greece



Pfhreak posted:


That seems straightforward enough to me. However, I'm looking into doing some pathfinding for my characters. The easiest (and most coarse) method is just to push them around until they stop moving, and then turn them, and push a different direction. That's what my first prototypes did, and I'm not satisfied. I've read about A* and nodegraphs, and I can see how I might use these to navigate with a flying agent, land based enemies don't seem to make sense. Can anyone point me to resources (or give me some pointers [HA! programming joke!]) on managing 2D navigation?

I have had an AI class in Uni, but havent worked on game-purpose AI (yet), so read the following with a grain of salt.

Why do you have trouble dealing with land based navigation?

Id assume its the same as air navigation, only the network of nodes were the agent can move to is more limited (id suppose you switch that by altering the costs on the edges that link to non-ground nodes and setting it to infinity, thus causing any algorithms you run on your new node network to consider those edges as "impassable" objects).

I would also assume that each edge on your network has an associated action with which a client can traverse said edge (for instance if node A is on the ground and node B is directly above node A (in the air), then the action from A->B would be "jump").

You can use A*, or some other optimal solution finding algorithm to determine the optimal action for your agent at any time (actions judged by their end results).

If you know your intended action (for instance a Goomba in Mario would want to try and get to the square that mario is in) you can run a shortest path algorithm to determine the optimal path from the agent's current node to the target node. Then have your agent follow that path by traversing the edges the shortest path algorithm returns.

haveblue
Aug 15, 2005



Pfhreak posted:

Yeah. We're using a physics library, and all of the agents will be affected by it. We are defining the world using textured polygons of arbitrary size. Thus, the world isn't tiled. The agents have a bounding box that defines their collision size, and they currently move back and forth by sliding along the ground. (By altering their linear velocity.)

Does that help? I'm trying to think of a similar game. Abuse is pretty close. (Actually, they make their source available, maybe I'll check that out!)

Abuse uses tiles, but it'll probably still be useful.

IcePotato
Dec 29, 2003

There was nothing to fear
Nothing to fear


This might be a really simple question, but I'm having a giant brainfart.
Using XNA: My levels have a time limit. I'd like to display remaining time left on-screen, but only in seconds. I initialize my 'timer' variable to the map's timeLimit variable, but
code:
timer -= gameTime.ElapsedRealTime.Seconds;
doesn't work, because that's the elapsed time between steps.
code:
timer -= gameTime.TotalRealTime.Seconds;
similarly doesn't work because it subtracts the entire amount of time elapsed, so it starts off going down fast and the rate at which it decreases is constantly increasing.
What's the logic I need here?

shodanjr_gr
Nov 20, 2007
Goon from Greece



IcePotato posted:

This might be a really simple question, but I'm having a giant brainfart.
Using XNA: My levels have a time limit. I'd like to display remaining time left on-screen, but only in seconds. I initialize my 'timer' variable to the map's timeLimit variable, but
code:
timer -= gameTime.ElapsedRealTime.Seconds;
doesn't work, because that's the elapsed time between steps.
code:
timer -= gameTime.TotalRealTime.Seconds;
similarly doesn't work because it subtracts the entire amount of time elapsed, so it starts off going down fast and the rate at which it decreases is constantly increasing.
What's the logic I need here?


Timer = TimeLimit
StartingTime = gameTime.TotalRealTime.seconds;

then in the idle function do

Timer = Timer - (gameTime.TotalRealTime.Seconds - StartingTime);

If i figure it out correctly gameTime is the time since the start of the game (that's how GLUT counts time if i recall correctly). So you need the time at which the level starts rolling (Starting Time) and you subtract that from the current time value when you want to update the timer, giving you the elapsed time in seconds.

Not 100% sure though, cause i havent done any XNA development.

Jake Armitage
Dec 11, 2004

+69 Pimp

IcePotato posted:

doesn't work, because that's the elapsed time between steps.

Why doesn't that work, isn't that what you want? I'm assuming you want to update the timer whenever Update is called, and subtract off the elapsed time since the last time update was called. You'll get that from gameTime.elapsedGameTime.

[edit] Ah I see. Yes, you want elapsedGameTime, not elapsedRealTime.

IcePotato
Dec 29, 2003

There was nothing to fear
Nothing to fear


stromdotcom posted:

Why doesn't that work, isn't that what you want? I'm assuming you want to update the timer whenever Update is called, and subtract off the elapsed time since the last time update was called. You'll get that from gameTime.elapsedGameTime.

[edit] Ah I see. Yes, you want elapsedGameTime, not elapsedRealTime.

thanks - I didn't really understand the difference. Ended up fixing it by taking the value of the map's timer, multiplying by 1000 to get milliseconds, and subtracting the value of elapsedGameTime in milliseconds. Then when I draw my time, I just divide timer by 1000 to go back to seconds.

Jake Armitage
Dec 11, 2004

+69 Pimp

For those of you working with XNA, I got a bunch of requests to do a series of tutorials on building animated models with Blender for XNA and finally did it. This has always been a major stopping point for me -- either I hire someone to do it, or the project dies. I always just wanted to know how to whip up something temporary in Blender and get it to work, and then hand it off to a modeler.

Links:

Part 1: Non-UV Texturing
Part 2: UV Texturing
Part 3: Rigging
Part 4: Animating and Exporting

The topic comes up every 5 seconds on the XNA forums, so these were geared towards coders.

Ferg
May 6, 2007



stromdotcom posted:

For those of you working with XNA, I got a bunch of requests to do a series of tutorials on building animated models with Blender for XNA and finally did it. This has always been a major stopping point for me -- either I hire someone to do it, or the project dies. I always just wanted to know how to whip up something temporary in Blender and get it to work, and then hand it off to a modeler.

Links:

Part 1: Non-UV Texturing
Part 2: UV Texturing
Part 3: Rigging
Part 4: Animating and Exporting

The topic comes up every 5 seconds on the XNA forums, so these were geared towards coders.
You sir, are a godsend.

devoir
Nov 16, 2007


Wow, this has a lot of promise.

Hubis
May 18, 2003

Boy, I wish we had one of those doomsday machines...

stromdotcom posted:

For those of you working with XNA, I got a bunch of requests to do a series of tutorials on building animated models with Blender for XNA and finally did it. This has always been a major stopping point for me -- either I hire someone to do it, or the project dies. I always just wanted to know how to whip up something temporary in Blender and get it to work, and then hand it off to a modeler.

Links:

Part 1: Non-UV Texturing
Part 2: UV Texturing
Part 3: Rigging
Part 4: Animating and Exporting

The topic comes up every 5 seconds on the XNA forums, so these were geared towards coders.

Very nice.

Murodese
Mar 6, 2007

My level of intellect is so low that not even the press gallery can understand me


Quaternion camera question~

The way I'm doing it is basically this;

if key = a
m_x -= 1.0f
if key = d
m_x += 1.0f

.. so on for y/z (m_y, m_z)

drawloop
{
m_camera = quatmultiply(m_camera, eulertoquat(m_x, m_y, m_z))
m_x = m_y = m_z = 0

matrix = quatcreatematrix(m_camera)
glMultMatrix(matrix)
glTranslatef(-m_position.x, -m_position.y, -m_position.z)
}

Which works great. Except in one case. It suffers from standard rotate x then y != rotate y then x. It does not suffer from gimbal lock, however.

As an example, if you yaw left 20 units, pitch up 20 units, yaw right 20 units, pitch down 20 units, you'll end up rolled right very slightly from your previous rotation.

Any ideas?

haveblue
Aug 15, 2005



You're not taking the camera's current orientation into account when rotating, so all rotations are being performed around the same 3 axes. You need to take the axis the key command is supposed to rotate around and rotate *that* to be relative to the camera before using it to change the camera itself.

I made a fairly long post about this a few pages back. You already have most of it down, so just look at the last two blocks.

haveblue fucked around with this message at Mar 20, 2008 around 15:24

Murodese
Mar 6, 2007

My level of intellect is so low that not even the press gallery can understand me


HB posted:

You're not taking the camera's current orientation into account when rotating, so all rotations are being performed around the same 3 axes. You need to take the axis the key command is supposed to rotate around and rotate *that* to be relative to the camera before using it to change the camera itself.

I made a fairly long post about this a few pages back. You already have most of it down, so just look at the last two blocks.

So if I'm understanding right, to yaw I should be getting the "y" axis from the current rotation and multiplying the current rotation by the quat generated by (m_x, ("y")) instead, then doing the same for the other axes that need to be rotated that frame?

haveblue
Aug 15, 2005



Murodese posted:

So if I'm understanding right, to yaw I should be getting the "y" axis from the current rotation and multiplying the current rotation by the quat generated by (m_x, ("y")) instead, then doing the same for the other axes that need to be rotated that frame?

Pretty much. You already have the current camera orientation as a quat. You take the natural Y axis and rotate it with this quat, so that from the camera's perspective it's where the Y axis should be. Then you rotate the camera around this new axis by the amount the user inputted.

Dr. Poz
Sep 8, 2003

Dr. Poz just diagnosed you with a serious case of being a pussy. Now get back out there and hit them till you can't remember your kid's name.


I'm teaching myself HLSL and am having a real bear of a time with it. I can follow the tutorials showing how to apply a basic effect, and I can implement other peoples shader files (if they have sample code...) but I'm having trouble making the logical breakthrough to implementing more than just a basic effect. For example: I have seen samples of normal mapping and cel shading, but can't figure out how I would apply both effects given that the samples I have render in distinct ways.

XNA is the platform I am using and really all I need is a good source of reference for building increasingly complex effects, preferably starting off simple and building from there. I find the examples of XNA to be to basic, and the white pages on MSDN goes from shallow to deep with little notice. What sources would your recommend?

Also, if anyone just likes talking about this mind melting poo poo feel free to PM/IM me.

tyrelhill
Jul 30, 2006


Use Render Monkey if you're just playing around with shaders. You can compile and debug any kind of shader(GLSL, HLSL, CG). As for how they work, polish up on your linear algebra. Shaders are 1,000,000% mathematics.

Dr. Poz
Sep 8, 2003

Dr. Poz just diagnosed you with a serious case of being a pussy. Now get back out there and hit them till you can't remember your kid's name.


One of my problems is I can't find any examples of doing something like I want to do, so maybe you could answer this. If I wan't to have normal mapping and toon shading in one shader, should they be different passes in the same technique, or different techniques?

haveblue
Aug 15, 2005



Girl With Huge Tits posted:

One of my problems is I can't find any examples of doing something like I want to do, so maybe you could answer this. If I wan't to have normal mapping and toon shading in one shader, should they be different passes in the same technique, or different techniques?

You should be able to write a shader that does both. One technique involves calculating the fragment color based on the normal, the other is calculating the normal by a transformation of a texture sample. If you can find examples of both it should be relatively simple to create a shader that does one and feeds the result into the second.

Jake Armitage
Dec 11, 2004

+69 Pimp

Girl With Huge Tits posted:

One of my problems is I can't find any examples of doing something like I want to do, so maybe you could answer this. If I wan't to have normal mapping and toon shading in one shader, should they be different passes in the same technique, or different techniques?

You can call functions from other functions.

So if you add functions to do the two effects, then do something like:

code:
float4 PS_BothEffects(VS_IN in) : COLOR
{
    return Effect2(Effect1(screenTex, in.UV));
}
That should work. You don't want to put them in separate passes, because the results of the passes get blended in the end. Unless that's what you're going for.

IcePotato
Dec 29, 2003

There was nothing to fear
Nothing to fear


god drat I am so bad at basic math. I'm trying to calculate the path of a bullet in my top-down strategy game - basically I want to draw the bullet moving at a specific speed until it hits something.
code:
location = new Vector2(orgin.X, orgin.Y);
slope = new Vector2((destination.X - orgin.X),(destination.Y - orgin.Y));

public Vector2 path(GameTime gameTime)
        {
            location += slope / (spd * (float)gameTime.ElapsedGameTime.TotalSeconds);
            return new Vector2((int)location.X, (int)location.Y);
        }
This is wrong - all my bullets appear in the top-left and don't really do much. I have no idea how to fix this because I didn't retain anything from high school math

haveblue
Aug 15, 2005



totalSeconds is not the time of that frame, it's the total time elapsed since your game was launched. You have to calculate the frame time by storing the elapsed time from the last frame and finding the difference.

IcePotato
Dec 29, 2003

There was nothing to fear
Nothing to fear


HB posted:

totalSeconds is not the time of that frame, it's the total time elapsed since your game was launched. You have to calculate the frame time by storing the elapsed time from the last frame and finding the difference.

at some point I am going to stop and wonder how many times I will make the same loving mistake. Unfortunately I don't have time for that now because I need to completely refactor my engine - all of my rookie, this-is-my-first-game mistakes have piled up to the point that I feel better just redoing almost everything.
Well, at least I'll have a lot of good material for my end-of-semester report.

e: wait, no. I might've gotten this part right - According to the doc, ElapsedGameTime is the amount of time since the last frame, .TotalSeconds just gives me a double with the fractional number of seconds, as opposed to .Seconds, which only gives an int containing whole seconds

IcePotato fucked around with this message at Mar 24, 2008 around 15:39

Cedra
Jul 23, 2007


Does anyone have any good tutorial links to a tile engine in C#? I've been following XNAResources.com but their tutorials are outdated and ever since updating to XNA 2.0 things like EnsureDevice(), BeginScene() and EndScene() are broken and I've little idea of how to fix them.

Jake Armitage
Dec 11, 2004

+69 Pimp

Cedra posted:

Does anyone have any good tutorial links to a tile engine in C#? I've been following XNAResources.com but their tutorials are outdated and ever since updating to XNA 2.0 things like EnsureDevice(), BeginScene() and EndScene() are broken and I've little idea of how to fix them.

I've only glanced briefly at it, but this looks good: http://www.kersson.com/articles/article.aspx?ar=41

Jake Armitage
Dec 11, 2004

+69 Pimp

IcePotato posted:

code:
location = new Vector2(orgin.X, orgin.Y);
slope = new Vector2((destination.X - orgin.X),(destination.Y - orgin.Y));

public Vector2 path(GameTime gameTime)
        {
            location += slope / (spd * (float)gameTime.ElapsedGameTime.TotalSeconds);
            return new Vector2((int)location.X, (int)location.Y);
        }

Location is the location of the bullet, and path returns the current location of the bullet? I'm assuming you call path like

code:
location = path(gameTime);
It looks like you might be accumulating a big number in location by using += there instead of =.

VVVV That too. You should normalize your "slope" vector, and multiply by speed * time.

Jake Armitage fucked around with this message at Mar 24, 2008 around 22:04

Hubis
May 18, 2003

Boy, I wish we had one of those doomsday machines...

IcePotato posted:

god drat I am so bad at basic math. I'm trying to calculate the path of a bullet in my top-down strategy game - basically I want to draw the bullet moving at a specific speed until it hits something.
code:
location = new Vector2(orgin.X, orgin.Y);
slope = new Vector2((destination.X - orgin.X),(destination.Y - orgin.Y));

public Vector2 path(GameTime gameTime)
        {
            location += slope / (spd * (float)gameTime.ElapsedGameTime.TotalSeconds);
            return new Vector2((int)location.X, (int)location.Y);
        }
This is wrong - all my bullets appear in the top-left and don't really do much. I have no idea how to fix this because I didn't retain anything from high school math

I'm confused as to why you're dividing your direction vector by speed*time instead of multiplying it, for one.

Adbot
ADBOT LOVES YOU

tyrelhill
Jul 30, 2006


position += velocity * deltaTime

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply
«314 »