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
Yodzilla
Apr 29, 2005

Now who looks even dumber?

Beef Witch

Nition posted:

Best example of this:
https://www.youtube.com/watch?v=hXmZX8iz2SE

Those are the first person view animations being shown from third person.

Never forget. :911:

https://www.youtube.com/watch?v=mv7MnV1SrZg

Adbot
ADBOT LOVES YOU

Mercury_Storm
Jun 12, 2003

*chomp chomp chomp*
Haha, oh man those animations. Also in PS2 they have it set up so that if you look around a just little bit, only your character's upper torso will rotate, so if you're crouching and look around while aiming a gun your arms clip wildly through your legs. I guess nobody cares that much about people penetrating themselves, but I'd prefer things not look dumb.

Mercury_Storm fucked around with this message at 07:27 on Feb 7, 2013

Suran37
Feb 28, 2009

eeenmachine posted:

We're about to ship a pretty fully featured game on Mac/PC/iOS/Android built with Futile: http://toucharcade.com/2013/01/28/exclusive-first-look-at-nimblebits-upcoming-nimble-quest/

Thank god, I'll never have to play another Mobage port again.

Wolfgang Pauli
Mar 26, 2008

One Three Seven
If anybody's interested, UC Berkeley is going to be doing AI and graphics programming courses through edX. AI starts a week from Monday, graphics programming a month from then.

Pi Mu Rho
Apr 25, 2007

College Slice

Vankwish posted:

Don't worry I've cracked it. After 8 hours of normal work on my game today I felt it was only reasonable to take a look at this turret stuff because I brought the whole thing up.

I've just this minute solved it.

I've implemented this in Dreadnaughts and it works beautifully. I love you.

We're actually doing vaguely similar games (mine's more of a lite space sim) in a very similar visual style. It'll be interesting to see how that pans out.

Vankwish
Dec 3, 2012

Game Dev

Pi Mu Rho posted:

I've implemented this in Dreadnaughts and it works beautifully. I love you.

We're actually doing vaguely similar games (mine's more of a lite space sim) in a very similar visual style. It'll be interesting to see how that pans out.

No problem, I'm pleased that it saved you some time.

It was a problem that has been on my to-do list for some time so it was satisfying to find a solution that worked so flawlessly. Strangely enough, it's not in my game yet. I removed my old turrets from the game almost a year ago but I've long since planned to put them back in eventually. Now at least I have a working solution.

Nition
Feb 25, 2006

You really want to know?
Vankwish, thanks for that code! I don't think I'll use it directly because the way you're doing things is a bit different to the way I'm doing things, but I can hopefully use a bit of it to make my version of the code better. I wish you could do stuff like
code:
parentsRotation.eulerAngles.z = 0;
in C#, that'd make my code simpler for a start.

Vankwish
Dec 3, 2012

Game Dev

Nition posted:

I wish you could do stuff like
code:
parentsRotation.eulerAngles.z = 0;
in C#, that'd make my code simpler for a start.

I don't understand. You can do that in C#.

http://docs.unity3d.com/Documentation/ScriptReference/Quaternion-eulerAngles.html

'parentsRotation' is just a Quaternion variable I set up earlier in the code. I tend to write all my code with quite long variable names so it's super easy to read again months later when I come back and need to tweak it or remember how it worked.

Incidentally, if you haven't actually tested the code, even just in a mock up scene in javascript, you really should. It does the job perfectly. It will let you even rotate a turret endlessly in one direction without ever flipping or getting confused.

Vankwish fucked around with this message at 00:03 on Feb 8, 2013

Nition
Feb 25, 2006

You really want to know?

Vankwish posted:

I don't understand. You can do that in C#.

http://docs.unity3d.com/Documentation/ScriptReference/Quaternion-eulerAngles.html

'parentsRotation' is just a Quaternion variable I set up earlier in the code. I tend to write all my code with quite long variable names so it's super easy to read again months later when I come back and need to tweak it or remember how it worked.

Incidentally, if you haven't actually tested the code, even just in a mock up scene in javascript, you really should. It does the job perfectly. It will let you even rotate a turret endlessly in one direction without ever flipping or getting confused.

