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
Hover
Jun 14, 2003

Your post hits a tree.
The tree is an ent.
The tree is angry.
Has anyone had any experience with Dark GDK yet? (http://www.microsoft.com/express/samples/GameCreators/) I just found out about it a month or so ago while I was downloading the beta for VS2008. Apparently they struck some sort of deal with Microsoft and it's free to download with VS. I've been messing around with it to make something I can show off to employers since I'll be applying for jobs in the upcoming months, and it seems decent. I can't for the life of me find decent documentation on it other than it's help file, which is adequate I suppose. I've gone from getting completely lost using DirectX, to making a few things in OpenGL, to this, so it's definitely easier to get a grasp of.

Adbot
ADBOT LOVES YOU

mike_thedestroyer
Aug 12, 2007
When the US collides with the World!

Hover posted:

Has anyone had any experience with Dark GDK yet? (http://www.microsoft.com/express/samples/GameCreators/) I just found out about it a month or so ago while I was downloading the beta for VS2008. Apparently they struck some sort of deal with Microsoft and it's free to download with VS. I've been messing around with it to make something I can show off to employers since I'll be applying for jobs in the upcoming months, and it seems decent. I can't for the life of me find decent documentation on it other than it's help file, which is adequate I suppose. I've gone from getting completely lost using DirectX, to making a few things in OpenGL, to this, so it's definitely easier to get a grasp of.

Its a fairly good tool. Try looking for Documentation on "Dark Basic Pro" online as it shares the same names for feature sets. Its a good Rad tool, and sufficiently fast. I used to it map out an Ogre game in several days.

It also supports just as much as the major competition, overall It is very well made.

Krapfen
Jul 9, 2001

Seems like some of you guys have quite some experience in game development. What language would you recommend to somebody starting out? I'm very experienced with PHP and have programmed some complicated stuff in C, too. Some time ago I started learning C++, but to be honest, I didn't really like it (as opposed to C, which I like a lot!), stuff like overloading operators just seemed weird/hackish to me. Reading this thread it seems like a lot of people develop newer games using C#, which I find quite surprising considering C# is slow compared to lower level languages like C/C++ (?) and requires people to install .NET/Mono.

I'm using a MacBook and Leopard, so Ruby, Python, C, C++ and C# (using Mono, obviously without XNA) are my most obvious options (comedy Obj-C option). I'd love to learn Ruby or Python, because I could use them outside of game/demo development (for system administration tasks and GUI or web applications), but they seem quite limited for game/demo development (slow, no "professional" frameworks like XNA or DirectX available). I don't plan on developing professional / commercial grade games, 2D and simple 3D should be alright, but then again you never know where you'll end up...

hey mom its 420
May 12, 2007

You shouldn't start out worrying too much about the speed of languages if you're not doing Doom 4 to begin with. As long as you keep the code clean, simple and your algorithm complexity in check, basically anything works fine. I'd suggest giving Python along with PyGame a go. Python is a great language and can be used for all sorts of stuff and PyGame is also a good game library, although I find it could be documented a bit more thoroughly.
Also it's pretty easy to extend Python with C code if you run into problems that Python's speed can't handle. Most of PyGame is written in C.

stramit
Dec 9, 2004
Ask me about making games instead of gains.

Krapfen posted:

I'm using a MacBook and Leopard, so Ruby, Python, C, C++ and C# (using Mono, obviously without XNA) are my most obvious options (comedy Obj-C option). I'd love to learn Ruby or Python, because I could use them outside of game/demo development (for system administration tasks and GUI or web applications), but they seem quite limited for game/demo development (slow, no "professional" frameworks like XNA or DirectX available). I don't plan on developing professional / commercial grade games, 2D and simple 3D should be alright, but then again you never know where you'll end up...

I'm going to go against what I assume will inevitably become the grain here and say Java. My reasons are this:
  • Contrary to popular belief the language is not slow, I feel it gets that wrap due to 'university syndrome' kids come out of college only knowing Java, and not how to 'really' code and release a large number of slow applications;
  • The graphics libraries for OpenGL are exactly like using OpenGL in C, C++ ect;
  • The IDE's are great;
  • Once you get good at it it's quite easy to pick up C++;
  • It's easier to write cross platform graphical applications then with C++ if you are a beginner.

Here are some links to get you started:
http://lwjgl.org/
http://www.jetbrains.com/idea/
http://www.javagaming.org/forums/index.php

Alternatively if you are a die-hard no Java kind of person have a look at Python and Groovy. Python is pretty cool, and Groovy is a scripting language which compiles down (at load time) to Java Byte Code so you can still use Java libraries like lwjgl!

Peanutmonger
Dec 6, 2002
If you're really most comfortable with C, you can try fooling around with SDL. It's a C library and it's very easy to use. I've got a few projects that I toy with that use it when I have the urge to write games (SDL complications are never what make me stop though, just my re-sorting priorities). As an added bonus, SDL is cross-platform, and all of the projects I've made I end up working on them both in Windows and Linux (as long as I keep my autotools/VC++ Express files up to date). SDL handles all of the window creation/rendering, so it renders identically without any code modifications. You can also move to using opengl rendering in SDL if you get tired of 2D, though I've never done such.

As Bonus said, though, don't bother choosing C if your reasoning is for speed. First games are more like prototyping than anything, where pumping out simple but progressively better games is the best learning method. It's also the most satisfying, because it provides a juicy carrot every time you finish one which, at times, is useful when you're running out of motivation. So, really, choose whatever you're best with. I just wanted to let you know that C is still an option if you're stubborn and slightly masochistic like myself.

PnP Bios
Oct 24, 2005
optional; no images are allowed, only text
If people are still interested in doing 2D with OpenGL, I wrote a pretty good C library for doing so. It can be downloaded at http://joel.slylabs.com/?q=node/4 . The documentation is here http://joel.slylabs.com/?q=node/12 , and a tutorial for getting it set up with SDL can be found here http://joel.slylabs.com/?q=node/14 .

I even used it for my final graphics project.

Lankiveil
Feb 23, 2001

Forums Minimalist
I'd like to thank whoever suggested XNA, I downloaded it and poked through the sample application, and it looks simple enough even for a dummy like me to understand.

FlyingDodo
Jan 22, 2005
Not Extinct

HB posted:

By "basic fps camera" do you mean a camera that uses Euler angles? If you can convert the angle and axis from a quaternion to an orientation matrix, you can use it to transform the camera just like any other object.

Then, to spin the camera around a relative axis like in Descent, you transform the target axis with the camera quaternion, convert the result and the magnitude to a quaternion, and multiply it back into the camera orientation.

If that didn't make any sense, I can try to find the book I got this from in the first place. It's been a really long time since I had to work with quaternions.


No didn't make any sense :(. I'm not very good at maths. All I want is to be able to do is rotate things around for a space game. Like rotating spaceships around all possible orientations, based on pitch/roll/yaw.

haveblue
Aug 15, 2005



Toilet Rascal

FlyingDodo posted:

No didn't make any sense :(. I'm not very good at maths. All I want is to be able to do is rotate things around for a space game. Like rotating spaceships around all possible orientations, based on pitch/roll/yaw.

And yet, you have a quaternion class :)

There are 2 things you need to be able to do to implement Descent-style movement- change the value of a quat by combining it with another quat, and generating a rotation matrix equivalent to a given quat. These are probably already methods of your class, but if they're not:

The first one is accomplished by multiplying the two quats together. If c is the cosine of the angle in the quat and v is the axis around which it is rotated:

code:
void MultiplyQuats(Quaternion *op1,Quaternion *op2,Quaternion *result)
{
    result->c = op1->c*op2->c - (op1->v.x*op2->v.x + op1->v.y*op2->v.y + op1->v.z*op2->v.z);
    result->v.x = op1->c*op2->v.x + op1->v.x*op2->c + (op1->v.y*op2->v.z - op2->v.y*op1->v.z);
    result->v.y = op1->c*op2->v.y + op1->v.y*op2->c + (op2->v.x*op1->v.z - op1->v.x*op2->v.z);
    result->v.z = op1->c*op2->v.z + op1->v.z*op2->c + (op1->v.x*op2->v.y - op2->v.x*op1->v.y);
}
The result of this operation is a quat containing the orientation you'd get by rotating through op1 and then through op2, just like concatenating matrix transformations.

The next thing you want to be able to do is generate the rotation matrix. I'm guessing you can already do this because you say you can use the quats for a basic camera, but still:
code:
void RotationMatrixFromQuat(Quaternion *src, float result[4][4])
{

    result[0][0] = 1.0 - 2.0*(src->v.y*src->v.y+src->v.z*src->v.z);
    result[0][1] = 2.0*src->v.x*src->v.y-2.0*src->c*src->v.z;
    result[0][2] = 2.0*src->c*src->v.y+2.0*src->v.x*src->v.z;
    result[0][3] = 0.0;
    
    result[1][0] = 2.0*src->v.x*src->v.y + 2.0*src->c*src->v.z;
    result[1][1] = 1.0 - 2.0*(src->v.x*src->v.x+src->v.z*src->v.z);
    result[1][2] = -2.0*src->c*src->v.x + 2.0*src->v.y*src->v.z;
    result[1][3] = 0;

    result[2][0] = -2.0*src->c*src->v.y + 2.0*src->v.x*src->v.z;
    result[2][1] = 2.0*src->c*src->v.x + 2.0*src->v.y*src->v.z;
    result[2][2] = 1.0 - 2.0*(src->v.x*src->v.x + src->v.y*src->v.y);
    result[2][3] = 0;

    result[3][0] = 0;
    result[3][1] = 0;
    result[3][2] = 0;
    result[3][3] = 1;
}
This will transform a vector around the origin by the angle and around the axis that were in the quat.

Now, to let the ship move along a camera-relative axis, you take the axis you want to move along (say, forward, which is probably along the positive Z axis), transform it by the quaternion, and then add the resulting vector to the ship's position.

code:
void Ship::TranslateAlongRelativeVector(double vector[3])
{
     //member: Quaternion q;
     //member: float position[3];
     float tempMatrix[4][4];
     float absoluteDirection[4];
     RotationMatrixFromQuat(q, tempMatrix);
     MultiplyMatrixAndVector(tempMatrix, vector, absoluteDirection);
     position[0] += absoluteDirection[0];
     position[1] += absoluteDirection[1];
     position[2] += absoluteDirection[2];
}
And there you have it- {0,0,1} becomes whatever that is to make it point directly into the screen in the camera's current orientation, and then the ship is moved in that direction.

Rotation is a bit trickier, because after performing the same initial steps you have to modify the quaternion with the result:

code:
void Ship::RotateAroundRelativeVector(double axis[3], float magnitude)
{
     //member: Quaternion q;
     //member: float position[3];
     float tempMatrix[4][4];
     float absoluteDirection[4];
     Quaternion delta;
     RotationMatrixFromQuat(q, tempMatrix);
     MultiplyMatrixAndVector(tempMatrix, axis, absoluteDirection);
     delta = QuaternionFromAxisAndAngle(absoluteDirection, magnitude);
     q = MultiplyQuats(q, delta);
}
That should give you a Descent spaceship with the right arguments (which depend on the rest orientation of your camera).

I should probably admit that I couldn't actually find the book and that's all based on old code, but I remember that it used to work. Hope it helped!

haveblue fucked around with this message at 21:33 on Dec 30, 2007

captain_g
Aug 24, 2007

Stramit posted:

I'm going to go against what I assume will inevitably become the grain here and say Java. My reasons are this:
  • Contrary to popular belief the language is not slow, I feel it gets that wrap due to 'university syndrome' kids come out of college only knowing Java, and not how to 'really' code and release a large number of slow applications;
  • The graphics libraries for OpenGL are exactly like using OpenGL in C, C++ ect;
  • The IDE's are great;
  • Once you get good at it it's quite easy to pick up C++;
  • It's easier to write cross platform graphical applications then with C++ if you are a beginner.

Here are some links to get you started:
http://lwjgl.org/
http://www.jetbrains.com/idea/
http://www.javagaming.org/forums/index.php

Alternatively if you are a die-hard no Java kind of person have a look at Python and Groovy. Python is pretty cool, and Groovy is a scripting language which compiles down (at load time) to Java Byte Code so you can still use Java libraries like lwjgl!

This is and has been bullshit. Some languages simply are faster than others. I ported a rigid body dynamics library that uses separation axis theorem from c++ to java. The code is identical and built concurrency in mind, however c++ does 800 objects fine whereas the java version chokes on a dick after 200 objects. If you like an avalanche of words I invite you to read my rant of an anecdote:

I posted the results and the code of my rigid body dynamics experiment to a well known java forum and asked what I was doing wrong. I actually anticipated to get constructive criticism that would speed up my code, but instead I got angry and frustrated responses "YOU ARE NOT DOING THINGS JAVA WAY. :argh:"

At first I thought I had hosed up my monitors and I was locking and unlocking my resources unnecesary, but after searching and profiling my code I found out that most of the time is spent in vector math calls. Oh well, time to check back to that java forum where the thread had received almost 90 answers at this point.

Constructive criticism, Let Me In On This!

Little did I know that according to java.sun.com forums I should store temporary classes and variables as static variables within the class. A++ all credibility gone. And if I wasn't doing things the Java way, how the gently caress should I do things? The argument JAVA IS SLOW gets shot down as flamewar far too often and I've yet to see a reasonable excuse why it is, in fact, so loving slow. Surely it isn't the fact that JAVA IS THE FUTURE. JAVA WAS THE loving FUTURE TEN YEARS AGO AND I STILL DON'T HAVE FAST ENOUGH COMPUTER TO RUN IT PROPERLY.

Also LWJGL is worthless library. Search javagaming.com for "concurrency" and you'll see one of the librarys main developers is a beligerent twit who spouts out poo poo like "Concurrency will never work out for games, this is why we'll implement lwjgl in a manner that concurrency is impossible to add later on." Remember that all this was said when apples started to come out with dual cores, so not that long a go.

I am not saying java isn't for game development. I am just saying that if your design document incorporates Java and Feasible in a competitive mass market game, better get back to the drawing board. It's a good language to build roguelikes, 2d rpgs and other innovative stuff. When used so, it can also be commercially feasible (see "Tribal Trouble"), but it isn't a FAST language, by no means. Sometimes that speed matters, granted not when you are starting out, but the second you gain ambitions Java becomes too slow. It turns into a bottle neck, with a cork on and you're inside of it, stuck without a way out.

captain_g fucked around with this message at 11:18 on Dec 27, 2007

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
Maybe this is deserving of its own thread, but since it is related to game development, I thought I would start here.

Preface: I'm building a wargaming utility designed to enable players to play without necessarily being face to face. Think Warhammer or Warmachine over the internet. I'm handling the unit and rules logic via scripting files so the utility is extensible when new rules supplements are available. That way a person can have access to the content of an arbitrary set of units/books.

However, I'm not in the piracy business, and want to limit the access to these rules files to specifically authed clients. (Ie, those who have purchased the most recent rules supplement.) So it becomes necessary to encode these scripted files in a way that links them to a specific client. That way User A cannot give his files to User B -- User B has to own his own copy of the script files.

Now, I've very little knowledge about fancy encrypting technologies. The most obvious solution to me is to zip the scripts files using a password that is unique to each client. (Maybe an MD5 of their username, or something similiar. Something the end user is unlikely to know, but is quick to determine algorithmically.) Then I can just use a zipping library to unzip the script file into memory at runtime.

Anyone have any suggestions? Ideas? Also, how secure is my idea? I know that I won't be able to stop dedicated crackers using this technique, but how long would it hold of a curious nerd?

stramit
Dec 9, 2004
Ask me about making games instead of gains.

captain_g posted:


I'm just going to start by saying that your response is massively disproportional in tone to what I wrote, it's like you're trying to start a flame war. I'm going to try an remain quite cool and calm here as I really don't feel like getting into an argument over the internet about this, but I will address your points.

quote:

This is and has been bullshit. Some languages simply are faster than others. I ported a rigid body dynamics library that uses separation axis theorem from c++ to java. The code is identical and built concurrency in mind, however c++ does 800 objects fine whereas the java version chokes on a dick after 200 objects. If you like an avalanche of words I invite you to read my rant of an anecdote:
Never once in my piece did I say that Java was as fast, or faster then C / C++. The truth is that it isn't, and this is why I program in C++ these days due the the speed advantages it has over Java. The point I was making was that for someone who is a beginner to game programming, and wants to write a cross platform game with a minimum of issues, Java is a reasonable solution.

quote:

I posted the results and the code of my rigid body dynamics experiment to a well known java forum and asked what I was doing wrong. I actually anticipated to get constructive criticism that would speed up my code, but instead I got angry and frustrated responses "YOU ARE NOT DOING THINGS JAVA WAY. :argh:"
The Java community is not very receptive when people go "My code was fast in c and slow in Java, what have I done wrong". I agree that this is a problem, but the point they were making is still valid, you do have to program differently in Java to the way you program in C++. I have seen quite a few new C++ programmers who have come from Java land and have big problems. The same goes in the other direction as well. The community SHOULD have tried to help you not flame you, but there point still stands.

quote:

At first I thought I had hosed up my monitors and I was locking and unlocking my resources unnecesary, but after searching and profiling my code I found out that most of the time is spent in vector math calls. Oh well, time to check back to that java forum where the thread had received almost 90 answers at this point.

Constructive criticism, Let Me In On This!

Little did I know that according to java.sun.com forums I should store temporary classes and variables as static variables within the class. A++ all credibility gone. And if I wasn't doing things the Java way, how the gently caress should I do things?
Once again it's an issue with the community not the language. You can get some pretty decent feedback in CoC you know, maybe you should try here. Why does this lead to the credibility of the language dissolving? Also what you say here:

quote:

Little did I know that according to java.sun.com forums I should store temporary classes and variables as static variables within the class.
Sounds quite fishy as the JIT compiler is designed with these things in mind. You may have received some bad advice even.

quote:


The argument JAVA IS SLOW gets shot down as flamewar far too often and I've yet to see a reasonable excuse why it is, in fact, so loving slow. Surely it isn't the fact that JAVA IS THE FUTURE. JAVA WAS THE loving FUTURE TEN YEARS AGO AND I STILL DON'T HAVE FAST ENOUGH COMPUTER TO RUN IT PROPERLY.
That's because it is (the argument that is). I have used it on mission critical application servers, where high performance is an imperative. I have personally witnessed how fast it can go in 'application' space. Some of the products I have worked on would take many more man years to develop and test properly in C++. Java lends itself to large scale systems. Yes there are some performance trade offs but trust can be placed in the platform for use in enterprise applications where 'systems' languages are falling behind.

quote:

Also LWJGL is worthless library. Search javagaming.com for "concurrency" and you'll see one of the librarys main developers is a beligerent twit who spouts out poo poo like "Concurrency will never work out for games, this is why we'll implement lwjgl in a manner that concurrency is impossible to add later on." Remember that all this was said when apples started to come out with dual cores, so not that long a go.
I'm not going to disagree that he is a twat for saying that, multi threading is the future of gaming. But the point remains that LWJGL (from a graphics perspective) is a direct OpenGL binding for Java. OpenGL is state machine which is not respondent to user land multi threaded code. There is no point in LWJGL currently supporting multi threading as serialisation still needs to be performed when native code is reached, and the graphics context can only be active on a single thread at a time.

quote:

I am not saying java isn't for game development. I am just saying that if your design document incorporates Java and Feasible in a competitive mass market game, better get back to the drawing board. It's a good language to build roguelikes, 2d rpgs and other innovative stuff. When used so, it can also be commercially feasible (see "Tribal Trouble"), but it isn't a FAST language, by no means. Sometimes that speed matters, granted not when you are starting out, but the second you gain ambitions Java becomes too slow. It turns into a bottle neck, with a cork on and you're inside of it, stuck without a way out.
I disagree, Java is very suited as a language for hobby developers. For large scale , AAA, games I don't think it is suitable. For rapid development but for deployment of indie / hobbie games it's great.


Edited for some typos / clarification, I had to rush the original post :S

stramit fucked around with this message at 14:11 on Dec 28, 2007

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

Pfhreak posted:

Anyone have any suggestions? Ideas? Also, how secure is my idea? I know that I won't be able to stop dedicated crackers using this technique, but how long would it hold of a curious nerd?

A few minutes. Maybe an hour, tops.

That said, it's probably a very good way to go about this. You simply can't prevent someone dedicated from accessing the data you have to send them, so it's not worth trying. The benchmark you should be aiming for is to prevent "casual" or "accidental" piracy, without impeding "normal" use or causing yourself a massive hassle. Your proposed solution sounds like it meets this benchmark well.

You'll probably want to use an HMAC to create the secret key for the username, just so you can't be defeated by a trivial google search or something like that. I wouldn't bother putting any more thought or effort into it than that. You just need to get to the point where if someone pirates the data, it is obvious that they did so intentionally and with forethought -- at that point, you are legally in a much better position, and it's unrealistic to assume you can do any better.

POKEMAN SAM
Jul 8, 2004
Anyone familiar with the XNA XML Content Importer? I know you can read in an XML file into a standard type (like String) very easily and stick it in a variable of the corresponding type, but is there an easy way to do it with user-defined classes without writing a ContentReader/Writer? I really just want to have a class that has a few strings, a few booleans, etc. and have the Content Processor load a simple XML file into an object of the class. The problem I'm running into right now, though (without a Content Processor Extension Library) is that the Content Importer cannot find the type, e.g. in the XML:

code:
<Asset Type="GameSettings"><Title>Game Name</Title></Asset>
The Content Importer throws an error that it "Content\GameSettings.xml(3,10): error : There was an error while deserializing intermediate XML. Cannot find type "GameSettings".". I guess I just don't know where it's looking for the GameSettings type; I've tried adding the namespace to the beginning but it didn't help.

This is for something that's supposed to be lightweight, and I thought I could get away with importing an XML file into a custom class without writing a special Reader/Writer for it.


Edit: I got a simple enough system working for my needs. Thanks.

POKEMAN SAM fucked around with this message at 05:14 on Dec 29, 2007

FlyingDodo
Jan 22, 2005
Not Extinct

HB posted:

code:
void Ship::RotateAroundRelativeVector(double axis[3], float magnitude)
{
     //member: Quaternion q;
     //member: float position[3];
     float tempMatrix[4][4];
     float absoluteDirection[4];
     Quaternion delta;
     RotationMatrixFromQuat(q, tempMatrix);
     MultiplyMatrixAndVector(tempMatrix, axis, absoluteDirection);
     delta = QuaternionFromAxisAndAngle(axis, magnitude);
     q = MultiplyQuats(q, delta);
}

I'm a bit lost here. I'm assuming that MultiplyMatrixAndVector(tempMatrix, axis, absoluteDirection); multiplies axis by tempMatrix and stores the result in absoluteDirection. So why is delta made from axis and magnitude. Shouldn't it be absoluteDirection and magnitude?

haveblue
Aug 15, 2005



Toilet Rascal

FlyingDodo posted:

I'm a bit lost here. I'm assuming that MultiplyMatrixAndVector(tempMatrix, axis, absoluteDirection); multiplies axis by tempMatrix and stores the result in absoluteDirection. So why is delta made from axis and magnitude. Shouldn't it be absoluteDirection and magnitude?

Sorry, you're right. It should be absoluteDirection.

Pfhreak
Jan 30, 2004

Frog Blast The Vent Core!
Fixed my problem. Thanks!

Pfhreak fucked around with this message at 07:31 on Jan 1, 2008

FlyingDodo
Jan 22, 2005
Not Extinct

HB posted:

Sorry, you're right. It should be absoluteDirection.

I'm still having problems trying to make this all work. I made a class which is easy to use (well if it worked properly it would be). All you have to do is give it axis/angles and it gives back an opengl matrix. For some reason it only works for rotations around one axis at a time, otherwise it goes all weird. I hate to dump a wall of text but could you take a look at my code? There must be some mistake in it somewhere that I can't find.
http://rafb.net/p/jNVHEl32.html

haveblue
Aug 15, 2005



Toilet Rascal

FlyingDodo posted:

I'm still having problems trying to make this all work. I made a class which is easy to use (well if it worked properly it would be). All you have to do is give it axis/angles and it gives back an opengl matrix. For some reason it only works for rotations around one axis at a time, otherwise it goes all weird. I hate to dump a wall of text but could you take a look at my code? There must be some mistake in it somewhere that I can't find.
http://rafb.net/p/jNVHEl32.html

Do you mean that if you use, say, <0,1,0> as the axis it works fine, but <0, .7071, .7071> generates garbage?

FlyingDodo
Jan 22, 2005
Not Extinct
It works rotating along any one axis at a time, no matter the axis. But if I have something like:

Transformer t;//stores the current orientation
double lr; //left/right angle change this frame
double ud; //up/down angle change this frame

and then do this:

t.rotateRelative(Vector3(0,1,0),lr);
t.rotateRelative(Vector3(1,0,0),ud);

It goes weird.
If I only have one call to rotateRelative, no matter the axis, it will work fine.

minidracula
Dec 22, 2007

boo woo boo
Random question: is anyone working (or has anyone worked with) with either BlitzMax (or any Blitz Research tools) or Game Maker, or similar tools? I ask because I'm starting to take both of these for test drives and see what they can do for me, and I'd love to share notes, get pointers, and hear opinions on both.

For those that don't know, both BlitzMax and Game Maker are relatively inexpensive game development tools. Here's some quick background information:

BlitzMax includes a simple IDE and compiler toolchain for its BASIC-like language, all geared towards game development. Blitz Research makes BlitzMax, and also makes (or made, in the case of the discontinued offerings) the related products MaxGUI, Blitz3D, Blitz Plus, and Blitz Basic. BlitzMax itself focuses on 2D games, but is cross-platform and uses OpenGL. Some members of the community have worked on making a miniature 3D engine for it. Blitz3D would be the obvious choice for 3D work, but it's not cross-platform like BlitzMax is. BlitzMax is $80 USD.

Game Maker, now in version 7 (and with new commercial backing from YoYo Games) is by Mark Overmars, a professor at the University of Utrecht. It's implemented in Delphi and was originally written as a teaching aid for his classes. It's mostly a drag-and-drop type of game creation tool/IDE, although it includes its own scripting language called GML, and allows you to write extensions, which can include DLLs. Game Maker Pro is about $20 USD. Game Maker games only work on Windows, as does Game Maker. 3D support is limited but there, based on Direct3D.

Both BlitzMax and Game Maker can produce games as executables for the relevant platforms. Both tools have successfully been used to create popular (if not blockbuster), novel games, and both have development communities that are alive and talking.

I've recently taken to investigating these two tools (for now; there's a list of other stuff to look at or come back to depending on how I get on with these) for some game ideas I have because I wanted to shorten the time between concept and creation, focus on gameplay, am not necessarily interested in 3D (though that may change later and/or depending on the game idea being developed), and because they seem to represent good value for money in those dimensions. I have some pre-existing (amateur) experience in game design and development, some experience with OpenGL (primarily related to making visualizations and demos), and lots of experience with AI, though no experience with "game programing" per se (not that I think this is much of an issue). There's obvious limits to using tools like these compared to more commonplace C++, SDL, Allegro, OpenAL, etc. toolchains, but for now I'd love to hear what people have to say about them.

