|
Kire posted:I'm trying to figure out the mouse support in python. I want to print the coordinates where a user has clicked inside the terminal window.
|
# ? May 28, 2010 13:05 |
|
|
# ? May 13, 2024 10:08 |
|
Hanpan posted:In case anyone cares, the guys at Unity have published a new tutorial which is actually really decent: I wholeheartedly support the creation of a Unity megathread. I've only gotten into it recently, since I've been stubbornly creating a rendering engine in OpenGL for awhile now (there is a SERIOUS lack of good OpenGL-learning resources updated for non-immediate rendering and modern extension usage -- all the most-recommended tutorials are lamentably outdated). But yes, if you're a decent enough programmer to learn an easy high-level (scripting) language (C#, Javascript, Boo Python), you have at your fingertips basically everything you'd want for a nice-looking game with the Unity free version other than dynamic shadows, AND you're licensed to sell it commercially. I've poked around just about every corner of the internet having to do with do-it-yourself game creation, from the hard way (OpenGL/Direct3D/some eclectic mixture of open-source libraries) to the medium-hard way (Ogre3D). I must say, Unity3D is the definitive easy way. If you're not so much interested in learning the fundamentals of game physics/AI/rendering/networking and want to get a functional prototype up and running in a matter of hours, maybe even minutes, then Unity3D is simply the best choice there is. I'm surprised it hasn't been mentioned more, to be honest. It's an incredibly mature engine with an active team and very modern technology -- oh, and it's compatible with basically every platform there is.
|
# ? Jun 2, 2010 05:15 |
|
Could just discuss Unity here?
|
# ? Jun 2, 2010 16:15 |
|
Lately I've been wondering how character creation sliders ( like those in oblivion and most of todays new games ) are coded/done. I searched around and found very few articles on the subject. If anyone got articles, examples of code or some hints ( whatever that is of help ), please reply. Note: I'm refering to those sliders for thin/fat, long/short etc etc...
|
# ? Jun 6, 2010 01:50 |
|
Obsurveyor posted:I have been working on a wrapper for libtcod in Ruby and mouse clicks are the one thing, so far, that simply refuse to work. I can get the coordinates just fine but not whether a mouse button is pressed. I will be continuing work on it this weekend and will let you know if I figure it out. Kire, I imagine you figured this out but in python, it should be as easy as: code:
code:
My issue with Ruby, if anyone cares, was that I had to use :uint8 to read the correct value for the bool in the TCOD_mouse_t struct, not :bool, which probably means I need to do more testing with other bool function arguments and return values.
|
# ? Jun 6, 2010 02:10 |
|
Corrupted Cable posted:Lately I've been wondering how character creation sliders ( like those in oblivion and most of todays new games ) are coded/done. I searched around and found very few articles on the subject. Pretty sure they just adjust the length / distance between two bones... Try: http://www.peachpit.com/articles/article.aspx?p=483773&seqNum=3
|
# ? Jun 6, 2010 02:11 |
|
Corrupted Cable posted:Lately I've been wondering how character creation sliders ( like those in oblivion and most of todays new games ) are coded/done. I searched around and found very few articles on the subject. * Bone push modifiers (making all vertices skinned to a specific bone move closer/further away from the bone, i.e. for making stuff bigger or smaller). * Additive animations (moving bones around). Probably more and different ways of doing this, but the above is what I've seen done. Vinterstum fucked around with this message at 03:58 on Jun 6, 2010 |
# ? Jun 6, 2010 03:56 |
|
Corrupted Cable posted:Lately I've been wondering how character creation sliders ( like those in oblivion and most of todays new games ) are coded/done. I searched around and found very few articles on the subject. Generally this is done by blending between different skeleton configurations, and vertex morphs, based on the slider values. So you'd have a variant of the player mesh, for each extreme of the slider, and just blend between the different variants, based on the relevant slider values. Similarly for the skeleton, you'd have a variant for a very tall character, a variant for a very fat character, etc, and blend between them appropriately. The Oid fucked around with this message at 23:59 on Jun 6, 2010 |
# ? Jun 6, 2010 23:51 |
|
Hello Gentlemen. I come to you with a very broad question in hopes that I can find a decent tutorial/example/resource on the issue. I'm interested in building a roguelike engine in Java (No, I don't want to use some one else's mostly as I think I would learn a lot more if I attempted to build my own, and if I would finish it, I could do a lot more with it), but I don't know even where to start with the UI. I have a pretty good grasp on how to build the back end of the system, but I have no idea how to even build a simple window, set the font to something monospace and track (X,Y). I've googled a fair bit for a decent tutorial, but have found very little that could be construed as helpful. I'm hoping one of you fine folk could direct me to a resource that could start me up on this project.
|
# ? Jun 7, 2010 16:28 |
|
Canine Blues Arooo posted:Hello Gentlemen. I come to you with a very broad question in hopes that I can find a decent tutorial/example/resource on the issue. You could start by doing it in console, no need to go GUI for it. If you want full curses support: http://roguebasin.roguelikedevelopment.org/index.php?title=Java_Curses_Implementation
|
# ? Jun 7, 2010 16:57 |
|
Is it possible to set the origin in opengl to the topleft part of the screen, and keep it there when resizing the window?
|
# ? Jun 8, 2010 18:22 |
|
Chris Awful posted:Is it possible to set the origin in opengl to the topleft part of the screen, and keep it there when resizing the window? You can't make it happen magically for free within GL itself, but it's pretty easy to put something that restores that setup in the reshape handler or whatever your windowing system uses.
|
# ? Jun 8, 2010 18:28 |
|
Chris Awful posted:Is it possible to set the origin in opengl to the topleft part of the screen, and keep it there when resizing the window? You can use gluOrtho2D with the values for top end bottom swapped and you'll have the y-axis flipped.
|
# ? Jun 8, 2010 20:39 |
|
Kire posted:Does anybody have any experience with the libtcod library for making roguelikes? I started with this http://roguebasin.roguelikedevelopment.org/index.php?title=Complete_Roguelike_Tutorial,_using_python%2Blibtcod The tutorial isn't complete and about halfway through, the "Here's the code so far" is bad as it stops being incremental. You'll see stuff that you would have removed by that point and it begins to look like a big copy/paste thing that was meant to be cleaned up later. I got to the dungeon generation and lost motivation since it doesn't go much further than that. Right now I'm working on doing characters and the combat system based off of http://en.wikipedia.org/wiki/Middle-earth_Role_Playing which is brutal as hell. You have eyes being hit with arrows, limbs being hacked off, disemboweling characters and possibly getting your weapon stuck, among other things. The big thing now is an rear end load of typing all the critical hits and fumbles and then that part will mostly be finished. I'm not even thinking about adding in magic at this point.
|
# ? Jun 9, 2010 00:07 |
|
I've been trying to figure out how game worlds like the ones in Braid are achieved (you can see a bit here http://www.davidhellman.net/blog/the-art-of-braid-part-4/). Instead of using tiles (with a fixed size) they use "pieces" which can be resized and placed anywhere in the level. I'm guessing it might not be so hard, but I googled to find articles about this or atleast what data structures can be used but had no luck. Does anyone have any idea about this? Or if you know of any article explaining how it works, please post a link to it.
|
# ? Jun 10, 2010 22:33 |
|
Well, it looks like there is no special data structure. He is just rendering sprites(the "pieces") and using invisible collision detection structures. Rendering a sprite with two triangles or one quad gives you the rotating, scaling, tinting and clipping practically for free. All you have to do is save where those are in placed in space for a level. Collision detection looks like it could be as simple as rectangles. I am not sure what the squares in the upper left corner of each one are, but they are probably the transformation point for the editor. In summary, I think you are over analyzing what is going on here. Just go for it!
|
# ? Jun 10, 2010 22:48 |
|
HolaMundo posted:I've been trying to figure out how game worlds like the ones in Braid are achieved (you can see a bit here http://www.davidhellman.net/blog/the-art-of-braid-part-4/). Instead of using tiles (with a fixed size) they use "pieces" which can be resized and placed anywhere in the level. The most advanced data structure for a collection of 2D regions is probably the quadtree, but modern hardware is so far past the demands of Braid's scenes that he may as well just do a simple bounds check on everything in the world or throw it at DX/GL and let the clip stage deal with it.
|
# ? Jun 10, 2010 23:00 |
|
HolaMundo posted:I've been trying to figure out how game worlds like the ones in Braid are achieved (you can see a bit here http://www.davidhellman.net/blog/the-art-of-braid-part-4/). Instead of using tiles (with a fixed size) they use "pieces" which can be resized and placed anywhere in the level. You are in luck, I had been looking into that and I found a working editor/tutorial to see how it works. http://gametuto.com/in-game-c-map-e...-aquaria-games/
|
# ? Jun 10, 2010 23:16 |
|
Obsurveyor posted:In summary, I think you are over analyzing what is going on here. Just go for it! I think you are right. I thought about using quadtrees but just kept thinking over and over how to do pretty much everything instead of just sitting down and get coding and handle problems as they pop up. Imazul posted:You are in luck, I had been looking into that and I found a working editor/tutorial to see how it works. Cool, gonna download and check it out. Thanks for all the replies
|
# ? Jun 10, 2010 23:37 |
|
You can also activate Braid's editor by passing the '-editor' flag to the exe, and then pressing F11 in-game. I wasn't sure if you already knew that. I wrote a level editor as part of a game for a University project. I didn't use quad-trees or anything fancy; I just stored each object's position. The editor wasn't particularly difficult to create, but I also didn't put a lot of effort into making it usable. You'd probably spend more time on UI improvements than you would on the nuts-and-bolts of it.
|
# ? Jun 11, 2010 00:48 |
|
HolaMundo posted:I've been trying to figure out how game worlds like the ones in Braid are achieved (you can see a bit here http://www.davidhellman.net/blog/the-art-of-braid-part-4/). Instead of using tiles (with a fixed size) they use "pieces" which can be resized and placed anywhere in the level. This is the method I use for the game I'm working on. I'm not sure what area you want to be explained? Here's the basics of how it works for me, using XNA. Sprites are made of a Texture, Rectangle(the bit to draw) then rotation, tint, scale etc. When I load a level, the sprites are all thrown into a Camera class that stores them in layers(basically a list along with some other things), which have movement speed for doing parallax scrolling. Layers can be sorted every frame or not(only the one with characters on it is sorted every frame), these layers are then rendered in order with a matrix applied to them for scale/rotation of the actual camera itself(for zooming in and out, doing camera shakes or whatever). For saving them, I keep an 'original' copy of the sprite, then just save the reference of that in the level data. So let's say I have a sprite called rock, the source file will contain what texture it uses and the source. Then in the level data it saves the sprite with the source as rock, then all the other details unique to that one sprite like rotation and tint. This is simply because if I need to rearrange a sprite sheet at some point I can change the source sprite and it will be applied to everything in the level, which is very handy. Collision is totally seperate, I just use boxes but depending on how the terrain works you might need to use polygons. Like others said, hardware is so powerful now that it's not difficult at all to do.
|
# ? Jun 11, 2010 20:50 |
|
Do you go through all the lists checking one by one which sprites should be drawn or is there a more effective way to do this?
|
# ? Jun 11, 2010 22:59 |
|
I do it when I'm drawing the sprite, a simple bounds check doesn't take much time to do.
|
# ? Jun 12, 2010 10:16 |
|
In Unity, how do you make a Gameobject (with Rigidbody and Collider) ignore collisions with clones of itself? I know how to stop them from interacting with the objects that fire them, but I want the cloned bullets to pass through each other instead of knocking each other away.
|
# ? Jun 14, 2010 20:25 |
|
You either have to make the bullet use a trigger collider (with the rigidbody) and rely on OnTrigger messages, or, use Physics.IgnoreCollision() between each object you don't want to collide with manually. The latter is more what you described but is one of the most annoying issues with Unity (lack of collision groups) and usually using trigger colliders is going to be better unless you really really need collision data (intersection/normal).
|
# ? Jun 14, 2010 23:21 |
|
Bouncing off the idea of just using a console, I found JCurses, which seems to do what I want and giving me the flexibility I need. The problem is that there seems to be very little external documentation/tutorials/whatnot available and while the Java Docs are incredibly useful once I have the basic functionality of the library down, How to generate something as simple as a window with a line of text evades me. I've found one snippit of example code online that looks like so:code:
|
# ? Jun 15, 2010 17:23 |
|
I haven't done any geometry since high school and forgot it all a long time ago. I have a cannon and a rotating turret. The cannonballs are created at the end of the turret and fly off. I have the "fly off" part working. I wrote a big long explanation of my problem but I couldn't make any sense of it after I wrote it so here's an illustration instead. If the cannon is pointing at (x,y), how do I get X and Y so my cannonballs come out of the right place? I'm still using Unity.
|
# ? Jun 15, 2010 19:11 |
|
Luigi Thirty posted:I haven't done any geometry since high school and forgot it all a long time ago. I have a cannon and a rotating turret. The cannonballs are created at the end of the turret and fly off. I have the "fly off" part working. cos(Angle of turret) * Length of turret = X sin(Angle of turret) * Length of turret = Y
|
# ? Jun 15, 2010 19:15 |
|
Mata posted:cos(Angle of turret) * Length of turret = X I am hopelessly confused and can't get it to work. The cannon is pointing down the Z axis (making it the X axis) or something. And even when I do correct for that, I still get really weird results that make no sense if I'm rotating anywhere other than 0 degrees. I have never felt more retarded Can someone figure out what I'm supposed to be doing? e: New code below Luigi Thirty fucked around with this message at 23:31 on Jun 15, 2010 |
# ? Jun 15, 2010 23:11 |
|
Mata posted:cos(Angle of turret) * Length of turret = X It depends on where the angle starts at. If 0 deg points up, then the sin/cos need to be reversed. R * cos(0) = R R * sin(0) = 0 which would put straight up as (L, 0) EDIT Basically, consider that a circle contains the angles from 0 - 2PI. cos(0) == 1 sin(0) == 0 Depending on where you want your 0 angle to be, you can define any point on the circle by: r*cos(theta) and r*sin(theta) You can extrapolate this to points on a sphere as well, look up Spherical Coordinates. Also, the vector your cannonball comes out at needs to have y = 0 or you'll be firing off at an angle instead of straight. The vector needs to be x, 0, z - (center of tank). Spite fucked around with this message at 23:19 on Jun 15, 2010 |
# ? Jun 15, 2010 23:13 |
|
Luigi Thirty posted:I am hopelessly confused and can't get it to work. The cannon is pointing down the Z axis (making it the X axis) or something. And even when I do correct for that, I still get really weird results that make no sense if I'm rotating anywhere other than 0 degrees. I have never felt more retarded If it's only correct at 0 degrees, it sounds like you should be converting to radians before the cos/sin functions.
|
# ? Jun 15, 2010 23:23 |
|
Bakkon posted:If it's only correct at 0 degrees, it sounds like you should be converting to radians before the cos/sin functions. Helpfully, the cos/sin functions say they return radians but don't say whether they take radians or degrees. I adjusted the code around. At 0 degrees, this gives me (0, 2) which is correct. At 180 degrees, I get (1.68, 1.08) which is obviously not correct. Spite posted:Also, the vector your cannonball comes out at needs to have y = 0 or you'll be firing off at an angle instead of straight. With the Vector3.forward always shoots in the direction the tank is pointing. code:
|
# ? Jun 15, 2010 23:34 |
|
Luigi Thirty posted:Helpfully, the cos/sin functions say they return radians but don't say whether they take radians or degrees. No cos or sin function in the world returns radians. They return unitless numbers which are projections of a unit vector on to either the X or Y axis, respectively.
|
# ? Jun 15, 2010 23:40 |
|
var cannonPositionY = 2 * (Mathf.Cos(transform.rotation.y)); //Y var cannonPositionX = 2 * (Mathf.Sin(transform.rotation.y)); //X Well, for one thing, this is likely not right
|
# ? Jun 15, 2010 23:47 |
|
ShoulderDaemon posted:No cos or sin function in the world returns radians. They return unitless numbers which are projections of a unit vector on to either the X or Y axis, respectively. Er, right. I told you I don't remember any of this. cos() and sin() seem to want radians, but multiplying transform.rotation.y by Deg2Rad doesn't seem to be helping anything (now it always stays within a few hundredths of (0,2)). I'll keep hammering at it. Dijkstracula posted:
The cannon's only rotating in the Y axis. I'm trying to get the (x,y) offset I need to put the cannonball in the right place.
|
# ? Jun 15, 2010 23:50 |
|
Mathf.Sin takes a float in radians, and returns the sin. You know that transform.rotation returns a quaternion, right? You probably want transform.rotation.eulerangles.y Edit: I'm assuming this is Unity, I've been reading their documentation here: http://unity3d.com/support/documentation/ScriptReference/Quaternion.html and assuming I'm looking at the same thing you are.
|
# ? Jun 16, 2010 00:15 |
|
Dijkstracula posted:
Right line, wrong problem. What you want is to rotate the vector (0,2) around the point (0,0) by an angle 't'. What you also want to do is memorize this matrix: |cos(t) -sin(t)| |sin(t) cos(t) | Which is the form of all rotations in any plane with respect to a certain basis. |cos(t) -sin(t)| |0| |sin(t) cos(t) |*|2|=(0*cos(t) - 2*sin(t), 0*sin(t) + 2 * cos(t)) So your X coordinate should be -2*sin(t) and your Y coordinate should be 2*cos(t). You also need to convert your angle into radians before calling sine or cosine. pi * sin(t))/180 != sin(pi*t/180)
|
# ? Jun 16, 2010 00:51 |
|
The winner is:pre:var cannonPositionX = 2 * (Mathf.Sin(Mathf.Deg2Rad * transform.rotation.eulerAngles.y)); //X var cannonPositionY = 2 * (Mathf.Cos(Mathf.Deg2Rad * transform.rotation.eulerAngles.y)); //Y I think I'm going to work on my 3D modeling skills. edit: The Lightwave FBX exporter plugin is a piece of poo poo, by the way. It will produce an FBX file which contains one layer of my model (yes, both are selected in Modeler). If you try to use it to export more than one model without closing and re-opening Lightwave, it'll create a blank FBX file. Luigi Thirty fucked around with this message at 05:55 on Jun 16, 2010 |
# ? Jun 16, 2010 05:05 |
|
I'm glad to see you've sorted this out on your own, but I think you may be needlessly complicating things here. If I understand what you were trying to achieve here, you have a turret that you rotate can rotate left and right and wanted to work out the position of the end of the barrel from its rotation around the y axis. You already know how to find the forward vector of the turret's transform as you are using it to launch the projectiles in the right direction. So all you need to do is add that vector (multiplied by the length of the barrel in m) to your transform.position. (Also to find the forward vector you can just use transform.forward instead of transform.TransformDirection(Vector3.forward)) So messing around with your previous posted example you would end up with something like: code:
If I haven't misunderstood what you were trying to achieve here, I hope this is of some help. Torch Dexter fucked around with this message at 17:13 on Jun 16, 2010 |
# ? Jun 16, 2010 11:16 |
|
|
# ? May 13, 2024 10:08 |
|
Torch Dexter posted:And of course there's also the non-coding solution of sticking an empty GameObject as a child of the turret where the end of the cannon should be, and using that object's transform position as the origin point for the cannonballs. I thought of this but dismissed it as the cheap way out.
|
# ? Jun 16, 2010 14:43 |