• What do you need help with? Version 5
    5,752 replies, posted
[QUOTE=NovembrDobby;34993330]Nope, you're returning the pointer so you can just use that to delete it. [/QUOTE] That works properly. Thanks.
How would I implement a scrolling map in a tilebased game/roguelike? I would like the map to be bigger than what is shown on the screen, but how would I determine what tiles to draw?
[QUOTE=Armandur;34995922]How would I implement a scrolling map in a tilebased game/roguelike? I would like the map to be bigger than what is shown on the screen, but how would I determine what tiles to draw?[/QUOTE] What are the bounds on the player's movement? Is the player always at the center of the screen or are they allowed to go towards the edges before it scrolls?
[QUOTE=PvtCupcakes;34991627]Fuck I hate my professor. For this assignment I have to do, we're doing binary trees which are easy enough but he doesn't tell us how to construct the tree. I have to match his output exactly, or I'll lose a shitload of points because he's a fucking retard who can't admit there are other ways to do things. He just gives us numbers to insert into the tree and I don't know how he expects us to know where that data goes. I've been looking at this and it just looks like he put data wherever the fuck he wanted, but I don't know how to replicate his mental diarrhoea. I looked at the output we're supposed to match which contained the inorder, preorder, and postorder traversals of the tree, so I could draw a diagram of what it looked like. Obviously I can't use this traversal information to construct the tree because the traversal is the output, not the input. The data is given in this order: [code]{ 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15 }[/code] Here are the traversals [code] inorder: -12 7 -4 11 -2 -10 -6 1 15 9 5 -14 3 13 -8 preorder: 1 -2 -4 7 -12 11 -6 -10 3 5 9 15 -14 -8 13 postorder: -12 7 11 -4 -10 -6 -2 15 9 -14 5 13 -8 3 1 [/code] Here's a diagram of the tree. [img]http://i.imgur.com/T3RBx.jpg[/img] I don't see any pattern here. Maybe I did the diagram wrong, but probably not. If nobody else can find a pattern, I'm just going to say fuck it and make a binary search tree (which it's not).[/QUOTE] I think it's pretty straightforward :\ Maybe I'm just crazy. It looks to be a sort of depth-balanced tree with no other rules (i.e. it's not a binary search tree, heap, etc.). You have to insert from the root, taking into consideration the depth of each sub-tree along the path. It seems to 'prefer' the left side when both have equal depth. { 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15 } 1: ROOT NODE -2: (0==0) LEFT 3: (1>0) RIGHT -4: (1==1) LEFT -> (0==0) LEFT 5: (2>1) RIGHT -> (0==0) LEFT -6: (2==2) LEFT -> (1>0) RIGHT 7: (2==2) LEFT -> (1==1) LEFT -> (0==0) LEFT -8: (3>2) RIGHT -> (1>0) RIGHT ...and so on. I'd write pseudo-code, but I think I'm already pushing the limits of how much help I should be giving on an assignment... You kind of have to ignore the fact that this structure is totally and completely useless. Most real binary trees don't do anything like this.
What do you all think of Codeacademy? I've been doing it and I've learned much more quickly than I ever did with a book.
So, I'm trying to get some basic AI to follow my player. It works, but whenever I move the player on only one axis. The AI will just follow me on this axis, it won't try to move in my direction. Here's my code for moving the AI in the player direction : GetSprite().Move(sin(angle) * _speed *elapsedTime, cos(angle)* _speed *elapsedTime); angle is the angle between the player and the AI.
So, I'm learning Java in my class and we're on loops. I had to make a rock, paper, scissors game able to be repeated until either player has won 3 times. I managed to get this far in it, but the || seems to break the do-while loop. Is there a better way to go about this without rewriting the entire thing? [code]public class RockPaperScissors { public static void main(String[] args) { // Generate scissor, rock, paper int computerNumber = (int)(Math.random() * 3); // Prompt the user to enter scissor, rock, or paper java.util.Scanner input = new java.util.Scanner(System.in); System.out.print("scissor (0), rock (1), paper (2) : "); int userNumber = input.nextInt(); int Playerwin = 0; int Computerwin = 0; do { computerNumber = (int)(Math.random() * 3); System.out.print("\n scissor (0), rock (1), paper (2): "); input.nextInt(); switch (computerNumber) { case 0: if (userNumber == 0) System.out.print("It is a draw."); else if (userNumber == 1) System.out.print("You won!"); else if (userNumber == 2) System.out.print("You lost!"); if (userNumber == 1) Playerwin = Playerwin + 1; else if(userNumber == 2) Computerwin = Computerwin + 1; break; case 1: if (userNumber == 0) System.out.print("You lost!"); else if (userNumber == 1) System.out.print("It is a draw."); else if (userNumber == 2) System.out.print("You won!"); if (userNumber == 0) Computerwin = Computerwin + 1; else if (userNumber ==2) Playerwin = Playerwin + 1; break; case 2: if (userNumber == 0) System.out.print("You won!"); else if (userNumber == 1) System.out.print("You lost!"); else if (userNumber == 2) System.out.print("It is a draw."); if (userNumber == 0) Playerwin = Playerwin + 1; else if (userNumber == 1) Computerwin = Computerwin + 1; break; } System.out.print("\n Player win " + Playerwin); System.out.print("\n Computers win " + Computerwin); } while (Playerwin !=3 || Computerwin != 3); if(Playerwin == 3) System.out.println("You win the game!"); else if(Computerwin ==3) System.out.println("You lose the game."); } }[/code]
[QUOTE=calzoneman;35000462]What are the bounds on the player's movement? Is the player always at the center of the screen or are they allowed to go towards the edges before it scrolls?[/QUOTE] Do you have a general algorithm for both options? Having the player being able to move about 5-10 tiles towards the edge would be nice, though.
What's more popular for online games? UDP or TCP connections?
[QUOTE=no-named;35004746]What's more popular for online games? UDP or TCP connections?[/QUOTE] Fast-paced games need to be UDP. A lot of slower games and MMOs use TCP. My personal preference is to use UDP for everything.
Annoyingly, I don't even know the right words to describe this problem. I'm sure I learned this way back in GCSE maths but it's all gone from my head. How do I find the letters inside the green area? [img]http://i.imgur.com/uY12t.png[/img] Assuming a discrete 2D environment and that the green area is a theta wide arc with infinite depth starting from x,y.
[QUOTE=no-named;35004746]What's more popular for online games? UDP or TCP connections?[/QUOTE] Both.
[QUOTE=Lexic;35005077]Annoyingly, I don't even know the right words to describe this problem. I'm sure I learned this way back in GCSE maths but it's all gone from my head. How do I find the letters inside the green area? [img]http://i.imgur.com/uY12t.png[/img] Assuming a discrete 2D environment and that the green area is a theta wide arc with infinite depth starting from x,y.[/QUOTE] You can get the angle of points B to F from A by doing: float ang = atan2(b.y - a.y, b.x - a.x); then you can check ang against theta to find which points are inside the arc.
Is there a simple C++/C# function that allows me to set write permission for a program?
[QUOTE=pinecleandog;35006041]Is there a simple C++/C# function that allows me to set write permission for a program?[/QUOTE] I've never used it, but I found this class and it looks useful for what you want to do. [url]http://msdn.microsoft.com/en-us/library/system.security.accesscontrol.filesecurity.aspx[/url] Check out the example.
How i create a vgui panel in Gmod with a c++ module ? best regards Royal
Still looking for someone that as experience with shaders and directX, mine still is not working after weeks of trying to get something on the screen.
[QUOTE=|Royal|;35007945]How i create a vgui panel in Gmod with a c++ module ? best regards Royal[/QUOTE] weren't you the guy making a GMod hack a few months ago
[QUOTE=Banana Lord.;35008580]weren't you the guy making a GMod hack a few months ago[/QUOTE] Yes, but this does not answer my question. ;)
[QUOTE=ROBO_DONUT;35000781]I think it's pretty straightforward :\ Maybe I'm just crazy. It looks to be a sort of depth-balanced tree with no other rules (i.e. it's not a binary search tree, heap, etc.). You have to insert from the root, taking into consideration the depth of each sub-tree along the path. It seems to 'prefer' the left side when both have equal depth. { 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15 } 1: ROOT NODE -2: (0==0) LEFT 3: (1>0) RIGHT -4: (1==1) LEFT -> (0==0) LEFT 5: (2>1) RIGHT -> (0==0) LEFT -6: (2==2) LEFT -> (1>0) RIGHT 7: (2==2) LEFT -> (1==1) LEFT -> (0==0) LEFT -8: (3>2) RIGHT -> (1>0) RIGHT ...and so on. I'd write pseudo-code, but I think I'm already pushing the limits of how much help I should be giving on an assignment... You kind of have to ignore the fact that this structure is totally and completely useless. Most real binary trees don't do anything like this.[/QUOTE] Interesting. Seems silly, but I guess I'll do it.
I read that UDP isn't connection based, which means any client can just send data to the server, and the server receives all data in the same socket. I want to simply store the IP and Port of the client then, to indentify them with a specific ID on the server, so I can recognize them and the Player character they get assigned. But what if 2 people connect from the same outbound IP? What is the best way to handle this problem? (C# XNA, in case relevant)
[QUOTE=no-named;35017355]I read that UDP isn't connection based, which means any client can just send data to the server, and the server receives all data in the same socket. I want to simply store the IP and Port of the client then, to indentify them with a specific ID on the server, so I can recognize them and the Player character they get assigned. But what if 2 people connect from the same outbound IP? What is the best way to handle this problem? (C# XNA, in case relevant)[/QUOTE] They will have different outbound ports.
Could somebody help me find something to make? I'm really not that great with programming despite doing it for 2 years so far in college. Something easy that could help me get better?
[QUOTE=Over-Run;35018877]Could somebody help me find something to make? I'm really not that great with programming despite doing it for 2 years so far in college. Something easy that could help me get better?[/QUOTE] You could make a very simple HTTP server. Technically possible to make in any language which supports TCP, file reading and string operations. The protocol is entirely plain text and quite unambiguous.
I know I'm going to sound like a dumb ass but what exactly is it? I'm not the best when it comes to knowing stuff about networking. Any recommended places to look for info on it?
Could someone with MSYS installed possibly build Jansson for me? I have mingw intalled but cant run the configure file, and dont want to install msys as it will try and install another version of mingw i think
[QUOTE=Richy19;35019550]Could someone with MSYS installed possibly build Jansson for me? I have mingw intalled but cant run the configure file, and dont want to install msys as it will try and install another version of mingw i think[/QUOTE] MinGW and MSYS are separate, and usually you install MSYS with MinGW (dunno why, it doesn't really make sense to install the environment from the compiler, but that's how they do it) The program is mingw-get, and you'd type "mingw-get install msys" to install MSYS.
[QUOTE=Over-Run;35019225]I know I'm going to sound like a dumb ass but what exactly is it? I'm not the best when it comes to knowing stuff about networking. Any recommended places to look for info on it?[/QUOTE] "[url=http://www.jmarshall.com/easy/http/]HTTP Made Really Easy[/url]" should help you quite a bit. Ignore the fact that it's 12 years old, the core standard hasn't changed in that time and you don't need to worry about any extensions, at least not to start off with. For the networking, look up sockets for your language of choice. TCP deals with nearly all of the nitty-gritty for you, so you shouldn't need to learn how it actually works. (Worth doing it anyway though, very interesting.)
In XNA, what would be the best way to randomly generate asteroids in an asteroids clone, with different velocities? I'm still trying to wrap my head around this.
Is it possible to give a shader to multiple objects to all use it but draw the object in a different position? Right now its drawing the object at the last position given to the shader and i don't really see a way of stopping it.
Sorry, you need to Log In to post a reply to this thread.