minidracula fucked around with this message at 07:45 on Jan 3, 2008

FBz
Mar 8, 2004
FatboYgw got me this account for my birthday!
I've decided to dive back into XNA again and mess about with it again, but this time in 3D.

I have a spaceship (one of the models you are given with the SDK) and I have it moving around in 3D space quite well. You point it in any direction (up/down/left/right/back/fourth etc.) and it flies along that vector, I've implemented quat’s for proper rotations and all that jazz. What I'd like to do is add proper acceleration. At the moment it accelerates along the vector until it hits full speed, but when you turn it just flies off in that direction instantly, which doesn't really happen in the real world. What I'd like is smoother turning and acceleration, ie. It flies off in one direction then when you turn somewhere else and hit the thrusters again instead of insta-accelerating it gradually gets into its new vector. I have implemented something that half does this but it's totally wrong as it doesn't work 100% of the time. I've tried looking up how to do this but I am blinded by science and formulas and I am not sure how to implement it at all.

What I have so far is:
A vector in which the ship is currently moving (momentum I guess)
A Vector which the ship is pointing in
Current thrust level (could be zero, leaving the ship to 'float' on it's current vector)

I am guessing I need to go from the momentum vector to the new direction vector based on the amount of thrust, but I don't know how.

If someone can tell me how to implement acceleration or point me to a good tutorial (I've looked at loads but most are either 2D and I can't figure out how to translate that to 3D, or they just ramble on about something quite unhelpful) I'd be most grateful. I think I really need an example or it spelt out in English with little words that I can understand :)

FlyingDodo
Jan 22, 2005
Not Extinct
I think I have finally solved my rotation problems. Wrong order of quaternion multiplication. This whole thing has been very :psyduck: .

fryzoy
Sep 21, 2005
What.

FBz posted:

I've decided to dive back into XNA again and mess about with it again, but this time in 3D.

I have a spaceship (one of the models you are given with the SDK) and I have it moving around in 3D space quite well. You point it in any direction (up/down/left/right/back/fourth etc.) and it flies along that vector, I've implemented quat’s for proper rotations and all that jazz. What I'd like to do is add proper acceleration. At the moment it accelerates along the vector until it hits full speed, but when you turn it just flies off in that direction instantly, which doesn't really happen in the real world. What I'd like is smoother turning and acceleration, ie. It flies off in one direction then when you turn somewhere else and hit the thrusters again instead of insta-accelerating it gradually gets into its new vector. I have implemented something that half does this but it's totally wrong as it doesn't work 100% of the time. I've tried looking up how to do this but I am blinded by science and formulas and I am not sure how to implement it at all.

What I have so far is:
A vector in which the ship is currently moving (momentum I guess)
A Vector which the ship is pointing in
Current thrust level (could be zero, leaving the ship to 'float' on it's current vector)

I am guessing I need to go from the momentum vector to the new direction vector based on the amount of thrust, but I don't know how.

If someone can tell me how to implement acceleration or point me to a good tutorial (I've looked at loads but most are either 2D and I can't figure out how to translate that to 3D, or they just ramble on about something quite unhelpful) I'd be most grateful. I think I really need an example or it spelt out in English with little words that I can understand :)

As long as I am not totally misunderstanding you, you should be fine with adding the product of the direction vector (normalized) and thrust scalar to your momentum vector.
So let's say you have D, your direction vector, V, your momentum vector and a your accelleration force scalar, you'd then do D = D + V * a.

TSDK
Nov 24, 2003

I got a wooden uploading this one

fryzoy posted:

As long as I am not totally misunderstanding you, you should be fine with adding the product of the direction vector (normalized) and thrust scalar to your momentum vector.
So let's say you have D, your direction vector, V, your momentum vector and a your accelleration force scalar, you'd then do D = D + V * a.
Nope, D is the constant here and it's V you want to update. For simple newtonian mechanics using euler integration:

D - Ship's forward vector
V - Ship's current velocity
F - Thrust
m - Mass of ship
dt - Timestep

a = F/m
V' = V + D*a/dt

FBz
Mar 8, 2004
FatboYgw got me this account for my birthday!
Thanks fryzoy and TSDK, that worked a treat! Now I need to figure out how to limit the speed, but I think I have an idea on how to do that.

TSDK
Nov 24, 2003

I got a wooden uploading this one

FBz posted:

Thanks fryzoy and TSDK, that worked a treat! Now I need to figure out how to limit the speed, but I think I have an idea on how to do that.
A couple of (artificial) options here which both produce a reasonable handling experience:

1) Introduce drag, such that V' = V*drag ... where drag is between 0 and 1 and proportional to |V|

2) Modulate the thrust downwards proportional to the speed in the desired direction. This is a bit harder to do, and if you don't drop the thrust fast enough then you can end up going very fast just by wiggling from side to side whilst accelerating...

