Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

367 Neutral

About deathwearer

  • Rank
  1. deathwearer


    Let's say I have three classes. 1. Player 2. GameScene 3. CameraController The GameScene create the Player and the CameraController. Both are unique_ptr in the GameScene. The CameraController needs the player to get it's position everytime its updates is called to center the camera on him. What I did was to receive a player pointer in the CameraController constructor and store it. This scenario is simple enough to say, why don't you pass the pointer to the player each time you call your update method on CameraController. But for the sake of understanding the concept and good practices of unique_prt let's pretend there are other routine methods being call internally which require the player. Should I have created a shared_ptr and pass the shared_ptr to the CameraController? So the ptr will be deleted when both the GameScene and CameraController get deleted?
  2. deathwearer


    if i pass the unique_ptr.get() they have a copy if my ptr. they could also store that pointer in a class variable. Added question 4 at the topic.
  3. deathwearer


    I get the concept (Or I think I do) but I still have couple of question on the technical side of unique_ptr. 1. When you declare a unique_ptr as a class variable, you don't have to delete it in the destructor because it is not on the heap so when the class instance is deleted, the unique_ptr is deleted which trigger the real pointer delete? 2. How do you pass unique_ptr to other functions. Do you pass a ref to the unique_ptr object? Or do you pass uniqueptr.get() (Which sends the pointer to the real object)? Do you do the same if you send it to an internal method than to another class method? I personally pass the pointer as const, leaving the unique_ptr hidden. I'm wondering here what are the best practices. 3. What is the point of a unique_ptr as a class variable? I mean since the pointer has to dies when the owning instance is kill, all you have to do is to put it in the destructor. I understand that shared_ptr are more complicated since many object can own them which make the delete call tricky, but in the case of the unique_ptr, it's pretty straightforward. 4. What are the best practices regarding unique_ptr and passing the pointer to the object is hold to another class which stores it in a class variable. Is that a good practice first? The unique_ptr could be deleted and the pointer copy it hold in the other class would be invalid. Are unique_ptr meant to be pass around like that? Should i use shared_ptr in that case we're talking? So if another class stores it in a class variable the pointer would be deleted when only all the instances of these 2 classes would be deleted. Also how can you predict such cases if the good answer is to use shared_ptr. How can I plan that other people that might use my class could store my pointer internally.
  4. deathwearer

    Java Scroller Game

    Before going into threading (Which is a very delicate process) you better see how you can reduce processing time and memory allocation. If you do the calculation of the same object more than once you might want to cache it somewhere. Review container, if you don't need random access use forward iterator What is called each loop. Do you call the only necessary stuff? Are you calling everything but should only call few things based on some conditions? There are other optimization you can apply depending on game type etc. If there are no enemies in the screen, don't even check the bullets collision, stuff like that.
  5. deathwearer

    Java Scroller Game

    // HANDLE MANY ENEMIES - FAIL ArrayList<Rectangle> enemiesBounds = new ArrayList<Rectangle>(); for (int i = 0; i < enemies.size(); ++i){ enemiesBounds.add(enemies.get(i).getBounds()); } for (int i = 0; i [color=#ff0000]> blasterShots.size(); ++i){ You wrote > when I think it should be < Not sure if this cause your problem, but that would be a good bug to fix first
  6. Hey, First are you using WinForm or WPF? Also what is the .NET version?
  7. Hey, here's how I see it. 1. Choose a language. You have a background with programming which is a good start. You can use any language you want. I personally recommand c++ since this is the language most used for games. It has many free compiler, libraries and lot's of help from people. You could also use Java, C#, Python. Which one of these is the best? (None, you could search here, we have tons of topic on these. It's a matter of preference, target, portability, etc, etc). 2. Choose a compier I personally like Visual C++ (Or Visual Studio). The Express version are free. You could also use other compiler but since I live in a very microsoft-ish world, I mainly use Visual Studio and couldn't recommand something else. Someone else could. 3. Decide the render system/Graphic engine. You can choose to develop using DirectX or OpenGL from the ground. If you choose this path you will learn a lot on how the rendering is made, but you will find yourself loosing a lot of time playing with it instead of coding a game. You could also choose to use a Graphic engine, which wraps DirectX or OpenGL (Or both) for you and expose you classes that will make your development faster and easier. Engine list . I personally like Ogre3D, which I think is not in that list, no idea why. It has many tutorial, help, manuals and a very active forum if you need help. Other people could recommend you another Engine too. I'd go for a Graphic engine too. It's fun to code the core graphics stuff but if you want to finish a game, you better use one since other people have worked years on these engine which can probably do everything you want. And replicating these engines could take you years too. 4. Write up your steps. What do you start with and focus on. It's important to stay focused and not throw yourself everywhere. Don't code a bit of input handling then do modeling and then texturing. You will find your project not going very fast and you will eventually quit. Sugestion : 1. Create an empty project. 2. Load test models with or without/texture 3. Handle input 4. Handle camera movement if needed. 5. Make a more complex scene 6. Create good looking model with texture, add light to your scene too. 7. Etc...
  8. deathwearer

    Movement problem in snake game

    Hey, I think you must only change your snake current direction only when it has at least moved one square of the new direction (If your snake game is moving square by square). Maybe have a currentDirection and lastDirection variable. You use the current direction to do your movement, and once at least one movement was made in the new direction you do lastDirection = currentDirection. Then you allow changing the currentDirection only if currentDirection = lastDirection AND is either one of them is not equal to the direction you don't allow (For exemple, going from up to down). OR if your game is somewhat "TIck based" (like the original Snake) only allow one direction change per tick. There would be one draw by tick so you couldn't go from up to down without at least going left of right for a tick.
  9. deathwearer

    how to a add collectables ti my game

    How your classes are organized. What is each class responsiblities, what objects it owns, what is its relationship with other classes. What programming language do you know/use? Is your game already started? And how far are you?
  10. deathwearer

    The requirements for making a game.

    This can be argued. "Words With Friends" is a very successful and popular casual game, however it is not creative at all. It uses rules and design that were copied from Scrabble. The board bonus spaces are shuffled around a little, but certainly not in a creative way. It also allows you to play online, which you could say is its biggest appeal; however, you could play Scrabble online before Words With Friends. So if Words With Friends has absolutely no creativity, how did it become successful? You can also argue the definitions of 'creative' and 'successful'... which I think can easily become very subjective. I think there are many factors that can cause a game to become successful, and not all are required: marketing (hyped games with ads everywhere will have more success than without), accessibility (a game EVERYONE can play will have more success than a game only certain people can play), novelty (games that are unique and intriguing can gather success), branding (Pokemon White 2 is not terribly creative if you look at Pokemon Red/Blue/Green/Yellow/Gold/Silver/Crystal/Ruby/Sapphire/Emerald/FireRed/LeafGreen/Diamond/Pearl/Platinum/HeartGold/SoulSilver/Black/White/Black2... but it still is extremely successful!), etc. [/quote] Nothing I wrote is to be taken by the book Of course some of them doesn't fit. Some games are successfull because of the franchise or the fans. Some games are also "successfull" because it fill a need that no other game fill, even if the game is not that good. Some game are even successfull and nobody could say why .
  11. deathwearer

    The requirements for making a game.

    To make a successfull game it needs to be creative. Creative can be story, models, graphic style, gameplay, texture or any combination of these (plus all the other stuff I forgot). Look at Limbo, it didn't had much of a story and the gameplay wasn't complicated but it had a creative graphic style.
  12. deathwearer

    Irrlicht any good?

    I can't comment on Irrlicht, but I'v been using Ogre since quit some time already and I like it. It's cross platform and will also support Windows Phone 8/WinRT. Ogre's been around since long enought (I was still at school when I first saw it, I'm 27 years old). I don't know what you need but I'm positive it has everything you might need. Their tutorial are helpfull but not perfect however. I don't like multi-inheritance and one of their tutorial serie use it a lot. You can use the information provided and do your own architecture quite easily with it so it's not big deal. The documentation looks complete but it's hard to tell. Their forum are very active so if you never need help they could probably help you. If you have a good c++ background and programming in general it shouldn't be a problem to learn to program using Ogre.
  13. deathwearer

    how to a add collectables ti my game

    Hi turkeyremis, Your question is too general that it's impossible for us to give you a proper answer. We first need to know what is the language you use, if you need help on the technical implementation. Also what is your classes layout. If you need help on where and how to store the information. Your question is very general. Storing/gathering/displaying information in a game can be more than 50% of the code of your game Maybe if you could just tell us if you want a general idea, or a specific implementation advice etc.
  14. deathwearer

    breakout objects

    The object order doesn't matter. It's personal, put them in the order you find the most logical/important. I tend to put the most important ones at the top. The most used one or the most critical one.
  15. deathwearer

    Question regarding Shaders.

    No I haven't yet! But I'm still at work and don't really have time for that but I promise I will read about it the whole evening. This has to be the most clear explanation I'v read on the subject ever. Thank for that. I'v been reading on Shaders for a while already (Many, many article) but these are always demo project and never real world integration (Obviously). I know how a Specular light is calculated and could (barely) redo it in a Shader but never understood how it would plug in a real game with more than just a mesh in an empty scene...
  • 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!