Jump to content
  • Advertisement

Starfarer42

Member
  • Content Count

    51
  • Joined

  • Last visited

Community Reputation

658 Good

About Starfarer42

  • Rank
    Member

Personal Information

  • Interests
    Design
    Programming
  1. This sounds like an XY problem to me. Try backing up a step or two and describe what you're trying to accomplish. I suspect someone on these forums will be able to suggest a different approach that might work better.
  2. Starfarer42

    Handling resource pointer with RAII

      This seems like a clear sign that your BitmapFile class is doing too much. Bitmaps don't always come from files and the two concepts should be handled separately. If I were designing this feature, I'd make a Bitmap class that stores a chunk of pixels and has operations to draw those pixels on screen, and another class that knows how to read files and extract the bitmaps they contain. That way you could create bitmaps from other sources without being tied to files or file formats.
  3. In addition to your Android client software, you're going to need some kind of server to record each player's stats and distribute them to the other players. You'll also need to decide whether the battles happen on the client or the server. I can see advantages to both.   The database performance isn't going to matter much until/unless you have millions of players so I wouldn't worry about it much. Your players are *NOT* going to be happy if they lose all their progress because your server crashed so make sure you have a plan to preserve that player data in the event of disaster. That means data replication to multiple servers and/or regular backups to somewhere off-site.   When you're looking for tutorials, ignore anything about making real-time games. The interaction you described does not sound like real-time to me. What does it matter if your opponent's stats are a few seconds (or a few hours) out of date? You just need an opponent to fight and then you need to communicate the results of that fight back to the server. Instead, look for tutorials about how to create and use a basic RESTful server API.
  4. Starfarer42

    Condition for function

      There really isn't. You've defined the function as "Given a number that is some value multiplied by itself, return the original value." That is the very definition of the square-root function and if there were anything simpler then we'd be using that function instead of sqrt.   Perhaps it's time to back-up a step. Why are you looking for a function that does square-roots without using the sqrt operation? Is this some sort of performance optimization?
  5. Using an Agile methodology is probably your best approach here. Figure out what the absolute minimum viable game is and work on implementing that as fast as you can. Once you have a functioning game then think about what small features you can add to make it better and implement those. Rinse and repeat until you hit the deadline. The key point is that at each step of the way you'll have something that is "shippable" -- it might not be everything you'd hoped it would be but at least it's something you could submit if you had to.
  6.   I think the OP is looking for something more subtle than that. Not everyone wants to be explicitly told exactly which way to go.   What about giving out very small rewards to the player for moving in the right direction? Think of something like a Super Mario style game where the coins are laid out along the path you need to take. If you're collecting all the coins then you'll naturally move towards the level goal, or you might even find something secret or hidden that the coin-path led you to. You could apply something like that to your game where you place small rewards between the player and the next objective. I don't know what rewards are thematically appropriate for your game -- maybe it's berries to collect, or small animals to kill -- but the point is that as long as the player moves toward the next goal then there will be something to see and to do. The player can still move away from the next objective and explore but they'll quickly find that it's kind of boring.
  7. Or go back a step and let people submit questions in the first place. I realize that doesn't fit the original plan to source questions from the Internet, but I fear that doing a good job of that would require building strong AI. Crowd-sourcing the questions would be much easier.
  8. Starfarer42

    Random Spawn Optimisation

    You should exclude points that are exactly on the edge or you'll get a very small bias in the result. Most PRNGs generate numbers between 0 inclusive and 1 exclusive, so they might generate a point like (0.6, 0.8) but never (0.0, 1.0) or (1.0, 0.0).
  9. Starfarer42

    Random Spawn Optimisation

    That would work except for two issues: The first is that you're not going to get an even distribution around the edges because there will be a slight bias towards the corners. You can fix that by ensuring your random positions fall within a circle, not the square X-Z plane. The other problem is that there is a minuscule chance your random position would be (0, 0) which will cause a division by zero error when you try to normalize the vector. You can fix that by ensuring the position you generate is some minimum distance away from the center.   To generate a random evenly distributed direction, follow this algorithm: Generate random x and y coordinates between -1 and +1 Calculate the squared length of the vector (using Pythagoras: lengthSquared = x*x + y*y). If the squared length is greater than or equal to 1, or less than some small (but non-zero) minimum then discard those coordinates and return to step 1 Normalize the vector and return it. Once you have the direction the rest of your algorithm is correct. Multiply the vector by the arena's radius and add its center position to get a random position along the edge.
  10. Starfarer42

    trying to think up a new way to level up

      That's an interesting mechanic, but how do you keep the later levels balanced so that they're challenging enough for a wide range of character levels?   For example, if the player is on level 21 then they could have as few as 20 crystals or as many as 60. How do you design a level that would be challenging (but possible) for a level 20 character without it being a cake-walk for a level 60 character?
  11. Starfarer42

    Spaceship course calculation

    Have you tried NOT plotting a course and simply steering toward your destination? Assuming your ship is much faster than an orbiting planet then it should follow a pretty reasonable path, but you don't need to work out exactly what that path will be in advance.
  12. Starfarer42

    simple java question

      If your code has sufficient permissions then yes you *could* use reflection to access the underlying character array that stores the string's value and mutate it. You'd be violating a very fundamental assumption (that Strings are immutable) and probably break all kinds of things in the core library. 
  13. Starfarer42

    simple java question

    They are, but that does not matter here. The assignment i = "0" is syntactic sugar for i = new String("0"); which should make what happens much clearer.   No it's definitely not. Java guarantees that ALL occurrences of the literal "0" in source code are in fact the same object, and assigning that literal to a variable does NOT create a new instance. On the other hand, calling new String("0") guarantees that you have a new String instance whose value happens to be equal to "0". The two situations are not at all the same.
  14. Starfarer42

    Singletons and Game Dev

        No.  The GoF Design Pattern's Singleton (p.127-134 since I have the book within arm's reach) is a private static variable with a public static accessor, and the variable is either static-initialized at runtime or lazy-initialized on first use.   It has nothing to do with synchronization. It does not ensure any operations are atomic. It does not ensure functions are re-entrant. It does not ensure operations inside the functions are interrupt-safe, and therefore not thread-safe.   So again, no, by itself it does nothing for synchronization or any other threading-related use. None of that means you *can't* make a thread-safe singleton object. It's actually not that hard to ensure the singleton is only initialized once and making the singleton's own methods thread-safe is no more difficult than any other kind of object.
  15.   Maybe not. The algorithm the OP posted appears to be a way to estimate the normal of a surface by sampling the nearby points without building triangles first.
  • 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!