• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Daivuk

GDNet+ Basic
  • Content count

    759
  • Joined

  • Last visited

Community Reputation

413 Neutral

About Daivuk

  • Rank
    GDNet+
  1. For inputs you have 2 options: Listen for WM_KEYDOWN and WM_KEYUP events. Use Direct Input. (my recommendation). it is keyboard agnostic so WASD will be mapped to the same keys even on AZERTY keyboards. Google around for Direct Input tutorials.   If you need text input, don't use neither of those. use the WM_CHAR event.
  2. Loading resources or map data asynchronously in games is not an easy task. C++11 makes all of this a lot easier. I am going to demonstrate how to create a thread using async. And then how to sync back to the main loop using lambda functions. Consider the following code, that is blocking: void onNewGame(){ // Load the map loadMap("level1-1.map"); // Start the game startGame();}void loadMap(const std::string& in_filename){ // ... Do extensive work, freezes the screen for couple seconds.}Lets start by adding the loading code into a thread. Using std::async. #include // This is the include for asyncvoid onNewGame(){ // Load the map, asynchronously std::async(loadMap, "level1-1.map"); // return and continue normal execution... render your animated loading screen on your mainloop}void loadMap(const std::string& in_filename){ // ... Do extensive work}That was easy? Now we need to notify the game when the loading is complete. By calling "startGame()" in our example above. This is not as easy as it sound, because the loadMap() function is now running on a different thread. You could set an atomic boolean, and check it every frame. But then we will end up with specific cases all over the place. What we want is to synchronize with our main loop. Consider the following typical mainloop: void mainLoop(){ while (true) { game.update(); game.draw(); }}If we were to set a global atomic bool, we would probably put it like this: void mainLoop(){ while (true) { if (mapLoadingDone) { startGame(); mapLoadingDone = false; } game.update(); game.draw(); }}And mapLoadingDone is a boolean that would be set to true at the end of loadMap(). Lets do this a bit more generic. Let's modify our loadMap() first: void loadMap(const std::string& in_filename){ // ... Do extensive work // Notify that loading is done syncToMainLoop([]() { startGame(); });}Simple function call, with inline code block. This is called a lambda. In previous C++ or C, you would have to define a function and pass it as pointer. Now lets see the implementation of syncToMainLoop. #include #include #include std::queue syncQueue;std::mutex syncMutex;void syncToMainLoop(std::function in_callback){ syncMutex.lock(); syncQueue.push(in_callback); syncMutex.unlock();}The std::function is the new way of doing function pointers in C++. The queue is used to pile up multiple sync request in case multiple happen during a single frame. The mutex is there to prevent the queue from being accessed in multiple places at the same time. Now we just need to add this to the main loop: void mainLoop(){ while (true) { // Do the sync requests syncMutex.lock(); while (!syncQueue.empty()) { auto callback = syncQueue.front(); // Get the next in line callback(); // Call it syncQueue.pop(); // Remove it } syncMutex.unlock(); game.update(); game.draw(); }}Now you can sync back to the main thread during any async loading. Here is the full code of the example: #include #include #include #include std::queue syncQueue;std::mutex syncMutex;void mainLoop(){ while (true) { // Do the sync requests syncMutex.lock(); while (!syncQueue.empty()) { auto callback = syncQueue.front(); // Get the next in line callback(); // Call it syncQueue.pop(); // Remove it } syncMutex.unlock(); game.update(); game.draw(); }}void syncToMainLoop(std::function in_callback){ syncMutex.lock(); ?syncQueue.push(in_callback); syncMutex.unlock();}void onNewGame(){ // Load the map, asynchronously std::async(loadMap, "level1-1.map"); // return and continue normal execution... render your animated loading screen on your mainloop}void loadMap(const std::string& in_filename){ // ... Do extensive work // Notify that loading is done syncToMainLoop([]() { startGame(); });}
  3. We call this a "Weak Reference". I don't have examples at hand, but that's the term you want to search for   Edit: What BitMaster said. std::weak_ptr
  4. Exactly, this is the purpose for the original question. It seems that this GL Hint does 'magically' fix it.   I highly doubt OpenGL can fix this also.   The hint is called "PERSPECTIVE". Which means it doesn't work for 2D. It needs the z (depth) value to calculate this correctly. In 2D no such things. The GPU can not know the context of that triangle in a 2d environement. And doesn't understand it is a quad at low level.   If all 4 points have the same z value in your 2D render (let say, 0), and GL gives you the right picture, then the driver or opengl is wrong. What about I want to skew a rectangle on the side?
  5. If you don't want to do a lot of coding, like you say. And you already know C#. Then Unity3D is your choice.   XNA is certainly enough to make interesting games. Tons of games on Steam use it. And I did pretty amazing stuff with it.   I'm personally not a big fan of "Engines" per say. I prefer having a set of libraries that do certain jobs for you: Load images, draw fonts, do inputs, etc. Like SDL or SFML. Then you build the "game engine" around it.
  6. 1) What was the first programming language you studied? QBasic in DOS   2) Did you have any Computer Science background before your first language (ie: boolean algebra, memory organisation, algorithms)? No   3) The first language you studied was it self-taught, formal instruction, or both? Self-taught   4) Was the Computer-Science background self-taught, formal instruction, or both? Self-taught   5) When you started to study Computer Science did it help your understanding of the language you first learned? I never studied Computer Science. But my game programming courses didn't help much as I had already learned everything by myself. But my background helped me get good grades.   6) What kind of environment did you first program in (ie: the IDE or text editor, and the OS)? QBasic had it's own text editor in DOS
  7. As a concrete example of why they are bad:   I am using Cocos2dX for a project. And we had to send network call. Great, cocosx provides a client HTTP built on top of Curl. It's a singleton class (Which means a global var basically) with most of its variable static or globally declared in the CPP. It didn't cause problem at first. Everything is queued when I make multiple call. Ok, perfect.   But then, we started to want to send some calls simultaneously. LIke uploading a file in the background, but continuing navigating in the app.   But we can't, because there is only 1 instance of the HTTP client! And we can't instantiate another one, because everything is static in it. And they even had global vars in the CPP!! A design that sounded good at first ended up a nightmare. I was able to remove the static vars and globals. I can now create multiple instance of the class.   It's a good example I believe. Also if your game end up supporting multiplayer or split-screen. If all you have are static, you will be in hell. (Been there also)
  8. Singleton pattern is the most commonly used for managers. Just careful to not put managers as singleton that don't need to be.   One day you will want to add multiplayer, or split screen, to your game. And all those singleton will haunt you. Some things, like Texture manager, should definitely be in a singleton. It's sharing textures across all part of the engine.   But input manager, maybe not. If you add a second controller for player 2, you might want him to handle his own input separately, and you will want a second instance of input manager.   What I do in my games generally, is create a global singleton, where I put all those managers in. Globals::getInstance()->textureManager()->getTexture("baby.png"); Globals::getInstance()->inputManagers[PlayerId]->isButtonDown('A');   Not the best practice, but accessing things easily from everywhere is nice too. Also I cant keep all my other managers singleton-free.
  9. You are going to have to create a font, load it, display it.   Take a look at bmfont: http://www.angelcode.com/products/bmfont/ Some tutorials are included on the site.
  10. The way to do it is not to thread rendering and updating simultaneously, but instead threading operations that cost a lot before proceeding to next operation. Instead of threading big modules against each others (update, rendering), thread the tasks into those modules. Update() Thread all entities' physic. wait that they are all complete Thread path finding. Like calculating path for 4 units at the same time, in 4 different threads? (i.e.: if 20 paths to calculate, split evenly 5 in each threads) wait that they are all complete Thread the next big job wait the threads for that job are complete. Render() Thread the culling of all entities Wait that culling is done computing. Maybe thread the swap buffer to start updating the next frame? (It might stall there to wait for vsync, you could update next frame during that time!) I did that in a game we did and it worked greats, we gained speed on lower spec PCs. It's a more intelligent way of using threading in games. And also what I like to do, is count the number of cores/processors available and use that as the number of threads to start for each big jobs.
  11. Having developed on every platforms and most of the consoles/devices out there. I find Visual Studio the best IDE that exists. It has its problems, but its still the best in my opinion. Only bad thing about it personally is the intellisens. And if your employer is too cheap to buy you a licence of VisualAssist (My case) then it's a bit troublesome. But I never had problems with libraries dependencies and I've used them a lot. Not sure what you are talking about? XCode was a nightmare to work with in my case. I guess it's a matter of taste/experience with one more than the other. Very bad post tho. I believe Microsoft cares more about its developers than its concurrents. Giving Android as an example is a very bad example. Just try to code a C++ app on android. That was a hell of a nightmare with not even a STL implementation. Same things goes as Xbox dev vs PS3 dev, etc. Microsoft always win as developer support and softwares.
  12. We did pretty well with BaboViolent2. It is multiplayer only, we don't even support bots. And we still have a pretty big player base at the moment, 4 years later. I think if you do it right, and have a place where the community can grow (Forums, etc) and a good way of listing / joining games. You will get your player base pretty quickly. Now the problem is, to keep it! [quote][color=#1C2837][size=2] players you have will quickly abandon ship[/quote][/size][/color] [color=#1C2837][size=2]This was exactly what happened with our "Madballs in... Babo: Invasion" game. The player base was high for some weekends after a sale, but then went go down and then people will say: Game is good, but the multiplayer is empty! Luckily we added a single player campaign to it.[/size][/color] [color=#1C2837][size=2] [/size][/color] [size="2"][color="#1c2837"]I think you just need to make a game that feels right and people don't get bored too fast. And mostly: Competitive. That is the key, otherwise player base will disappear quickly.[/color][/size]
  13. [color="#1C2837"][font="CourierNew, monospace"][size="2"][color="#666600"][color="#666600"]**** GAMEDEV PLZ FIX THE COPY PASTE THAT CREATES JUNK KTHXBAI ****[/color][/color][/size][/font][/color] [font="CourierNew, monospace"] [/font][font="CourierNew, monospace"][size="2"][color="#666600"]I had to edit that post 4 times... [/color][/size][/font] [color="#1C2837"][font="CourierNew, monospace"] [/font][/color] [color="#1C2837"][font="CourierNew, monospace"][size="2"][color="#666600"][color="#666600"]I would do that:[/color][/color][/size][/font][/color] [color="#1C2837"][font="CourierNew, monospace"][size="2"][code] float moveSpeed = 1; if (mKeyboard->isKeyDown(OIS::KC_RSHIFT)) {[/size][/font][/color] [color="#1C2837"][font="CourierNew, monospace"][size="2"] moveSpeed = 2;[/size][/font][/color] [color="#1C2837"][font="CourierNew, monospace"][size="2"]}[/size][/font][/color] [color="#1C2837"][font="CourierNew, monospace"][size="2"]if (mKeyboard->isKeyDown(OIS::KC_A))[/size][/font][/color] [color="#1C2837"][font="CourierNew, monospace"][size="2"]{[/size][/font][/color] [color="#1C2837"][font="CourierNew, monospace"][size="2"] strafe = -moveSpeed;[/color][/size][/font][/size][/font][/color] [color="#1C2837"][font="CourierNew, monospace"][size="2"]}[/code][/size][/font][/color] [color="#1C2837"][font="CourierNew, monospace"] [/font][/color] [color="#1C2837"][font="CourierNew, monospace"][size="2"]Ok, I just can't get the code snippet to show up correctly :@[/size][/font][/color] [font="CourierNew, monospace"][size="2"][color="#1C2837"]Here is the non formated version:[/color][/size][/font] [font="CourierNew, monospace"][size="2"][color="#1C2837"]float moveSpeed = 1;[/color][/size][/font] [font="CourierNew, monospace"][size="2"][color="#1C2837"]if (Right shift down)[/color][/size][/font] [font="CourierNew, monospace"][size="2"][color="#1C2837"]{[/color][/size][/font] [font="CourierNew, monospace"][size="2"][color="#1C2837"] moveSpeed = 2; // What ever speed you want[/color][/size][/font] [font="CourierNew, monospace"][size="2"][color="#1C2837"]}[/color][/size][/font] [font="CourierNew, monospace"][size="2"][color="#1C2837"]if ('A' is down)[/color][/size][/font] [font="CourierNew, monospace"][size="2"][color="#1C2837"]{[/color][/size][/font] [font="CourierNew, monospace"][size="2"][color="#1C2837"] strafe = -moveSpeed;[/color][/size][/font] [font="CourierNew, monospace"][size="2"][color="#1C2837"]}[/color][/size][/font] [font="CourierNew, monospace"][size="2"][color="#1C2837"]...[/color][/size][/font]
  14. [font="Arial"][size="2"]Is an MS in Mathematics enough to break into graphics? Yes[/size][/font] [font="Arial"][size="2"]Do you need a MS to break into graphics? No[/size][/font] I have only a college degree in game programming, and I am Lead Graphics Programmer today. Only what I needed was linear maths, and LOT of experience in Rendering. I did some integrals and such in college, but doesn't remember much about it. I find myself limited sometimes in the understanding of certain papers. So it would surely help to have a MS. Depending what branch of graphics you are going: Medical, research, gaming. For gaming you just need the basics, clear understanding of matrices and shaders. Because the most complex things you might have to achieve are SSAO and deferred rendering. The other complex rendering techniques are mostly for research and show off demo. Not for actual games. Unless you are aiming the top (EPIC Games, Crytek...)
  15. I tend to agree with @[color=#2B3730]nfries88. When a project gets very big, compile time becomes a big issue. By using pointers, you can use forward declaration. We should do that as much as possible, unless you do not have other choices to not use pointers.[/color]