• Content count

  • Joined

  • Last visited

Community Reputation

177 Neutral

About runnerjm87

  • Rank
  1. Player Movement - Input + Network Messages

      This is a good idea. You should still pass data to the server only when there's a delta, but you're right, this should make it harder to cheat.     You'll want to do the server side check on a very limited basis. The example that I gave was probably a little too limited, but when there are multiple players at once, each client will send any input changes to the server while the server is busy doing all of the physics calculations and pushing updated positional "snapshots" of the scene at set intervals of a few milliseconds. The snapshots should contain all information related to position for each non-static object so that the clients are synced to the server's version of the game. The server side check is to ensure that the server's version is accurate and doesn't need to be done nearly as often, once every one to two seconds should keep any interpolation error correction from being very noticeable.
  2. YAML vs JSON vs XML?

    I can't really speak to the pros/cons of YML, I wrote a quick and dirty parser for it a while ago for a webapp, but that's my entire experience. As far as JSON is concerned, if you're not using Javascript, there isn't much point. The reason that JSON is so nice in web development is that it is instantly recognized by the browser's JS interpreter as an object so there's no additional parsing necessary. This is only true in Javascript, though. Any other language requires a custom library to interpret JSON.   Personally, I would say work with XML. For one thing, you already know it. For another, a lot of people already know it, so if you end up bringing another person in on your project, they won't be stuck trying to familiarize themselves with a new data format (and if the person you're bringing in isn't at least somewhat comfortable with XML, you might need to ask if they're a good fit).
  3. Player Movement - Input + Network Messages

    On the networking issue, I agree with NightCreature that UDP is a better protocol, but that has no real bearing on finding a "best solution" solution to your problem. It might throw up some roadblocks along the way, but that's all.   As far as how the client-server model should work, the most efficient way that I've seen to handle and dispatch client events to a server is to track each player object's states, depending on what type of game you're making this might only be a movement vector, and transmit those to the server only when they change. So, to break this down a little further:   (Assume only one player is actually playing and everyone else is watching, just for ease of typing this out)   *Player presses the left arrow key, movement vector is now (-5, 0). *Vector (-5,0) is pushed to the server, stored player vector is updated. *Player position is updated and transmitted to all connected clients. *Player continues press the left arrow key, movement vector remains (-5,0) *No data is transmitted to server *Server uses stored player vector to update position and transmits to all connected clients. *Player releases left arrow key, movement vector is now (0,0) ... and so on.   Every now and then, you'll also need to do a full state check for each connected client, ensuring that the server's calculated position for that player is correct, since any dropped packets could result in a miscalculation.   And as for your first question, neonic's solution is absolutely the way to go. My input manager classes always have a private boolean array with 256 indexes. It uses minimal memory and means that you don't need any custom handlers for each key.
  4. Game management

    I agree with L Spiro and EWClay on this one. Game programming isn't where you start, but it's a nice place to end up.   When I started programming, all I wanted to do was make games, so as soon as I could render a jpg I was off and running (and crashing and burning). There's a lot of behind the scenes stuff that goes into making a game, at a very abstract level, and understanding all of the fundamentals about procedural and object-oriented programming is an absolute must.   As far as learning how to sketch out your ideas on paper, I would look into buying a book on UML, it's a fairly standard design language for object-oriented programming and you might get a sense for how larger projects are structured from the examples in the book. This is the book that I have, if you want to go that route.
  5. HELP!

    If your end goal in learning Java is to make video games, I'd suggest taking a look at Swing, [url=""]Zetcode[/url] has a good tutorial that will walk you through the basics and teach you about the different class types in Java. If you're looking for more specific advice, let us know what it is you're looking to learn and I'm sure someone will be able to help you.
  6. Starting with a game

    Sugavanas- The specific requirements really depend on what kind of game you want to develop. In general, however, a game development project should start like any other software development project, i.e. defining the goals, mapping out your classes, input and output, prototyping some of your ideas and unit testing them. For a video game, the general software requirements are a graphics library - either something low-level like DirectX or OpenGL or higher level like SDL or SFML - a sound library - DirectX and SDL will also be able to handle this, also look at FMOD - and some way of receiving user input from the keyboard and mouse - again, DirectX or SDL. You should also look at existing solutions, like XNA which is a C# toolset specifically for making games on Windows or 360, and Unity which is a fairly powerful game engine that will allow you to write your code in C# or Javascript (and I think they have support for a third language as well) and comes complete with I/O, sound, graphics and physics pipelines that you can take advantage of. If you can be more specific about the type of game, it will be easier to give you less general advice on what types of software are available to help you.
  7. Store quadtree data in db

    If I'm looking at this correctly, what you're expecting is that the string representing a fully explored region of 1024x1024 nodes would be nearly 80,000 1s. Depending on the database engine you're using, either a CLOB or mediumtext column will be able to handle storing the string as this will only come out to 77~kb. As far as using the data in your application, I would still suggest that you use a map object to store the nodes. Since your hero is only going to be able to occupy one space at any given time, you're going to have a much easier time and your program will be more efficient if you are accessing and manipulating the data in a map than if you were constantly parsing an 80,000 character string.
  8. You can simplify Knolan's formula, and cut out the need for finding floor(), by using the float value of n instead. In the above example where you have 5 cells x and 2 cells y, you would come out with: n = (5/2) = 2.5 so that for every time your x movement is >= 2.5 you move 1 y and store the remainder (.5) in your counter variable. I would write this up like: [source lang="java"]int xDiff = targetX - currentX; int yDiff = targetY - currentY; int xDir = Integer.parseInt(xDiff / Math.abs(xDiff)); int yDir = Integer.parseInt(yDiff / Math.abs(yDiff)); int large = ((Math.abs(xDiff) > Math.abs(yDiff)) ? Math.abs(xDiff) : Math.abs(yDiff)); int small = Math.abs(xDiff) + Math.abs(yDiff) - large; float n = large/small; float count = 0.0f; for(int i = 0;i < large;i++){ count += 1.0f; if(large == Math.abs(xDiff)){ currentX += xDir; if(count >= n){ currentY += yDir; count -= n; } } else { currentY += yDir; if(count >= n){ currentX += xDir; count -= n; } } }[/source]
  9. Store quadtree data in db

    In general, I would suggest converting the quadtree to a geohash by indexing each of your quadtree's nodes with a binary representation of it's location (00 for NE, 01 for NW, etc.) and the prefixing each of the child nodes with the parent's index (e.g. the key 0111 would be the SE tree/leaf of the NW tree of the root). By then returning a string representation of the hash, you'll be able to easily store the data in a database while still being able to retrieve and modify it. Hopefully this helps.
  10. What language does what?

    Java is a great language to begin learning the core concepts of OOP, given that the JVM handles a lot of the low-level processes that tend to cause headaches. I would suggest that if you're going to get into game development that you learn C++ simply because it gives you a higher level of access to the memory that your program is using which will give you more flexibility when it comes to fine-tuning performance. The Unreal Engine, for example, is written in C++, gives you the ability to write and utilize your own C headers (with the licensed version, not UDK) and its native UnrealScript language uses many of the conventions common to Java.
  11. 2D Game art help

    I've used Gimp, and Photoshop for some of my 2D projects in the past and I would personally suggest Gimp. While it is, at first, a little more complicated than PS, I would say it takes no more than a week or two to become fairly competent with the UI. Also, it is extremely well-documented (the user docs are [url=""]here[/url]), has a huge user-base and an active forum at [url=""][/url] and has an enormous [url=""]plug-in library[/url] so it will be hard to find anything that it isn't capable of accomplishing. You really should be using a layer-based image editor for game art as it will speed up the process of generating your sprites once you've got the hang of it.
  12. It would be helpful if you could explain what you already have established. For starters, are you using a one- or two-dimensional array to store the tiles and do you have to worry about finding paths around other objects on your tile grid?
  13. Where should I start?

    I agree with nooblet. These forums are an amazing resource for learning many of the things you will need to know to start programming your own games and you should take the time to familiarize yourself with them. That said, I would start learning with a book. The first book I ever read on the subject of game programming (or programming in general, for that matter) was [url=""]"Beginning C++ Through Game Programming"[/url]. It will walk you through a lot of the core concepts behind building a basic game in a console window which will be extremely helpful for you if your background in this is primarily based on GUIs and SDKs. Hope this helps
  14. Start game programming

    Between Javascript and PHP there is very little that you won't be able to do. With the relatively recent addition of HTML5's canvas tag, there is a huge move towards browser-native game development. As an example, take a look at this project: [url=""][/url]. It's a lot of work but, as Serapth said, JS is the future and it's definitely powerful enough for what you're looking to do
  15. Question For Programming Browser Based Games

    Programming a game for a browser is similar in many ways to programming any game except that you need to also understand the mechanics of client/server communication for even the most basic interactions. As others have already mentioned, learn PHP, MySQL and JavaScript. You will also need a means of displaying your game's content. With Flash-based games this was as simple as drawing on the stage, but with Flash gasping its last few breaths (hopefully), I would suggest an alternative, either the HTML5 canvas element or SVG. In terms of the best way to learn all of the fundamentals you will need to get started, take a look at [url=""]W3Schools[/url], they have fairly comprehensive guides and language references that walk you through the basics of web design/development and cover all of the languages you will need. As far as what you've listed as project goals, there is nothing that can't be accomplished on that list, but there is a lot of work involved to get it all done. If it were my project, I would start with the basic interactions (moving around the world map/dungeons, picking up/using/dropping items, etc.), then design the battle system and hammer out all the remaining details on the single player side before ever starting on the multiplayer content. This will allow you to have all interactions in place so that you can easily define the data models needed for the networked aspect of the project.