FBz
Mar 8, 2004
FatboYgw got me this account for my birthday!
Just to clarify, is |V| the Length of the Velocity Vector? If so, I think I understand what you're getting at. I'll give this a try when I get home this evening.

What I had before is that I pre-calculated the maximum momentum vector based on my desired maximum speed and prevented the velocity vector from increasing any further when it hit this value, the ship would be travelling in a straight line when it hit this value. I think this was broken (or poorly implemented).

TSDK
Nov 24, 2003

I got a wooden uploading this one

FBz posted:

Just to clarify, is |V| the Length of the Velocity Vector?
Yup. You could even make it proportional to the square of the length, which avoids a square root. Drag in air (which although not correct for space, is what our brains are hard-wired to accept as 'correct') in proportional to the speed cubed, so it will still 'feel' more slippery to control than a plane in the air.

EDIT: Oops, no it's not - the force is proportional to the relative velocity squared; it's the power required to maintain a constant speed against drag that goes up with the cube...

FBz posted:

What I had before is that I pre-calculated the maximum momentum vector based on my desired maximum speed and prevented the velocity vector from increasing any further when it hit this value, the ship would be travelling in a straight line when it hit this value. I think this was broken (or poorly implemented).
Clamping the maximum length of the velocity (note that it's velocity you're talking about, and not a momentum vector, which is something different) doesn't work too well because, as you've probably found, depending on exactly where you get the clamp, you either end up losing all steering at top speed, or the ship suddenly transitions into an 'on rails' mode where it turns incredibly sharply.

