• What do you need help with? Version 5
    5,752 replies, posted
Can someone please help me understand how to do this radial menu? [url]http://pastebin.com/4D9GhJby[/url] This is as far as I can get by myself. First, the splitters are fine if the number of objects is odd: [t]http://puu.sh/lyJL[/t] But if they are even: [t]http://puu.sh/lyJK[/t] Second, I have no idea how to do the checking which one is selected. I was thinking something with dot product but no clue.
[QUOTE=vexx21322;35213087]Can someone please help me understand how to do this radial menu? [url]http://pastebin.com/4D9GhJby[/url] This is as far as I can get by myself. First, the splitters are fine if the number of objects is odd: [t]http://puu.sh/lyJL[/t] But if they are even: [t]http://puu.sh/lyJK[/t] Second, I have no idea how to do the checking which one is selected. I was thinking something with dot product but no clue.[/QUOTE] If they're even, add 1/2 rotation between the two to 'em all. For checking, you could do distance, though that might get fuzzy near the bottoms.
Get the angle from the center, should be simple to determine which one is selected from that, I'm guessing.
[QUOTE=Ybbats;35213436]Get the angle from the center, should be simple to determine which one is selected from that, I'm guessing.[/QUOTE] Or this yes. Get the angle and divide by the width (in angles) of each center. Should give you a number about how far around the circle it is.
Yes, I understand what I have to do, but I don't understand [I]how[/I] to do it. I'm absolutely garbage at math.
[QUOTE=vexx21322;35213541]Yes, I understand what I have to do, but I don't understand [I]how[/I] to do it. I'm absolutely garbage at math.[/QUOTE] [url]http://www.gamedev.net/topic/502762-math-for-calculating-angle-between-two-points-2d/[/url] Looks like a easy way. On a also math related note, I'm looking at math libraries and physics libraries. For Physics, I'm looking at using Bullet. However Bullet doesn't have enough linear math, as it doesn't have 4x4 matrices. Because of that, I'm also looking at GLM. Bullet also lacks some functions that GLM has - GLM can create a Quaternion from a Euler Angle, Bullet can't. However, I really don't want to spend my time converting back and forth between Bullet and GLM versions of things. Is there a best way to do this? (Eg; Bullet for everything but 4x4 Matrixes and GLM for render-matrices only, etc)
Use quaternions internally to represent orientation, 3-vectors for position. Convert accordingly.
[QUOTE=Ehmmett;35209557]If you find one, give me a shout. I've been dying to figure it out, but I can't come up with shit.[/QUOTE] Its always been a pain for me, but then I came up with this way to do it. I'm sure its been thought of before but its extremely simple. I stopped working on this project because of school but collision seems to work flawlessly. Heres it working: [vid]http://dl.dropbox.com/u/19301242/SomeGameSM.webmvp8.webm[/vid] What I used to do, and maybe what you do, is move the player/whatever in the X and Y direction, and then check for collision and try to resolve it. That causes problems. So what I did was: 1. Move the player in the X direction. 2. Check for collision, respond to it. 3. Move in Y direction. 4. Check for collision, respond to it. It seems almost too simple to work, but it seems to work perfectly. Since you correct the players collision after he only moves in one direction, you know where to move him back to. If you moved in X and Y, its harder to figure out how to respond to the collision since there are many possibilities of where the player is colliding with the object. Corners also seem to work. But like I said I didn't do much more work on this project, so there could still be problems. Hope this helps. Or maybe its entirely flawed.
[QUOTE=ROBO_DONUT;35215860]Use quaternions internally to represent orientation, 3-vectors for position. Convert accordingly.[/QUOTE] I could probably write most everything to use bullet, sans view matrix' - I just don't want to get down the road and discover that I have to stop using bullet vectors or quaternions for my model system and have to go back and change them all.
[QUOTE=Lord Ned;35217581]I could probably write most everything to use bullet, sans view matrix' - I just don't want to get down the road and discover that I have to stop using bullet vectors or quaternions for my model system and have to go back and change them all.[/QUOTE] Well you could either write your own quaternion/vector routines/structures (it isn't that difficult) or you could write an abstraction layer for Bullet's routines/structures.
[QUOTE=ROBO_DONUT;35217617]Well you could either write your own quaternion/vector routines/structures (it isn't that difficult) or you could write an abstraction layer for Bullet's routines/structures.[/QUOTE] I did that the first time around, and decided that I didn't need to be trying to check if my math routines were right while trying to determin if my rendering of them was right, or my usage of them. I could probably Union Bullet and GLM structs to some extent, but still gotta plug it into one or the other to crunch numbers. If both Bullet and GLM use the same sized formats (say 3 floats for a Vector), is there anything wrong with casting a bullet vector to GLM and plugging that into glm's calculations?
Im trying to build Bugle on linux (as gDebugger doesnt work) but when i run scons I get: error: #error "Your GL/glext.h is too old! Please obtain the latest version from http://www.opengl.org/registry/" Is it advisable to just overwrite the current glext.h with a new one from opengl.org?
[QUOTE=Richy19;35218003]Im trying to build Bugle on linux (as gDebugger doesnt work) but when i run scons I get: error: #error "Your GL/glext.h is too old! Please obtain the latest version from http://www.opengl.org/registry/" Is it advisable to just overwrite the current glext.h with a new one from opengl.org?[/QUOTE] No. It's not likely it's 100% compatible with your OpenGL library files that it's going to link against.
In C#, how do I remove the flashing thing if I want to make a roguelike? Talking about this thing after the @: [img]http://i.imgur.com/sXuNc.png[/img] And how do I detect collision here with the walls (#)? Here's the code: [csharp] static void Main(string[] args) { Console.Title = "Roguelike"; StartUpDraw(); int xPos = 1; int yPos = 1; while (true) { var keyInfo = Console.ReadKey().Key; switch (keyInfo) { case ConsoleKey.UpArrow: if (yPos >= 1) yPos -= 1; break; case ConsoleKey.DownArrow: if (yPos <= 20) yPos += 1; break; case ConsoleKey.LeftArrow: if (xPos >= 1) xPos -= 1; break; case ConsoleKey.RightArrow: if (xPos <= 20) xPos += 1; break; } DrawPlayer(xPos, yPos); } } static void DrawPlayer(int x, int y) { Console.Clear(); DrawMap(); Console.SetCursorPosition(x, y); Console.ForegroundColor = ConsoleColor.White; Console.Write("@"); Console.ForegroundColor = ConsoleColor.DarkGray; } static void DrawMap() { string map = System.IO.File.ReadAllText(""C:\\Directory\\map.txt"); Console.ForegroundColor = ConsoleColor.DarkGray; Console.Write(map); } static void StartUpDraw() { DrawMap(); Console.SetCursorPosition(1, 1); Console.ForegroundColor = ConsoleColor.White; Console.Write("@"); Console.ForegroundColor = ConsoleColor.DarkGray; } [/csharp]
Console.CursorVisible = false;
[QUOTE=wootmonster;35218410] And how do I detect collision here with the walls (#)? [/QUOTE] Put your map in a 2d vector, set positions for your @, he will always be in the center of the window. Print the maps close to the @, thats easy. Every time you do a step, check the direction so you can check if the next step will be in the #.
[QUOTE=Darkest_97;35216367]words[/QUOTE] The problem with this approach is that corners will not work, because if the bottom right and top left of two boxes is almost colliding (like they are touching corners), and the top box moves down 5 and right 5, then it will see that there is no collision with the two boxes and move the box into the other box.
[QUOTE=wootmonster;35218410]In C#, how do I remove the flashing thing if I want to make a roguelike?[/QUOTE] you probably shouldn't. Set the cursor position to where the player is after it's drawn, instead. It's a nice indicator of where the player actually is.
[QUOTE=Mete;35220770][B]Put your map in a 2d vector[/B], set positions for your @, he will always be in the center of the window. [B]Print the maps close to the @[/B], thats easy. Every time you do a step, [B]check the direction so you can check if the next step will be in the #.[/B][/QUOTE] How do I do this?
[QUOTE=WTF Nuke;35220824]The problem with this approach is that corners will not work, because if the bottom right and top left of two boxes is almost colliding (like they are touching corners), and the top box moves down 5 and right 5, then it will see that there is no collision with the two boxes and move the box into the other box.[/QUOTE] It took me a while to figure out why my way works. I tried some more to get corners to break but I cant, because they do work. The way I did it fixes the corner problem. What your saying is if I move X and Y, then check for collision. Then you can go into a wall. Assuming I understood what you're saying right. Heres some paint: [IMG]http://dl.dropbox.com/u/19301242/Pics/DSG/SYYWFHRGCJTO.png[/IMG] This is your scenario. Lets say first you move the player in the Y direction down 5 pixels. It will see that it is not colliding. And thus be fine. Then it will move it in the X direction 5 pixels. It will be colliding, and will move it back. Thus not allowing you to go through the corner. Edit: So you choose what you want to happen when you hit a corner by deciding which direction you check and move first. In a game with gravity you can choose to save the player or make him fall. In top down it wont really make a difference. Either way you wont really be able to tell what actually happens.
[QUOTE=wootmonster;35221008]How do I do this?[/QUOTE] I dont know anything about c#, but lets see... lets say u made a vector of ints where is your map, you will see the map like 11111111111111111 10000000000000001 10000000000000001 10000000000000001 10000000000000001 11111111111111111 you are already "checking" the direction here for example [code] case ConsoleKey.UpArrow: if (yPos >= 1) yPos -= 1; break; [/code] here u are checking if he is not going inside the wall in the top, you will need to change this for something like, if (yPos-1 != 1) yPos -= 1; where "yPos-1" is the next step he is going and "1" is a int that defines a wall You should google for vectors or arrays if you dont know what they are, i cant explain how to put your map in a 2d vector or print the maps close to the @ if you dont know what is a vector. If i get some time, i will code this in pascal or c++
While on the subject of that, is it possible to assign a coordinate to each symbol in [csharp]string map = System.IO.File.ReadAllText(""C:\\Directory\\map.txt");[/csharp] for easy checking?
[QUOTE=wootmonster;35221544]While on the subject of that, is it possible to assign a coordinate to each symbol in [csharp]string map = System.IO.File.ReadAllText(""C:\\Directory\\map.txt");[/csharp] for easy checking?[/QUOTE] No, but it's not hard to retrieve the coordinate from it's position in the string. PosInString / MAP_WIDTH = Row it's on, and PosInString % MAP_WIDTH will get you the column.
Alright guys, I'm really bad at getting these things right. So here's another problem, for which a solution I cannot find. The following code [code] static int print( lua_State *L ) { const char *msg lua_tostring(L,-1); printf( msg ); return 0; } static const luaL_Reg console_functions[] = { { "print", print }, { NULL, NULL } }; void Bind( lua_State *L ) { luaL_setfuncs(L, "console", console_functions ); } [/code] gives the following error: [code] PANIC: Unprotected error in call to Lua API (attempt to index a nil value) [/code] The error happens at 'luaL_setfuncs'. I should note that it's a runtime error, using lua 5.2.
[QUOTE=Darkest_97;35221183]Explanation[/QUOTE] Oh woops sorry I misread that, however it is a bit biased to do Y first in a topdown because it can change the way you move. However I'm sure this is negligible, but since I'm a perfectionist I'll still like to hear some more way to do it. But that sounds great, I'll implement that ASAP. How does it work with moving tiles?
[QUOTE=WTF Nuke;35222309] How does it work with moving tiles?[/QUOTE] I haven't tried it but I dont think it would work just the way it is now. Because if you have a wall moving into the player, you can correct the wall easily this way obviously. But if the wall is supposed to move the player, then it wouldn't do anything because the player isn't moving, I think. I don't know I never thought about it. If you do it let me know the results.
-tested this, doesn't work-
[QUOTE=wootmonster;35221008]How do I do this?[/QUOTE] There is a poor code doing what i said. you can download here... [url]http://fit.faccat.br/~a1110207/rogue.rar[/url] use wasd and you need to press enter evrytime, like w, enter, a, enter, d, enter, etc... if you type something diferent, he will bug.. to kill the process you may need to do a ctrl + c, q isnt working well.
[QUOTE=Darkest_97;35216367] So what I did was: 1. Move the player in the X direction. 2. Check for collision, respond to it. 3. Move in Y direction. 4. Check for collision, respond to it.[/QUOTE] The only downside I can think of to that method is if the player were to move diagonally when touching an obstacle above (or below) them (depending on the direction). Then that method would allow the movement since moving in the X would bypass the obstacle so that moving in the Y direction has no obstacle. However that would only be noticeable if the player can move really far in a single frame since the size of the obstacle that could be falsely avoided is limited by the X distance. tl;dr, that is a really good method of simplifying collisions, since it's edge case can easily be avoided by restricting the type of movement that occurs.
I've made the move to C# and I have no idea how to use the .net bindings for SFML. I've installed SFML on Code::Blocks and C++ but the C# version is completely alien to me. Does anyone know how to use the .net bindings?
Sorry, you need to Log In to post a reply to this thread.