Jump to content
  • Advertisement

akshayMore

Member
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral

About akshayMore

  • Rank
    Newbie

Personal Information

  • Role
    Programmer
  • Interests
    Art
    Design
    Programming

Social

  • Github
    akshayMore2018

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. SFML : multiple key issue if (Keyboard::isKeyPressed(Keyboard::Space)) { std::cout << "Space" << std::endl; } if (Keyboard::isKeyPressed(Keyboard::Left)) { std::cout << "Left" << std::endl; } if (Keyboard::isKeyPressed(Keyboard::Right)) { std::cout << "Right" << std::endl; } if (Keyboard::isKeyPressed(Keyboard::Up)) { std::cout << "Up" << std::endl; } output: CASE 1: 1) When pressed Up + Left + Space : Up Left Space 2) When Pressed Up + Right + Space : Up Right After searching for a while I found out that most keyboards can only only register a certain number of key presses at any given time, and ignore any subsequent key presses until you release one or more of the current keys. This doesn't apply to modifier keys (like Ctrl, alt, and shift) . So I checked it by replacing "Space" key by with "LAlt". The output was : CASE 2: 1) When pressed Up + Left + LAlt : Up Left LAlt 2) When Pressed Up + Right + LAlt : Up Right LAlt This works as expected but........if keyboards can only only register a certain number of key presses at any given time then why was "space" key detected when pressed along with "up" and "left" key and not with "up" and "right" key? Is this an issue with sfml? I just want to confirm whether it is indeed the issue where keyboard is unable to register multiple key press at same time. I am trying to fire bullets from a spaceship. I am able to shoot bullets while moving forward and steering left but unable to shoot while steering right. I would really appreciate any help.
  2. 1. "Bullets that get destroyed on collision with enemies " In this case multiple collision is not an issue as the object(bullet) is no longer there. If you think from bullet's perspective....its weakness is enemy collision. 2."Bullets that are not destroyed on collision." If you think from bullet's perspective......its weakness is no longer enemy collision but its own lifespan( timer). From enemy's perspective.....to handle multiple collision with the bullet. I would make enemy immune for few seconds(or ms) ( where it ignores collision from the passing bullet). After the time have elapsed, the enemy is ready for fresh collision. You don't have to keep a track of IDs and checks in this case. Other way would be to handle this using ID/Boolean checks as mentioned by others.
  3. akshayMore

    circle drawing method comparison

    Thank you very much for the responses. I appreciate it. Both the methods, drawPoint() and drawPolygon() eventually draw a pixel image. drawpoint() keeps the scale to (1,1) while drawPolygon() passes the data to drawLine() that scales the image to the distance between two points. So overall it should be the number of calls in first method that is making it a little slow than the use of trigonometric calculations in second. right? Ah...so rendering 50 lines(segments) + expensive calculations takes less time than rendering 50+ points with simple calculations. I had previously named it drawCirclePoints() then I changed it to drawBresenhamCircle() just to show that it is the part of the above function. But yeah you are right it is confusing. I will change it. Thanks.
  4. Hello, I am trying to make a GeometryUtil class that has methods to draw point,line ,polygon etc. I am trying to make a method to draw circle. There are many ways to draw a circle. I have found two ways, The one way: public static void drawBresenhamCircle(PolygonSpriteBatch batch, int centerX, int centerY, int radius, ColorRGBA color) { int x = 0, y = radius; int d = 3 - 2 * radius; while (y >= x) { drawCirclePoints(batch, centerX, centerY, x, y, color); if (d <= 0) { d = d + 4 * x + 6; } else { y--; d = d + 4 * (x - y) + 10; } x++; //drawCirclePoints(batch,centerX,centerY,x,y,color); } } private static void drawCirclePoints(PolygonSpriteBatch batch, int centerX, int centerY, int x, int y, ColorRGBA color) { drawPoint(batch, centerX + x, centerY + y, color); drawPoint(batch, centerX - x, centerY + y, color); drawPoint(batch, centerX + x, centerY - y, color); drawPoint(batch, centerX - x, centerY - y, color); drawPoint(batch, centerX + y, centerY + x, color); drawPoint(batch, centerX - y, centerY + x, color); drawPoint(batch, centerX + y, centerY - x, color); drawPoint(batch, centerX - y, centerY - x, color); } The other way: public static void drawCircle(PolygonSpriteBatch target, Vector2 center, float radius, int lineWidth, int segments, int tintColorR, int tintColorG, int tintColorB, int tintColorA) { Vector2[] vertices = new Vector2[segments]; double increment = Math.PI * 2.0 / segments; double theta = 0.0; for (int i = 0; i < segments; i++) { vertices[i] = new Vector2((float) Math.cos(theta) * radius + center.x, (float) Math.sin(theta) * radius + center.y); theta += increment; } drawPolygon(target, vertices, lineWidth, segments, tintColorR, tintColorG, tintColorB, tintColorA); } In the render loop: polygonSpriteBatch.begin(); Bitmap.drawBresenhamCircle(polygonSpriteBatch,500,300,200,ColorRGBA.Blue); Bitmap.drawCircle(polygonSpriteBatch,new Vector2(500,300),200,5,50,255,0,0,255); polygonSpriteBatch.end(); I am trying to choose one of them. So I thought that I should go with the one that does not involve heavy calculations and is efficient and faster. It is said that the use of floating point numbers , trigonometric operations etc. slows down things a bit. What do you think would be the best method to use? When I compared the code by observing the time taken by the flow from start of the method to the end, it shows that the second one is faster. (I think I am doing something wrong here ). Please help! Thank you.
  5. akshayMore

    Choosing programming language

    I had the same question back when I was in college. Later I realised that language doesnt really matter, its all about OOP. If you are completely new to game develpment. I would suggest you not to start with C,C++,C#,Java. Also, I would recommend that you dont start with Unity or any other big engines. Dont jump straightaway into it just because it is popular and widely used in the game industry. Start smaller. Go with python(pygame). There are plenty of resources available(easily and freely) to get you started. Get fimilar with:- 1.How a game loop works. 2.What are sprites and how to use a spritesheet. 3.How to animate your characters and other game objects. 3.What is a tileMap and how to generate a map from an array of data. 4. Game physics . Collision checks and resolution. These are the basics. Once you are comfortable with it. Then you can move on to Java(libGDX) . You will realize how smooth the transition is now that you are familiar with the workings of a game loop. You can then move on to the languages like C++ or C#. The next thing to master would be the design patterns. How to structure your code. GoodLuck!
  6. akshayMore

    Steering Behaviors

    Album for Steering Behaviors
  7. akshayMore

    IsometricWorld

    Album for IsometricWorld
  8. akshayMore

    custom2DPhysicsEngine

    Album for custom2DPhysicsEngine
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!