TSDK fucked around with this message at 18:22 on Jan 4, 2008

fryzoy
Sep 21, 2005
What.

TSDK posted:

Nope, D is the constant here and it's V you want to update. For simple newtonian mechanics using euler integration:

D - Ship's forward vector
V - Ship's current velocity
F - Thrust
m - Mass of ship
dt - Timestep

a = F/m
V' = V + D*a/dt

Oh yeah that was retarded; I mean that.

SnakeByte
Mar 20, 2004
FUCK THIS COMPANY THAT HASNT PRODUCED THE GAME IN QUESTION FOR YEARS BECAUSE THEY SUSPENDED ME FOR EXPLOITING A BUG FUCK THEM IN THE ASS I AM A MORON
Don't die, Game Development Megathread! I'm taking a few game development electives this year at school. Should be interesting. Game Development / Design, and Game and Simulation Programming I. It's a community college in Texas for anyone that's interested.

Citizen Erased
Mar 20, 2004

Wash Me Away
Sorry to poo poo things up with my odd needs once again. I'm trying to create a series of vertex connected 'segments' that bend in a certain direction. Currently I'm starting the join of each 'segment' at 0,0,0, rotating it and then translating it in the direction it is now facing (by translating along a unit vector which also gets rotated). Each time a new segment is created, the amount to rotate is increased so that along the length of all the segments there's a smooth bending. However, once the unit vector gets rotated a certain amount, when translating along it the verticies start to become squashed and distorted. As you can see from the picture, the bending is smooth and then suddenly flatens off before curling round in the opposite direction. I dumped the values for the unit vector for each segment and the problem seems to occur when the unit vector goes into negative values. Does anyone have any idea what I'm doing wrong? I assume I'm not using the unit vector correctly but I'm not sure where I'm going wrong. Thanks.