Nah, unfortunately you can't. You can't set x/y/z on their own unless you do it the long way:
code:
Vector3 parentAngles = parentsRotation.eulerAngles;
parentAngles.z = 0;
parentsRotation.eulerAngles = parentAngles;

Myopic
Mar 27, 2005

It is only logical to bang one's head
Is there some reason you can't use parentsRotation.eulerAngles = new Vector3(parentsRotation.x, parentsRotation.y, 0)? You can read the floats fine, just not set them directly.

e: z != y

Myopic fucked around with this message at 01:16 on Feb 8, 2013

Bondematt
Jan 26, 2007

Not too stupid

Myopic posted:

Is there some reason you can't use parentsRotation.eulerAngles = new Vector3(parentsRotation.x, parentsRotation.y, 0)? You can read the floats fine, just not set them directly.

e: z != y

Yes, but you'll need to stay in eulerAngles.

parentsRotation.eulerAngles = new Vector3(parentsRotation.eulerAngles.x, parentsRotation.eulerAngles.y, 0)

Myopic
Mar 27, 2005

It is only logical to bang one's head

Bondematt posted:

Yes, but you'll need to stay in eulerAngles.

parentsRotation.eulerAngles = new Vector3(parentsRotation.eulerAngles.x, parentsRotation.eulerAngles.y, 0)

That's what I meant to type. :downs:

Nition
Feb 25, 2006

You really want to know?
Oh yeah, that way is a bit more succinct. Still have to set all values at once.

Vankwish, your solution is definitely an improvement on mine. The way you're using the parent's global rotation to determine the difference in angle let me ditch all my global to local conversion. The only thing is I think you still have a version of the problem I've always had, which happens if your turret has a limited range, but it's more than 180°.

e.g.:
- Say you turret has a range of 110° each way from zero (220° total)
- Your target is at 110° and it moves there
- Your target moves to an area outside of rotation range: Still all good, turret stays at 110 degrees
- You target moves to -110° (250°), which is in range again. This is where the problems happen. Ideally the turret should move there by taking the "long way round."
- In my system, the turret takes the short way round, through the not-allowed angles at the back. In your system I think it's prevented from doing that, but the problem instead is that it gets "stuck" clamped at the other point until you've moved enough that it tries to go the other way instead. Because it keeps trying to go the short way around and getting told that's not allowed.

I may be wrong because I'm not implementing your code exactly, but I'm pretty sure that's what it does. I don't have a solution, either - except giving all turrets unlimited range or <90 each way.

Nition fucked around with this message at 03:31 on Feb 8, 2013

Vankwish
Dec 3, 2012

Game Dev

Nition posted:

.....
I may be wrong because I'm not implementing your code exactly, but I'm pretty sure that's what it does. I don't have a solution, either - except giving all turrets unlimited range or <90 each way.

You are right. I hadn't noticed that until you mentioned it because the base of my turret was always free to roam 360. I only limited the barrels up and down movement so it wouldn't intersect with the base model. Using that method it was always able to find it's target without getting up to any funny business.

The solution would be to tweak the part of the code where we do nothing if the turret would exceed it's maximum angle. You could put additional code in there along the lines of...

if (maximum angle exceeded) return to zero rotation.

Once it's back at zero rotation it would be able to get to it's target again and it would appear to be going the long way around. I don't have the time now, nor the need, to write that additional code so maybe you could add that part to extend the functionality of the script and post it up.


Edit: Argh. I couldn't help myself. I had to have a quick look at this problem after finishing work and 3 hours later.....

Here's the solution. Pop this into the original code. I've copied the comments from the original code again here so you can see where to put it and which part of the original code must be replaced.

EDIT: the code tags were breaking tables

It will now returnHome (go back to it's starting rotation) if the target is outside of it's rotation limits. This same trick is used to make it go the long way around to reach it's target if it moves to the other side.

NB: This additional code is totally unnecessary if your turret base can rotate a full 360 degrees. It's only needed if you want to limit your turrets base rotation to a value between 90 and 179 degrees.

Why did I ever bring this subject up? Hehe.

Somebody fucked around with this message at 22:31 on Feb 14, 2013

Shindragon
Jun 6, 2011

by Athanatos
So I had this question for a while, and it's been bothering me a bit (sorry if it's stupid). So while I do get the size for characters for platforming and shumps. I seem a little stump with beat em ups.

