signal_

Members
  • Content count

    329
  • Joined

  • Last visited

Community Reputation

366 Neutral

About signal_

  • Rank
    Member
  1. Green Horn LF help

    I would first read the game dev [url="http://wiki.gamedev.net/index.php/Main_Page"]wiki[/url]. It will get you started. You actually can get pretty far without books, so, since you're interested in programming, you must first choose a language and learn it; you can get most of the beginner information off the internet. Then after you have some basic knowledge you'd be in a better position to look for books. Also, programming a FPS is a difficult task for a beginner, so you prolly want to start MUCH simpler. Like tetris, pong, etc. After you create some basic games you can be in a better position for something more advanced. Another thing to note is that an [url="http://www.gamedev.net/topic/592661-xna-40-winter-workshop-introduction/"]GD.net XNA Workshop[/url] will begin shortly on Jan 17. This workshop assumes prior knowledge of C# and game programming experience is recommended, but some swift beginners may be able to jump right in. Even if you cannot follow everything it might be wise to follow along as much as you can. And, by the way, C# is an excellent programming language for someone new to programming. Another option would be to use something like [url="http://unity3d.com/"]Unity[/url] to make your FPS. This engine requires some scripting programming in C# or javascript and, if memory serves, they have an FPS tutorial on their website too. This may allow for a faster start, more results quicker.
  2. need help on sdl cursor

    You must understand that with SDL you are drawing onto surfaces - in your case, a surface called screen. When you call SDL_Flip( screen ) you are putting this surface onto your SDL window for that frame. Before the next screen you must 'clear' the surface; this is usually accomplished by blitting a background image or a solid color. So, I looked at your code. It seems your objective is to draw your help, draw your cursor, and then gather inputs. Your while loop handles when the user of the program goes into help i.e. you stay in this loop until help is exited. Also, it is important to note that a mouse cursor can (I assume) go any where with in your SDL window. This implies that any position in the window can go 'dirty' - need to be redrawn so you do not see the trail effect - so you prolly wouldn't be bad off just redrawing everything each frame. Your while loop should look like: while( ( endHelp == false ) && ( quit == false ) ) { HandleEvents(); DrawBackground(); // 'clear' the screen. DrawHelp(); // draw all help images, text, etc. DrawMouseCursor(); // draw the mous cursor on top of everything else. } So, break things up into these functions to make things clean and easy to see. =) Your HandleEvent function would be, for example: //if there's events to be handled if( SDL_PollEvent( &event ) ) { //if a button was pressed if( event.type == SDL_KEYDOWN ) { //if esc was pressed if( event.key.keysym.sym == SDLK_ESCAPE ) { //quit the game endHelp = true; } //end the help } //if the user Xed out if( event.type == SDL_QUIT ) { //quit the game quit = true; } And so on. You already know how to draw your help so put it inside the DrawHelp() function; clear the screen in the DrawBackground() function. And lastly, your DrawMouseCursor() function would look something like void DrawMouseCursor() { SDL_GetMouseState(&mouseX, &mouseY); apply_surface( mouseX , mouseY , cursor , screen , Rcurs ); } So yeah, your while loop is the problem. How's this sound?
  3. berNbie question

    Just wanted to say good help by Atrix, but when I run your code, the WASD directions are screwed up, inverted. This is because do { for(int c = 0; c < mazeY; ++c) { for(int i = 0; i < mazeX; ++i) { maze[playerX][playerY] = 2; switch(maze[i][c]) { case 0: cout << " "; break; case 1: cout << "#"; break; case 2: cout << "X"; break; default: cout << "Error"; } } cout << endl; } ... ... ... is wrong. It should be do { for(int i = 0; i < mazeX; ++i) { for(int c = 0; c < mazeY; ++c) { maze[playerX][playerY] = 2; switch(maze[i][c]) { case 0: cout << " "; break; case 1: cout << "#"; break; case 2: cout << "X"; break; default: cout << "Error"; } } cout << endl; } ... ... ... That is, when drawing your maze grid, you should first loop over your y variable and THEN over the x variable (in cartesian coordinate system). This is because that is how cout 'draws' things, from left to right, each 'y' line at a time, moving down the page. This will fix the coordinate inversion that you should be observing. Also, you should think of a function to create your maze array. Hint: it could be a coupla line function that loops over x and y and checks to see see if the maze cell should be a 0 or 1 ... a floor or wall. How do floor and wall differ with respect to your array? Anyway, good to see you're off to a good start. Keep up the progress.
  4. Using the SDL_gfx library?

    Quote:Original post by nobodynews Just for another perspective I can't find a zip file anywhere on that website either. I have javascript turned off in my firefox. When I opened the link I gave in IE, where I have scripts enabled, it redirects to a different page apparently. This page does not show the link for the zip file that is shown when scripts are disabled. So that accounts for the confusion. Here is the direct link to the zip file on the site.
  5. C++ SDL Transparencies

    Most people use rgb = {255,0,255} -- that crappy magenta color -- as the color key color since it is ugly and thus not used very much at all in normal CG situations. So you should make any areas that you want transparent this color; you can use an image editor such as Gimp or Photoshop to accomplish this. Quote:I've learned basic transparency when it comes to making one colour transparent, but the program I'm trying to make has objects that are transparent with many colours. I am not understanding what you mean by this. Are you saying that you have multiple color keys per image and that you would like to make certain ones transparent at certain times? Please explain. If you could explain exactly what you're trying to achieve, people cwould be in a better position to help.
  6. Using the SDL_gfx library?

    Quote:Original post by CheddarCheese The link that signal_ gave me seems to have a download called: "SDL_gfx-2.0.22.tar.gz" What exactly am I supposed to do with this file to use SDL_gfx? You're on windows right? If you look at the link one below the tar.gz file, it is a .zip file. You should be familiar with how to open zip files. In case you'd like to open a tar.gz file you can use something like 7zip on Windows. So just download the zip file and unzip it. All the files and compilation directions, license, etc. will be bundled there.
  7. Using the SDL_gfx library?

    SDL_gfx Site. Like rip-off said you could just add it to your project, but if you want to do it the formal way, then you will need to download the zip file from the above link. You then will need to build the project and link to the created dll file. Also, if all this is just to have a rotated sprite image, then you could build your own rotated sprite sheet, that is have a sprite with each frame being a different rotation. Something like Image Magick could automate this process. My last point is even if you get SDL_gfx up and running, you may have to examine if the rotozoomSurface function is fast enough for real time. If it is not, then you'd prolly be better off caching all the rotations which would basically be equivalent to the sprite sheet method, outlined above. Edit: on my machine it appears fast enough for a small 32x32 pixel sprite, so maybe it will be for you too. [Edited by - signal_ on December 15, 2010 5:04:50 PM]
  8. SDL program creating 2 windows

    What IDE are you using? What language? If we assume the most common configuration then it's visual c++ 2008/2010 by Microsoft. If you right click your project in the solution explorer and select properties, then you will bring up the Property window. On the left hand side click on Linker->System. In the subsystem field to the right, you can select such things as 'Console (/SUBSYSTEM:CONSOLE)' or 'Windows (/SUBSYSTEM:WINDOWS)'. You prolly have the former activated; if you change it to the latter then you should only open one window. The former option will additionally open a console window in addition to your SDL app. This can be useful, however; you may write debug info, etc. to this as yr program runs. The above assumes MSVC++ 2008. You didn't say what you're using so I typed in what I was using. Quote:Also, I can't close out of the SDL_app, I can only close the program if I close the exe window. Are you handling the SDL_QUIT event? Something like: while( SDL_PollEvent( &event ) ) { if( event.type == SDL_QUIT ) { // Quit the program // ... } } ? If you are not handling this then that is your problem, otherwise please say more.
  9. Cool. I will check it out, Owl. It's funny that you made this thread because a few days before I re-watched 36 chambers of shoalin as well as the shaolin temple (1982-Jet Li). And Zipster, thanks for the heads up. I will definitely check this out soon since it is ready to be streamed on my netflix. Also, to add to the recommendations, Ong Bak Thai Warrior is pretty decent too. Both that and its sequel are available for streaming on netflix (I've not seen the sequel though). As far as Arahan jangpung daejakjeon goes, it does not come up in netflix search so I will have to figure out how I can watch it.
  10. Very cool link, SuperVGA. I was thinking of a slightly different way of achieving the same effect, but the way that the article you linked illustrates seems more flexible/robust.
  11. I can just say how I got better at game structuring: keep making more games! I try to keep everything modular and try to learn new things everyday (this includes reading little snippets of insight from posters on these boards). I think it may be tough to find a tutorial for this type of thing. I think a lot of it comes from experience, building incrementally more complex games. Quote:Original post by MelonTime For example, for monsters on a map, I use a list (array) containing multiple instances of a Monster class. Each frame of my game loop, I iterate through each to run update and draw functions. However, I have no idea if this is the way I should be doing it, as it seems quite slow, especially with pygame. You may have inefficiencies in your update function; however, if you have a 'lot' of monsters you may be having problems if say you're doing inefficient O(n2) algorithms (eg for collision detection). Or maybe you have lots of draw calls; Pygame, as far as I know, uses software rendering. If you use something like SFML, which has python bindings (PySFML), you can make use of hardware acceleration and this can rapidly speed things up.
  12. What will you be using to make this game? Will you be using a programming language or game making software? What platform? What APIs/libraries/etc. will you use? As you can see a lot of information is missing for people to offer advice. I watched the video and I observed the following: 1. The game looks like it was made in 2D using sprites. 2. The background of buildings at the top of the screen is a static image that is scrolled back and forth (wrapping around when necessary) proportional to the amount turned when traversing a 'curve'. 3. Car sprites: There are two things here, the player's sprite and the AI cars' sprites. a. The player's sprite seems to have three frames: forward, bank left, and bank right. The player's sprite is always the same size and on the same y-coordinate (up-n-down) on the screen. The player influences the game by steering right-n-left, which corresponds to moving the sprite back and forth on the game screen's x-axis. Flourishes such as using the car bank frames and tire smoke mark sprites are used when turning/sharp turning. b. The enemy AI cars are scaled up and down depending on how far they are from the player's position on the track (far away cars are small & a car that's on your front bumper is big). 4. The player's car does not move, the track is dynamic and creates the illusion of movement. The track has three basic images: straightaway, bank left, bank right. The lines on the tracks as well as signs outside of the track move and scale to give the illusion of movement. The movement is from the far away horizon diagonally to outside of the screen linearly all the while the scaling for away objects to be larger incrementally as they move from the horizon to the player. These objects give the illusion of movement that the player is 'driving' into the screen. So that would be my rough plan if I were to want to clone this game. By the way people are not going to be able 'to teach you how to code something like' this. You are going to have to learn on your own how to make games. This forum can be a great help, but ultimately you'll need to learn on your own. Also, if this is the first game you are attempting to make then don't; start simpler. This will be a difficult project for a team of beginners. Welcome to the forums. ps: I found this crazy 'racing into the screen' game tonight made in Unity. Maybe it will provide more inspiration. Check it out: FOTONICA (requires Unity web plugin).
  13. In addition to M2tM's quality response, I would say to check out: XNA Platformer Kit. I think it does a good job of introducing the necessary concepts. Also, you may want to build some quick prototypes of the situations that M2tM outlined and see how you like them. I know you may be using C++, but the XNA kit has some good concepts/algorithms to glean; it also, is pretty responsive and smooth, so it may be a good starting point and you can extend those concepts to your specific situation.
  14. Java Physics: Why isn't this working?!?!

    I wrote a quick example in c#/xna. I think it will break everything down for you: Code: Vector2 target; Vector2 gun; Vector2 missile; Console.WriteLine("Welcome to missile/vector sim."); // Console.WriteLine("The origin is at the bottom left (0,0)."); Console.WriteLine("The game area is 100x100."); Console.WriteLine("Positive x is to the right; positive y is up."); Console.WriteLine("Missile tower is located at (50,0)."); Console.WriteLine("\nFire missile to (0 to 100) => (x):"); string str = Console.ReadLine(); int x = int.Parse(str); Console.WriteLine("Fire missile to (0 to 100) => (y):"); str = Console.ReadLine(); int y = int.Parse(str); Console.WriteLine("\nYou're firing the missile to location: (" + x + "," + y + ")."); target = new Vector2(x, y); gun = new Vector2(50, 0); missile = new Vector2(50, 0); Vector2 direction = new Vector2(0, 0); direction = Vector2.Subtract(target, gun); direction.Normalize(); Console.WriteLine("\n\nThe missile's direction vector is: <" + direction.X + "," + direction.Y + ">."); float missileSpeed = 1.0f; while (Vector2.Subtract(missile, target).Length() > 0.5) { Console.WriteLine("The missile's position is: (" + missile.X + "," + missile.Y + ")."); missile += missileSpeed*direction; } // Console.Read(); Output: Welcome to missile/vector sim. The origin is at the bottom left (0,0). The game area is 100x100. Positive x is to the right; positive y is up. Missile tower is located at (50,0). Fire missile to (0 to 100) => (x): 87 Fire missile to (0 to 100) => (y): 37 You're firing the missile to location: (87,37). The missile's direction vector is: <0.7071068,0.7071068>. The missile's position is: (50,0). The missile's position is: (50.70711,0.7071068). The missile's position is: (51.41422,1.414214). The missile's position is: (52.12132,2.12132). The missile's position is: (52.82843,2.828427). The missile's position is: (53.53554,3.535534). The missile's position is: (54.24265,4.24264). The missile's position is: (54.94975,4.949747). The missile's position is: (55.65686,5.656854). The missile's position is: (56.36397,6.36396). The missile's position is: (57.07108,7.071067). The missile's position is: (57.77818,7.778173). The missile's position is: (58.48529,8.48528). The missile's position is: (59.1924,9.192387). The missile's position is: (59.89951,9.899493). The missile's position is: (60.60661,10.6066). The missile's position is: (61.31372,11.31371). The missile's position is: (62.02083,12.02081). The missile's position is: (62.72794,12.72792). The missile's position is: (63.43504,13.43503). The missile's position is: (64.14215,14.14213). The missile's position is: (64.84926,14.84924). The missile's position is: (65.55637,15.55635). The missile's position is: (66.26347,16.26345). The missile's position is: (66.97058,16.97056). The missile's position is: (67.67769,17.67767). The missile's position is: (68.3848,18.38478). The missile's position is: (69.0919,19.09188). The missile's position is: (69.79901,19.79899). The missile's position is: (70.50612,20.5061). The missile's position is: (71.21323,21.21321). The missile's position is: (71.92033,21.92031). The missile's position is: (72.62744,22.62742). The missile's position is: (73.33455,23.33453). The missile's position is: (74.04166,24.04164). The missile's position is: (74.74876,24.74874). The missile's position is: (75.45587,25.45585). The missile's position is: (76.16298,26.16296). The missile's position is: (76.87009,26.87007). The missile's position is: (77.57719,27.57717). The missile's position is: (78.2843,28.28428). The missile's position is: (78.99141,28.99139). The missile's position is: (79.69852,29.6985). The missile's position is: (80.40562,30.4056). The missile's position is: (81.11273,31.11271). The missile's position is: (81.81984,31.81982). The missile's position is: (82.52695,32.52692). The missile's position is: (83.23405,33.23403). The missile's position is: (83.94116,33.94114). The missile's position is: (84.64827,34.64825). The missile's position is: (85.35538,35.35535). The missile's position is: (86.06248,36.06246). To understand about vector normalization, this this wiki article section. Also note I used XNA's Vector2 class for the vector op's to implement the thing I talked about in the last post. You can prolly just follow the code and implement something similar in yr program. Also, note how all physical objects in my simulation have a consistent coordinate system; if this requirement is not met, results may suck. So basically my output has me firing the missile from position (50,0) -- the gun's position, to the user chosen target-- in this case, I chose target = (87,37); in your situation this would just be the target position chosen by the user's mouse.
  15. Java Physics: Why isn't this working?!?!

    Quote:Original post by nuclearfission ...However I'm having trouble sending the missiles to where the mouse is being clicked. I've tried using vectors(trigonometry) to set a missile X velocity, but it just isn't working. Everytime I click on the mouse the missile shoots either in 1)a fixed point or 2)Not where the mouse is. Anothing thing is that java works in radians not degrees, and I have not a clue how to relate radians on a graph?(probebly could have googled: to lazy though) So yeah you need trigonometry, vectors, etc. First off you have trouble with the concept of radians. Here's a little history: some time a long time ago some bloke discovered that the ratio of a circle's circumference to its diameter is a constant. He called this pi. Then someone invented the radian. It is a way to measure an angle. Basically you take the length of the arc, cut out by an angle, like a piece of pie, in the circle and divide it by the circle's radius. This is how many radians the angle is. You can also convert this to degrees. Then since pi was on the scene and now radians blokes decided to get together and formalize. The rest is history. 180 degrees = pi radians (where pi = 3.14.........................). So if you have theta degrees and wish to convert it to radians then radians = theta * pi / 180(degrees). If you wish to convert someRadians to degrees, just degrees = someRadians * 180(degrees)/ pi. I'm not going to look thru your code, but hopefully the following will be enough for you: 1) get mouse coordinates (where you are firing) -- call this m = <mx, my>. This is vector notation; if you do not get this ask. 2) get missile origination point. You should know this; it is where the missile tower sprite is -- o = <ox, oy>. NOTE: (1) and (2) should be both described using coordinates from the same coordinate system. If you do not get this ask. It's important. Then form a vector, p = <mx - ox, my - oy>. Then form a vector called u = norm( <px, py> ), where norm ( * ) is the vector normalization operation. Again ask or google if you're not familiar. Then each frame the fired missiles position vector, f, can be updated like f += speed * u, where speed is the speed of the missile, and speed * u is the velocity of the missile. Obviously, this last part, you can adjust to your taste, like if you need to do frame independent movement.... Hope this helps a bit (hopefully I didn't type in any mistakes).