The problem(click for big):


The unit vector values:
code:
X0.000, Y0.996, Z0.087, 
X0.000, Y0.966, Z0.259, 
X0.000, Y0.866, Z0.500, 
X0.000, Y0.643, Z0.766, 
X0.000, Y0.259, Z0.966, 
X0.000, Y-0.259, Z0.966, 
X0.000, Y-0.766, Z0.643, 
X0.000, Y-1.000, Z0.000, 
X0.000, Y-0.707, Z-0.707, 
X0.000, Y0.087, Z-0.996, 
The Code:
code:
D3DXMATRIX mTransform;
D3DXMATRIX mRotate;
D3DXMATRIX mTranslate;

...

//floats for rotation
float rotx = 5.0f;
float roty = 0.0f;
float rotz = 0.0f;


//Update the rotation values with the current rotation 
vRotation.x += rotx;
vRotation.y += roty;
vRotation.z += rotz;

//Unit vectors (the vector4 is for use with D3DXVec3Transform and is then copied into the Vector3 for normalization)

D3DXVECTOR4 transformedOrientation;
transformedOrientation = D3DXVECTOR4(0.0f, 1.0f, 0.0f, 0.0f);

D3DXVECTOR3 transformedOrientation2;
transformedOrientation2 = D3DXVECTOR3(0.0f, 1.0f, 0.0f);