Any chance someone can put me up in a idea with what I should go for? So far 250x250 is what I think might be the max height but I"m pretty sure I have to go lower.



Just a rough idea of what I want to do.

Fur20
Nov 14, 2007

すご▞い!
君は働か░い
フ▙▓ズなんだね!

Shindragon posted:

So I had this question for a while, and it's been bothering me a bit (sorry if it's stupid). So while I do get the size for characters for platforming and shumps. I seem a little stump with beat em ups.

Any chance someone can put me up in a idea with what I should go for? So far 250x250 is what I think might be the max height but I"m pretty sure I have to go lower.



Just a rough idea of what I want to do.

Depends on your target screen size. 1280x700? 1440x900? 1920x1080? Platformer-types will have dudes that take up, what, I'd estimate maybe 3-5% of the screen max. If you look at Final Fight or Streets of Rage, Cody or Haggar or Axel take up maybe 10-15% of the screen real estate? Base your sprite sizes on that in relation to your target resolution.

NorthByNorthwest
Oct 9, 2012
Semi Screenshot saturday! :toot:
I'm doing games for One Game A Month. Today, I was trying my hand at concept sketches and modeling.


I've tried blender's rigging, but it's best guess on how to move the model was completely off :(
Hopefully I can get it to work!

blackflare
Dec 6, 2004

I am a Purrrfect Princess

I've been learning how to program with python for the past month or so, and I'm trying to work my way up to building a little "game" as practice. So far my concept is a simulation where bacteria wander around eating food and multiplying / dying. I am pretty sure I will be able to get that part working eventually, but longterm I want to see if I can have them inherit traits and mutate. I'm just curious how other people might go about doing that. I could assign them a bunch of traits like speed and movement patterns and stuff, with random values, but I feel like that doesnt allow for any meaningful mutations. All I would end up with eventually is a bacteria with maxed stats in everything. Is there a way to make a simple form of actual random mutation for them?

Polio Vax Scene
Apr 5, 2009



What classifies as a meaningful mutation? I actually did something like that a long time ago and faced the same problem. What might work is attaching each beneficial mutation with a tradeoff. For example a faster or stronger bacteria would use up more energy. A bacteria that produces more offspring, each offspring is weaker to start out. A bacteria that matures faster also dies faster and is less likely to reproduce. And so on.

blackflare
Dec 6, 2004

I am a Purrrfect Princess

A mutation would be something unexpected that I didn't explicitly code in from the start I guess. I dunno if such a thing is really possible at my coding level, haha.

edit: I found out the term I was looking for: http://en.wikipedia.org/wiki/Genetic_algorithm interesting reading.

editedit: I got distracted and instead wrote a little thing where I move a bacteria around and it erases a layer over the background to reveal the hidden image :3:

blackflare fucked around with this message at 01:28 on Feb 11, 2013

Wolfgang Pauli
Mar 26, 2008

One Three Seven
You'd need to have the building blocks in place first. Emergence is what happens when you set up the tools, define some rules on how an entity can access them, and introduce randomness. What happens in a genetic algorithm is when the whole becomes greater than the sum of its parts. You're at the point where you need to introduce parts that can be summed.

ZombieApostate
Mar 13, 2011
Sorry, I didn't read your post.

I'm too busy replying to what I wish you said

:allears:
This might be what Manslaughter was implying, but you don't have to explicitly connect "good" and "bad" mutations to each other. If you've ever played any of the Total War games, what you're describing sounds a lot like their system for traits for generals/kings/etc. Some of them are good traits, some of them are terrible traits, but they all get mixed in equally.

It also might be interesting to put in some system for how they choose to breed, so to speak. For instance, all the bacteria that share mostly common, popular mutations breed together and the hunchbacked mutants have to settle for other hunchbacked mutants. Until the hunchbacked mutants become the new super race. And then you could add things like mating dances and now it's becoming really obvious that I watch too many Discovery Channel shows...

PederP
Nov 20, 2009

