Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

274 Neutral

About 5MinuteGaming

  • Rank
    Advanced Member
  1. I know exactly where your coming from with that. I too thought that I would learn all I needed to know that Uni, now I do website support and development. I have developed copious amounts of engine code but have yet to put things together into a game. The one thing I wish I had done more was to practice designing small games. I do believe that having finished games is the largest hurtle to being a successful game maker and ultimately making a living out of it. Again I am in the same situation, I am focusing on creating and designing games now instead of on the coding aspect though it's currently really hard to switch gears after years and years of focusing on the endlessly evolving technology. That there is the crux it doesn't matter what the technology is games made in any language with any technology can still be enjoyable as long as the gameplay is good. Look at the classics for proof that this is true, pacman, tetris, mario, zelda. These games have stood the test of time the code has been ported and emulated on newer technology but the game design hasn't been altered. Yes the general advice for beginners is to choose a technology, and I think everyone whose tried can agree that any language or engine can work even with limitations. I would say the best way to practice is to remake the classics use the existing design use freely posted artwork from the internet for your graphics or placeholder images or just render text. You want to get to the point where you've handled some of the coding problems related to these classic styles of gameplay. Even something as seemingly simple as pacman AI can be challenging if you've never coded it before. So my suggestion to you is to pick a classic, some that a lot of tutorials and beginners go to are Old School brickout - you will learn basic 2D collision detection how to design scoring systems and replayability asteroids - will give you more complex collision coding experience and how to handle a changing environment and a little free roam player movement. pacman - will teach you some AI and how to make a game more fun by tweaking those little ghosts top-down shooter - will give you a little bit of level design experience, and will teach you the values of a level editor or scripting support whether you use them or not. side-scrolling platformer - will teach you how to develop and create a realistic world and story elements, these can become complex but start with one weapon simple enemies that just move back and forth. puzzle - will teach you how to think about player difficulty and how to design game progression effectively. As well as get you thinking outside the box since puzzles games can create genres each in their own right. The good thing about these is that they have a lot of attention their basically the classical computer games and elements from these are seen in tons of AAA games. You can add other elements to these games and find a lot of information about them which is helpful when your stuck and could get disheartened. New age tower defense - these are simple and pretty set game designs which is good cause you don't have to design too much but still have some interesting choices to make. Making one of these can teach you a lot about balancing and how the little things effect gameplay in the long term (very important) (I can't think of any others right now, that don't fall into the above designs) The sad truth to me is that you can read and study all you want about making video games, you can even design complex and creative worlds, items, levels, and other game elements but until you've actually implemented the gameplay in code and made it work and polished a game with all the bells and whistles (saved games, sound, options menus, high scores, etc...) you really aren't a game programmer/designer. Having a portfolio of games you've created whether sold or just for personal use will be something that will attest to your abilities infinitely better than going to an interview or contacting a game company looking to break into the industry. I hope this helps steer you on the right path, good luck!
  2. Back to making games
  3. 5MinuteGaming

    Is OOP better for developing games?

    One of the first usages and primary goals of OOP is encapsulation! The data-oriented programming in the article is more of a data oriented design and does not discard any OOP principles or design. The article is mainly about cache misses as a cause of bad performance. He blames it on OOP and wrongly so, as he states it's more of the general way OOP is taught and how a lot of new OO programmers tend to design using the classic desktop app approach and not focusing on performance. The article is more of a reminder that the underlining CPU architecture is important and should be taking into account the way your data is being stored in memory is important for performance. I am curious to see how he came to the conclusion that cache misses were the direct cause of all performance issues on projects he worked on over 10 years. There are other ways to improve performance in your design and managing memory localization in your design if cache misses is determined to be the root cause of performance issues, but usually it is something much different like non-optimized usage of the GPU which causes more performance problems than anything else I've ever seen. Concurrent programming comes with it's own perils, including deterministic functionality which is hard to do with multi-threaded applications and even more so with multi-cores as one tries to optimize code on a lower level. Threading in game design is the topic of a lot of experimentation and development, especially on multi-cores. OOP is both cost effective and productive for larger teams and projects. Proper abstraction can help make your code reusable, extensible, and easier to debug. Smaller projects like those most are familiar with here, may be easier to maintain, debug, and optimize with a functional language or a simpler OO design. @Antheus Simulations and time critical applications are not impossible to design effectively and efficiently using OO. I noticed your examples are referencing common design practices used in game OO programming wherein GameObjects are a base for everything in a game world and are responsible for updating itself. That is an issue in design not in any aspect of OOP. The GoF patterns can be successfully and effectively applied to Games and especially to large sets of related objects. Case and point, the Flyweight pattern is very effective and more efficient than common approaches to particle systems. But that is a matter of poor OO design for games. The state pattern is easily the most useful to switch between different game screens, also used in AI and makes extending them much easier during development. The mediator pattern can be used in place of each GameObject updating itself. The visitor pattern can make optimizing collision detection algorithms easier with no impact on any other code. The strategy pattern can be used for supporting different space-partitioning algorithms. These are only a few usages of OOP that are good things. OOP in my opinion can be hard to get right, easily over-designed, easily broken in common practices (such as getter and setter methods), require careful and experienced design. But its benefits do completely outweigh the functional programming paradigm or instances where one might BREAK OO principles. However, OOP in games is not the way to learn how to program games, without OOP Orge3D would not be able effectively abstract the rendering system (OpenGL, versus DirectX), support tons of plugins and many different plug-able functionality. It is beneficial for APIs because objects make it easier for programmers to understand how to use them, they are easier to visualize. Otherwise API and library writers have to write lots of documentation, case and point opengl. Very good for large APIs simpler ones are sometimes just as easy to understand with a small set of functions but the key there is small. For a triple-A commercial game title development time frames would double and risk would almost triple without OOP. Large programs are easier to develop with OOP and good design can reduce lots of overhead, performance issues, etc. I am talking hundreds of thousands of lines of code, especially the millions of lines of code in games today. It is absolutely necessary to decrease time to market, which is a constantly growing trend in the games industry along with abstracting out hardware specific code and cross-compiling, having the ability to release for multiple platforms, and reducing platform specific testing. Furthermore encapsulation reduces coding errors by simply preventing a programmer from calling any function that does anything at any time. Lisp solves that by defining each function as having a specific functionality similar to encapsulation. But this is my opinion on OOP, which is what the OP asked for, so I think some industry research would be necessary to say whether OOP is truly better for developing games. Obviously it is a trend for a reason, and games have only gotten more realistic and more detailed. I apologize for the long-winded post.
  4. I have written a fairly large application with over 20 different forms. I use a combination of three things BorderLayouts, GridBagLayouts, and swing Borders. I would have used the GroupLayout, new as of jdk1.6 which is actually very versatile and provides an excellent dynamic sizing capability for your forms. I agree that GridBagLayout is hard to work with even for a veteran java programmer. Until you've done many different styles of forms with it it can be...quirky. If you are learning I would suggest staying away from GUI Builders my reasoning is that your initial instinct will be to make everything a static size, which will make the layout managers useless. One of the advantages of swing is it's ability to provide dynamic resizing of components. You won't find the same ease in Microsoft gui programming, with vb and c#, iirc. Borders are very important and with the GridBagLayout the insets are equally important to promote usability; you need spacing between components. As has been said you can use simple nested layouts. However, both GridBag and Group allow you to skip the nesting, making the behavior a bit simpler to manage, they allow you to put multiple sections of components in the same Panel without the need for nesting, but similar layouts can be achieved using nesting. The last alternative that I can suggest is rolling your own layout manager. It's extremely easy, of course you'll need to follow a few tutorials or examples, but it doesn't take much to make one. Good luck! As always feel free to ask more questions, layouts have become easier for me over the years so it doesn't take me much time to layout a form anymore.
  5. 5MinuteGaming

    [java] borderlayout ?question

    It all depends on what kind of layout you are trying to go for. But in order to support more than 5 components using a BorderLayout you need to nest your objects (components) inside other containers (JPanel usually). GridBagLayout is a necessary layout for non-nested forms. If you use a null layout i.e. setLayout(null) you can position your components to absolute values meaning that where you setPosition(x,y) is where they will appear, but they won't move or resize if the window is resizable or if it's container is resized. A combination of FlowLayout, BorderLayout, CardLayout, and GridLayout is usually good for a start but eventually you will enjoy using GridBagLayout for flexibility and significantly shorter amount of code and nested components. BorderLayout will only allow a single component to occupy one direction, i.e. there can only be one component in the NORTH spot. see the LayoutManager interface java docs for a list of available layouts. I would familiarize yourself with as many as possible. It also isn't that difficult to make your own layout manager. Also you can get a good deal of information reading some of Sun's Java Tutorials they have them for just about anything, their not entirely geared toward professional level applications but they cover the basic usage of the sdk classes. They have one for layout managers Using Layout Managers it would definitely help to at least check out example code or read through it.
  6. It's hard to say without seeing the code you have so far. It may just be something really innocuous.
  7. Quote:Original post by Ramon Wong question that I have is why do I have to divide the size with 8? The primitive type object wrappers provide constants for the size of the primitive type, but those are in bits, a short would usually be 16 bits, integer usually 32 bits. I guess this was for flexibility or maybe just completeness. I didn't think about it too much when I wrote the example but it would be more appropriate to do the following: Integer.SIZE/Byte.SIZE Since what you really are making is an array of Bytes. But I guess for file reading you need an exact number of bytes that your reading in, so I would say constants are just fine as long as the file format specifies the number of bytes for the field your trying to read. As a side note, when converting from C to Java the following would be very close. Where n is the size of the array. Cchar *buf = new char[n]; Javabyte buf = new byte[n]; You can do most of the same operations in a similar manor. E.g. Cmemcpy(dst, buf, n); JavaSystem.arrayCopy(buf, 0, dst, 0, buf.length); Feel free to post any other conversion questions you have.
  8. String has a constructor that receives an array of bytes and converts that to a string. One thing to note however is that an array of bytes cannot be determined to only have 1 byte per character as it might be in wide character format. But there are constructors that allow for converting the type of ascii encoding if need be. To get the first 10 bytes from a stream or even the first n bytes, use the following. byte header[] = new byte[10]; is.read(header); String headerString = new String(header); Now to read in the integer version. byte versionBuf[] = new byte[Integer.SIZE/8]; is.read(versionBuf); ByteBuffer bb = ByteBuffer.wrap(versionBuf); IntBuffer ib = bb.asIntBuffer(); ib.rewind(); //must have to go back to the beginning of the buffer int version = ib.get(); Likewise there are multiple types of buffers in the java.nio package. Both are included in the android API so you should be good there. You may also be interested in DataInputStream which might make things easier for you if you are having trouble getting your head around how the ByteBuffer's work. Here would be one way to convert your function LoadHeader. private String id = null; private int version = -1; //default to an invalid version public boolean loadHeader(File file) throws IOException { //keep is a generic input stream, so that we can use any type of subclass of //InputStream in the future without needing to change the loading code. InputStream is = new FileInputStream(file); byte header[] = new byte[10]; is.read(header); id = new String(header); byte versionBuf[] = new byte[Integer.SIZE/8]; is.read(versionBuf); ByteBuffer bb = ByteBuffer.wrap(versionBuf); IntBuffer ib = bb.asIntBuffer(); ib.rewind(); version = ib.get(); if(!id.equals("MS3D000000")) { return false; } if(version != 3 && version != 4) { return false; } return true; //that whole thing can be shortened to, if the first is false it won't //evaluate the second and third expressions. //return !header.equals("MS3D000000") && version != 3 && version != 4; } C to Java caveat Java is a much more strongly typed language than C, so there is an abstraction between memory and your program. Unlike C where everything is just memory and you can manipulate it however you want and use neat pointer and memory address manipulations to do anything you want to it, in java there is a more strict contract between memory and the language everything essentially in java is an Object rather than memory. While java allows binary operations on primitive types an Array in java such as int[] array; is basically an object not like in C where it is just a sequence of bytes somewhere in memory. Thus you cannot guarantee the format of memory, so a by product of using java is to adhere to this strict contract. In java you must write code to specifically convert between types or properly use inheritance to solve your problems. Hope this helps, and also the reference documentation for Android is your friend, use it until you know every bit of it because it could save you a lot of time hunting down problems or writing low-level routines that have more stable and tested solutions. Just something to keep in mind as you convert your code. Skeletal Animation vs Keyframed on Android As far as Skeletal animation versus key framed. I am not sure what the programmable shader support is for the OpenGL ES specification. But if it is supported it might limit the amount of array size for matrices which would limit your Skeletal animation shader but it might still be doable. If there is no shader support then key framed is the way to go since doing skeletal animation without a shader would result in modifying the vertex buffer for an object and applying matrix transforms for the bones either every frame or just converting the skeletal animation to keyframed when loading the program, and applying the animation matrix transforms while loading.
  9. @Antheus - so I guess that makes my first bit of code there moot since the ActionListener is executed in the swing event thread. Although I have done a lot of JOptionPane.show*Dialog's in seperate threads while running concurrent code for doing certain tasks. As well as rendering things in separate threads. Usually setting JFrame.setIgnoreRepaint(true); and providing my own rendering thread, without any issues whatsoever. Since that is usually for rendering game specific things, I don't typically mix swing components into my games, thus I might see issues if I happen to use swing components in conjunction with game rendering.
  10. I have never experienced a deadlock by instantiating and running a JFrame from the main thread. And I have run hundreds of java applications. However, just to be safe you can always use the invokeLater. If you creating and displaying JFrames from within your application it is probably preferable to use invokeLater to assure there are no threading issues. But like I said I have never ever run into a situation where a deadlock occurred from creating and displaying a JFrame from any thread. Even if that thread happens to be the Event thread. For instance JButton showWindow = new JButton("Show A Window"); showWindow.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFrame newFrame = new JFrame("Test Window"); newFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); newFrame.setSize(300,200); newFrame.setLocationRelativeTo(null); //center on screen newFrame.setVisible(true); //display the window } }); this.add(showWindow); If you run into issues, it should be extremely easy to change what thread is creating and displaying your windows, if you put the display code within the super class of JFrame which is how I typically like to do things. public class MyFrame extends JFrame { public MyFrame() { super("My Frame"); setLayout(new BorderLayout()); add(new JLabel("Test Window"), BorderLayout.CENTER); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.pack(); this.setLocationRelativeTo(null); this.setVisible(true); } public static void main(String...args) { new MyFrame(); // or /* save this only if you encounter issues with the other method SwingUtilities.invokeLater(new Runnable() { public void run() { new MyFrame(); } }); */ } } As far as the proper way to create a GUI, during school we never used invokeLater. I believe that you are splitting hairs on this it really is up to you to determine which method is best if you run into issues with one of the methods and not the other then that would be your answer. But like I said I have never run into any issue.
  11. The only way I can see to stream the incoming data packets to a DataInputStream without needing to create stream objects each time is to use PipedOutputStream and PipedInputStream. I'll see if I can work up an example for you.
  12. I'm guessing it has to do with your desktop being a dual core machine. Check your CPU usage while running the program, I'm pretty sure it will only use a single core thus your speed will greatly be reduced. The graphics card on your desktop won't actually increase the rendering speed unless you turn on hardware acceleration and opengl rendering support for java. According to the link below you can do that as a command line option: -Dsun.java2d.opengl=true I found the following link in a quick google search for java hardware acceleration, I'm sure there are more in depth explanations on the particular features that might help solve your problems. http://java.sun.com/j2se/1.5.0/docs/guide/2d/new_features.html You also might want to try and put your rendering in a separate thread and do your own double buffering though I doubt this will make a difference. Just a thought though. Good luck with solving this issue. I would like to know of any progress you have with this and what method(s) you use.
  13. 5MinuteGaming

    [java] Java Team Required

    Quote:Original post by Stelimar Quote:Original post by Funblocker Unlike some (hack and Slash) mmo's written entirely in C++ the possibilities are endless when using Java as a jump off. I don't see how any of what you mentioned could be implemented in Java, but not C++... I would have to respectfully disagree with this. Java is a general purpose language, despite many unfounded assumptions that the VM is simply too slow it provides all that is necessary for such development. Quote:Original post by FunblockerThanks for the reply. I was hoping someone would point this out. What I wont mention at this stage are the extra features I have been working on for about 2 years that just wont work in any other language but Java. what I will mention though is the realism of this mmo both sight and sound will be unlike anything anyone has ever seen to date, including a well known Java based game called Wurm Online. Best regards Funblocker I would also have to question this statement since as I stated above Java is a general purpose programming language and C++ is as well. I fail to see exactly how any program can have features that would not be able to be implemented in any general purpose programming language. The only reason I can think of that you might say this is Java support for reflection and C/C++'s lack of support but it is not impossible to do reflection in C/C++. But all that aside I am interested in helping you along the way with your project. But at this time I can only devote a couple hours to help you get something up and running quickly. I believe that if you have at least something to start from then you may see more people willing to help you in your endeavor. I will PM you to discuss specifics.
  14. 5MinuteGaming

    Browser Game: Is it Entertaining Enough?

    Just a quick thought that would improve the graphics quality by a ton, turn on antialiasing, it would help if you are drawing the balloons using the drawOval function in java.awt.Graphics. Do the following to turn on antialiasing in your paint method. Graphics2D g2d = (Graphics2D)g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Then whenever you use the "g2d" object to draw primitives it performs antialiasing operations to give you smooth appearing primitives. Other than that, I'm still playing around with it but it seems like an interesting concept so far.
  15. 5MinuteGaming

    Best online game developers?

    Quote:Original post by beatniq You guys have got to be kidding me. Wow, ok... I see I've stepped into your little xenophobic world here. My apologies for not knowing secret passcode on the proper way to phrase my question. lol... blow me. ...and don't ask me for any favors when you leave your mothers' basement. Very unprofessional beatniq, all anyone who responded to this thread wanted was clarification. I would still like to know what you mean by "online" or "video game developers" at first I thought you were talking about individuals here at this site that are good developers. Then I thought browser based games. I'm afraid without clarification noone will be able to provide you with the answers you are seeking. In addition I am not familiar with the Amnesia company what do they do and do they have a website?
  • 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!