//Rotation (convert from degrees to radians)
D3DXMatrixRotationYawPitchRoll(&mRotate, (vRotation.y * (PI / 180)), (vRotation.x * (PI / 180)), (vRotation.z * (PI / 180)));

//Transform the orientation unit vector by the rotation
D3DXVec3Transform(&transformedOrientation, &vOrientation, &mRotate);

//Translate the rotated verts to the desired location
D3DXMatrixTranslation(&mTranslate, vLocation.x, vLocation.y, vLocation.z);

//Shove the VEC4 orientation vector into a VEC3
transformedOrientation2 = D3DXVECTOR3(transformedOrientation.x, transformedOrientation.y, transformedOrientation.z);

//Normalise the VEC3
D3DXVec3Normalize(&transformedOrientation2, &transformedOrientation2);

//Combine the rotation and translation matrixs into a final transform matrix
mTransform = mRotate * mTranslate;

//Transform verticies by this final transformation matrix
D3DXVec3TransformCoordArray(vOutput, sizeof(D3DXVECTOR3), vInput, sizeof(D3DXVECTOR3), &mTransform, iNumPointsPerSeg);

//Update the branch's location vector for the next segment
vLocation.x += transformedOrientation2.x * 2.0f;
vLocation.y += transformedOrientation2.y * 2.0f;
vLocation.z += transformedOrientation2.z * 2.0f;