Blackflare, while not technically a game, try looking at Conway's Game of Life. Implementing that might be good practice for a more advanced bacteria simulator. Anyways, it is a really good choice for someone who is learning to program to get a bit of experience.

ClownSyndrome
Sep 2, 2011

Do you think love can bloom on bob-omb Battlefield?
Current progress on Farmvasion: 2132



(there is a bug with fonts in this version, so the score looks a bit messed up)

Playing as the Piggy farmer in this level, Wheat is starting to grow near the player, two enemies are wandering around and another one is warping in through a portal

Getting there I think, hoping to have the game done soon. Mostly trying to balance the difficulty in each of the levels at the moment

Somebody fucked around with this message at 22:30 on Feb 14, 2013

The Cheshire Cat
Jun 10, 2008

Fun Shoe

ZombieApostate posted:

It also might be interesting to put in some system for how they choose to breed, so to speak. For instance, all the bacteria that share mostly common, popular mutations breed together and the hunchbacked mutants have to settle for other hunchbacked mutants. Until the hunchbacked mutants become the new super race. And then you could add things like mating dances and now it's becoming really obvious that I watch too many Discovery Channel shows...

This is actually a pretty interesting idea; that shared traits could be used as a factor for breeding, even if those traits are negative. It would certainly help to counteract the initial problem you mentioned, where over time everything just ends up with capped out stats as the weaker ones get weeded out by natural selection. It would also help to reflect those odd little quirks in nature where certain species evolve this highly complicated biological or behavioural mode of breeding that if anything seems like it would impair the process more than facilitate it.

You might find this blog post interesting. It's about a similar game concept where you have a bunch of entities that evolve collectively over time. You as the player are the predator in the ecosystem, so only the ones that are best at evading you would survive to breed. His solution to the "maxed out stats" problem is to have it all gains be zero sum, so a gain in one area has an equivalent loss in another. Improvement would be a bit more cyclical than linear, which is a bit rock-paper-scissors-ish, but it does simplify the design enough to allow the player to understand it enough to take advantage of it (this might not be so relevant a design choice in a hands-off simulation though).

blackflare
Dec 6, 2004

I am a Purrrfect Princess

Thanks for all the advice and links :) This is getting to be a lot of fun. I feel like I finally got over the hump where I at least partially understand all the tools I have to work with. I got a raspberry pi as a teaching tool for myself, and I've had a good time disassembling the sample programs line by line and understanding what it does. I'm gonna keep working at this bacteria thing for more practice.

Wolfgang Pauli
Mar 26, 2008

One Three Seven
Crossposting from the General Programming thread. In addition to the edX courses I already posted, Coursera is offering part 1 of the Algorithms class they run through Princeton. It's Java-based and is going to cover searching and sorting. It's already begun and the first assignments are due in a week, so jump in before then. Part 2 starts next month (as soon as Part 1 ends) and is going to get into Algorithms of Note that carry fancy names like Dijkstra and Kosaraju.

Wolfgang Pauli fucked around with this message at 03:28 on Feb 12, 2013

Beelzebub
Apr 17, 2002

In the event that you make sense, I will still send you to the 7th circle.

Looking slick!

Finally got some time to make a little progress on my python project.



http://youtu.be/aKsnIHsHeLE

Be sure to adjust the quality settings up to 1080p.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Beelzebub posted:

Looking slick!

Finally got some time to make a little progress on my python project.



http://youtu.be/aKsnIHsHeLE

Be sure to adjust the quality settings up to 1080p.

:monocle:

Holy cow dude. You got some wicked art in still and motion.

Wolfgang Pauli
Mar 26, 2008

One Three Seven

Beelzebub posted:

Looking slick!

Finally got some time to make a little progress on my python project.
That looks fantastic. Are you using Pygame or something else?

I do question the wisdom of a people who would build a windmill halfway up a hill and next to a bunch of trees, but I think beer is a pretty good explanation.

Beelzebub
Apr 17, 2002

In the event that you make sense, I will still send you to the 7th circle.
Thanks guys! I'm using Pyglet for the OpenGL and speed, a module called Rabbyt to handle sprites, and PIL for funky collisions against an image mask.

Beelzebub fucked around with this message at 15:44 on Feb 13, 2013

Nition
Feb 25, 2006

You really want to know?




Medium chassis and small chassis being friends. Yes, the medium chassis' configuration is retarded and the back guns will shoot the front guns.

blowingupcasinos
Feb 21, 2006
Nition, those images are giving me a boner.

Ol Uncle Anime
Jul 3, 2009

And no one ate dinner that night.
So I shipped my first commercial-ish game today: Depression Quest. And now I want to sleep for a year.

Vino
Aug 11, 2010
I just played Depression Quest (saw it on RPS) and it's good, congratulations. I'm not a depressed person myself but I know some people very close to me who are and I think I learned some things about how to deal with them. Thanks for making it.

On a completely unrelated note and at the risk of taking some of your thunder, I just released a new Math for Game Developers video that goes over dot products:

https://www.youtube.com/watch?v=Q9FZllr6-wY

I'm finally past all the boring vector arithmetic and getting into something a bit more advanced! :D

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?

Vino posted:

I'm finally past all the boring vector arithmetic and getting into something a bit more advanced! :D
Quaternions. Please, for the love of all that is holy, teach the world not only how to use quaternions, but what they're actually representing.

I would love you forever. :unsmith:

Vino
Aug 11, 2010

Shalinor posted:

Quaternions. Please, for the love of all that is holy, teach the world not only how to use quaternions, but what they're actually representing.

I would love you forever. :unsmith:

Yeah quaternions are advanced and I'll get to it eventually, but I can explain a simple intuition for it right now. The x y and z parts of the quaternion specify an axis of rotation, and the w part specifies the magnitude of the rotation. The trouble is that it's normalized so the more rotated you get the smaller the x y and z values get. When w approaches 1 it means that your rotation approaches 360 degrees around the axis, but at the same time the x y and z approach 0. However the values of x y and z don't change relative to each other - ie the axis of rotation doesn't change. You can add a rotation by pre-multiplying the quaternion by the rotation you want. Does that make sense?

Antinumeric
Nov 27, 2010

BoxGiraffe

Vino posted:

Yeah quaternions are advanced and I'll get to it eventually, but I can explain a simple intuition for it right now. The x y and z parts of the quaternion specify an axis of rotation, and the w part specifies the magnitude of the rotation. The trouble is that it's normalized so the more rotated you get the smaller the x y and z values get. When w approaches 1 it means that your rotation approaches 360 degrees around the axis, but at the same time the x y and z approach 0. However the values of x y and z don't change relative to each other - ie the axis of rotation doesn't change. You can add a rotation by pre-multiplying the quaternion by the rotation you want. Does that make sense?

No offense but the person saying that x,y,z represents a vector direction. And w represents how much you rotate around that vector. I know that is what you said but honestly my mind just glazed over the way you said it.

The best I've found to get a handle on them I've found is to play around with WolframAlpha:

Rotation around the vector (1,1,1)
Rotation around z-axis (0,0,1)

END CHEMTRAILS NOW
Apr 16, 2005

Pillbug

Ol Uncle Anime posted:

So I shipped my first commercial-ish game today: Depression Quest. And now I want to sleep for a year.
I just finished this, and I was impressed. Certain parts reminded me of someone I know, and I found it very moving. I couldn't afford much at the moment, but I gave a small contribution. I hope a lot of people will try it.

Adbot
ADBOT LOVES YOU

Vino
Aug 11, 2010

Antinumeric posted:

No offense but the person saying that x,y,z represents a vector direction. And w represents how much you rotate around that vector. I know that is what you said but honestly my mind just glazed over the way you said it.

The best I've found to get a handle on them I've found is to play around with WolframAlpha:

Rotation around the vector (1,1,1)
[url=http://www.wolframalpha.com/input/?i=quaternion%3A+1%2B0i%2B0j%2B1k]Rotation around z-axis (0,0,1)[/url]

That's a good way to do it but remember quaternions used in video games are normal length ie sqrt(x*x + y*y + z*z + w*w) = 1. The quats you put into WA aren't normalized. It's not really that important though unless you're multiplying two quats together, I think.

Maybe it helps to think of quats as a special kind of axis-angle representation of rotations. x y and z are the axis and w is how much you rotate.

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