Hanpan
Dec 5, 2004

I've been working on a side project for some time now, a simple tile engine developed in Actionscript 3 using the Flex framework. It started as a distraction from work, but I have since been looking for alternative languages because AS3 is (obviously) extremely limiting.

I'm not trying to do anything too crazy, just simple 2D stuff (similar to the likes of Cave Story but not to that standard.) I looked around on the web and it seems Python is a good start (since I am a mac user) but I was wondering if anyone has any other suggestions?

Ferg
May 6, 2007

Lipstick Apathy

Hanpan posted:

I've been working on a side project for some time now, a simple tile engine developed in Actionscript 3 using the Flex framework. It started as a distraction from work, but I have since been looking for alternative languages because AS3 is (obviously) extremely limiting.

I'm not trying to do anything too crazy, just simple 2D stuff (similar to the likes of Cave Story but not to that standard.) I looked around on the web and it seems Python is a good start (since I am a mac user) but I was wondering if anyone has any other suggestions?
Even though you've probably burnt yourself out on AS3 while using Flex, you can do some pretty powerful things with AS3 if you use Flash. I write Flash/Flex children's software at work right now, and we've managed to do some semi-3D tile based stuff using Flash as our client frontend. We stuck with Flex for administrative tasks though.

Hanpan
Dec 5, 2004

Twiggy794 posted:

Even though you've probably burnt yourself out on AS3 while using Flex, you can do some pretty powerful things with AS3 if you use Flash. I write Flash/Flex children's software at work right now, and we've managed to do some semi-3D tile based stuff using Flash as our client frontend. We stuck with Flex for administrative tasks though.

I actually have no idea why I typed Flex because I primarily used the Flash IDE. Out of interest, do you have any projects you can show me? My tile engines always seem sluggish but I am more than willing to admit it's probably because I code them badly.
(Although the last project only used two movieclips, the rest was all copypixels!)

Ferg
May 6, 2007

Lipstick Apathy

Hanpan posted:

I actually have no idea why I typed Flex because I primarily used the Flash IDE. Out of interest, do you have any projects you can show me? My tile engines always seem sluggish but I am more than willing to admit it's probably because I code them badly.
(Although the last project only used two movieclips, the rest was all copypixels!)
If you ask me in about a month I can legally show you an example ;) the product is still in development at this point and is due for release at the end of January. Game programming in Flash isn't a foreign concept though. One thing I would definitely suggest is that you push as much code out of Flash as possible. Keep it all in your IDE if you can (we use Eclipse).

Ferg
May 6, 2007

Lipstick Apathy
I've got a licensing question. I don't think I'm alone when I say that I'm pretty dumb when it comes to legal jargon. Can somebody dumb down exactly what the MS-PL and MS-RL actually do? I noticed on Wikipedia that they were officially approved by the OSI but the description of each is pretty lawyerish.

I'm asking this here because I've begun poking around with XNA and I've noticed that majority of the software examples distributed on the XNA page are licensed with MS-PL. I'm wondering if it might be a good license for my XNA games.

biznatchio
Mar 31, 2001


Buglord

Twiggy794 posted:

I've got a licensing question. I don't think I'm alone when I say that I'm pretty dumb when it comes to legal jargon. Can somebody dumb down exactly what the MS-PL and MS-RL actually do? I noticed on Wikipedia that they were officially approved by the OSI but the description of each is pretty lawyerish.

I'm asking this here because I've begun poking around with XNA and I've noticed that majority of the software examples distributed on the XNA page are licensed with MS-PL. I'm wondering if it might be a good license for my XNA games.

MS-PL:
  • If you distribute the source code, you implicitly give everyone rights to use any patents or copyrights you own that the code may infringe upon.
  • Anyone that sues a contributor to the project over a patent claim loses all rights to use the software.
  • Source code, if redistributed, must retain any included copyright or attribution notices.
  • Source code, if redistributed, must be licensed under MS-PL.
  • Waiver of liaibility. No warranties or guarantees are attached to the software.

MS-RL:
Same as MS-PL, but with one added clause:
  • If you incorporate any of the source code into another project and distribute it, you must license the files that use the source code under the MS-RL.

In summary, MS-PL is like the BSD license. It allows any sort of reuse, even incorporation into a larger, proprietary-licensed project, as long as you retain copyrights, notices, and attributions.

MS-RL is like the GPL. If you use any of the source code in a file of another project, that file of the project must be made available under the MS-RL license. It differs from the GPL in that copyrights and attributions in the source code must be left intact, even when incorporated into another project.

Adbot
ADBOT LOVES YOU

Ferg
May 6, 2007

Lipstick Apathy

biznatchio posted:

Licensing stuff
Thanks for this. I had been using the BSD license for a previous project of mine, the MS-PL seems like something I'll think over for my games.

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