• 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.

ViperG

Members
  • Content count

    618
  • Joined

  • Last visited

Community Reputation

206 Neutral

About ViperG

  • Rank
    Advanced Member
  1. You can do something like this: #define Global 5; float g[Global]; int t = Global; int z = Global;
  2. Generally speaking, it's ill-advised to do any searches or in [u]some cases[/u] sorts in a realtime application (such as a opengl application where you have a desired framerate) When you hit an array or vector of that size, it will simply take to long to iterate through it every loop to do a search. So i would suspect you have a design issue rather than looking for a programming solution via alternative method. Some of the things you need to look at when iterating through alot of elements: 1) how often does this vector change size or sorted (gets re-indexed)? 2) Can you find what you are looking for once, then keep track of that element's index (inserts or deletes after the index are irrelevant, it's only changes < the index)? aka caching the results... 3) do you have to search and iterate every single loop? would every other loop suffice? 4) since your vector is sorted a binary search will be as fast as a map. I like to deal with vectors almost exclusively and I do everything in my power to reduce the amount of searches and sorts that I possibly can. Here is a small sample code that might assist you (this is not my code): [CODE] int value_to_find; vector<int> cont; // main container map<int, size_t> contPos; // position cache // first see if the value is in cache map<int, size_t>::const_iterator foundCache = contPos.find(value_to_find); if (foundCache != contPos.end()) { do_this(); } // not in cache, now do brute force search vector<int>::const_iterator found = cont.find(value_to_find); if (found != cont.end()) { // cache the value with its position contPos[value_to_find] = found - cont.begin(); do_this(); } else { // in neither do_that(); } [/CODE]
  3. Basically the menu system is looking for the menuclick event, however the menu system just looks to see if this state is true. If it's not true then your clicking wont do anything. The input system makes menuclick true only if you are not holding down the mouse. And my event system is kinda a per loop kinda thing. So [code] Game loop 1 detect mouse down, menuclick is true Game loop 2 detect mouse down, it already was, menuclick is now false, mousehold is now true. Menus check menuclick, well it's false, no good.[/code] Of course I could check if mousehold is true, but the problem with this is I have toggle options in the menu, I toggle the option when menuclick is true (menuclick can only be true one time as how the system is built, so if I click on a menu item, it doesn't click it 1000x times) If I am 1:1 on the game loop and render (50 fps) I am fine, system works as it's supposed to. But if the Game Logic runs 2x before the menu/renderer (i go below 50fps), well it sets mousehold to true because I processed my input code 2 times before I hit the menu system/renderer simple solution is to move my input code out of the fixed delta time stamp so it does input every frame, but I feel like thats a crappy solution as some computers can get 500fps etc. (checking input 500 times a second... ugly) Other option is to do a guiclick event that triggers for this situation, but then I have 2 mouse click events, one that works per game cycle, and one that works when input gets called 2x or 3x times before the menu/renderer gets called. Guess im looking for feedback on different input systems and/or an elegant solution to my problem. Or I could do a mouse up event instead... would probably fix the entire problem, but even with this it still seems like I need two events, for the the game logic and one of the menus since they can possibly run at different cycles, aka game input could be read 3x before the renderer gets hit due to bad fps.
  4. So I was curious what other people do about this. I currently have my game loop fixed at 50 cycles a second, and fps runs at max. The problem I just ran into is when I am detecting mouse1 and mouse2 to detect a mouse click vs being held down is that if the game logic runs 2x before it hits my menu code (part of the draw code) It detects that im holding the mouse down, and once it gets to the game menus I doesn;t recieve the click even because it's considered a mouse holding event instead. This only happens when my FPS drops below 50, then the game logic can possibly run 2x times before it renders/menu draw code. I use a state machine to determine what menus are visable and what not, and the menus handle their own close buttons. But I can't click on the button because it thinks im already clicked it since it thinks im holding the mouse down. (game logic ran 2x, detects im holding the mouse still on 2nd loop = mouse is held down). hope that make sense. I have a few ways to fix the problem but was just curious on what other designs/input/menu methods people have used.
  5. I'm actually doing it right now, I went the whole 2D from scratch. It definitely is way more work and takes way more time than I thought. 2nd go round I really would like to just use an already existing engine. But I am learning... ALOT.... very time consuming. Anyways, If you are totally new to this, I would start with http://nehe.gamedev.net if you want to go the opengl route. Some people might reply his code is old and outdated, but you can still learn from it. Unfortunately, I don't know of any other active sites that has tutorials as in depth as nehe. [url="http://www.gametutorials.com/"]http://www.gametutorials.com[/url] used to be free, now you have to pay for it.
  6. FMOD! it's free for small projects and has the most support and biggest userbase
  7. I hate serialization. I'm gonna get boost working.
  8. [quote name='johnstanp' timestamp='1295531586' post='4761840'] An easier way to do things, would be: [code] template< class T > void write( std::ofstream & output, T const & instance ) { output.write ( reinterpret_cast<const char*>( &instance ), sizeof( T ) ); } template< class T > void read( std::ifstream & input, T & instance ) { input.read ( reinterpret_cast<char*>( &instance ), sizeof( T ) ); } [/code] The input and output files are binary (you can't just open them and read them like you would for a text file). There are many advantages in using binary files: the book "How to Program in C++" by Deitel & Deitel has a very enlightening chapter on this topic. [/quote] Thanks. I plan on making my game cross platform so it will run on linux and on mac, so i don't think this method will work for me. I want players to be able to share custom ship designs and or save games, so I decided to save everything in a text format. Originally I was going to use XML, but i decided for the sake of learning experience I would just write a simple text parser and do it my self, XML seemed a little overkill for my needs.
  9. [font="arial, verdana, tahoma, sans-serif"][size="2"]So my game has lots of structures, all of which i will need to save at one point for save games and user created content with the in game ship builder. After doing some thinking on how to do this in the easiest possible way with the least amount of maintenance and code, i came up with this method, please give me your opinions, this is a prototype wip and it's rather simple and currently isn't finished but i wanted feedback on it. [code] template<typename t3> void ioprocess(t3& data, string iotext) { if (method==SAVE) { if (iotext.size() > 0) FOI << iotext << data << endl; else FOI << data << endl; } else { string itext=""; FIO >> itext; if (itext==iotext) FIO >> data; else ; //throw a error message... } } [/code] and a sample game struct: [code] struct shipdata { bool bumpmap; string descrip; int tid, schid, lid, shid, mass, armor, hull, vents, ventcolor, dtid, dsmall, dbig, bumptid, collision, explosion, ai, price; float xsize, ysize, armortype, thrust, shscale, shieldangle, trscale, txsize, tysize, scale; string owner, sclass, sid, name; vector<datacomp> Components; void shipdata::processio() { ioprocess(sid, "$sid= "); ioprocess(name, "name= "); ioprocess(descrip, "description= ") ... ... ... } } [/code] Right now FIO and FOI are going to be global input/output ifstream/ofstream. or i can pass it as a referenced parameter but in this situation 2 globals are easier. so for example if I have 100 instances of ship data, i can just call shipdata.processio(); for each instance, and it will save the entire structure into whatever file I have specified, and the same command can be used to read just by toggling which method i want to use, save or load. and if I add members or remove members of the struct, I simply add a ioprocess call for that variable and saving and loading are done for me. and this method can be put on all my structures or classes if I want to save any of their members or load them.[/size][/font] [font="arial, verdana, tahoma, sans-serif"] [/font] [font="arial, verdana, tahoma, sans-serif"][size="2"]so my question is this a good way to serialize a structure? good? bad?[/size][/font]
  10. 75 views no comments ... bump. Ok let me ask the question a different way. If you were going to serialize a class or structure someone like the one i showed, would you do it in a way like i did or would you do it completely different (aka a BETTER way?) Is there a more efficient or robust method of doing what I am trying to do...? Does my method have an apparent flaw?
  11. So my game has lots of structures, all of which i will need to save at one point for save games and user created content with the in game ship builder. After doing some thinking on how to do this in the easiest possible way with the least amount of maintenance and code, i came up with this method, please give me your opinions, this is a prototype wip and it's rather simple and currently isn't finished but i wanted feedback on it. [code] template<typename t3> void ioprocess(t3& data, string iotext) { if (method==SAVE) { if (iotext.size() > 0) FOI << iotext << data << endl; else FOI << data << endl; } else { string itext=""; FIO >> itext; if (itext==iotext) FIO >> data; else ; //throw a error message... } } [/code] and a sample game struct: [code] struct shipdata { bool bumpmap; string descrip; int tid, schid, lid, shid, mass, armor, hull, vents, ventcolor, dtid, dsmall, dbig, bumptid, collision, explosion, ai, price; float xsize, ysize, armortype, thrust, shscale, shieldangle, trscale, txsize, tysize, scale; string owner, sclass, sid, name; vector<datacomp> Components; void shipdata::processio() { ioprocess(sid, "$sid= "); ioprocess(name, "name= "); ioprocess(descrip, "description= ") ... ... ... } } [/code] Right now FIO and FOI are going to be global input/output ifstream/ofstream. or i can pass it as a referenced parameter but in this situation 2 globals are easier. so for example if I have 100 instances of ship data, i can just call shipdata.processio(); for each instance, and it will save the entire structure into whatever file I have specified, and the same command can be used to read just by toggling which method i want to use, save or load. and if I add members or remove members of the struct, I simply add a ioprocess call for that variable and saving and loading are done for me. and this method can be put on all my structures or classes if I want to save any of their members or load them.
  12. if your movement is correct but your body is not rotating you have to apply a rotate command before you draw your body. depends on what api you are using and if it takes in radians or degrees etc. quick example: Angle=(atan2(x1-x2,y1-y2) * 57.29578049f); lets say you are doing vector x=1,y=1 test run: atan2(1-0, 1-0) = atan2(1,1) = 0.788395 (radians) then 0.788395 * 57.29578049 = ~ 45 degrees. atan2(1,0) would be 90 degrees. atan2 returns radians so to convert to degrees you multiply pi over 180 which is 57.2957.....
  13. try shrinking your grid and see if this helps. say max # of buckets in a grid can be around 10 or then try a max setting of 5.
  14. So it looks like any of the Intel 945 chipsets (945G/945GM/... maybe 955 also) do not support NPOT textures and don't support ext_texture_rectangle. My game can definitely run on this chipset and even get 60+ fps but I have to run my game in POT textures to make it fast. I want to be able to support NPOT to make it easier for the modding community to be able to mod my game. I could just make it a rule where they have to use POT textures. Or I can do a texture atlas. So my question is should i switch to texture atlas or switch to ext_text_rect or just keep to power of 2 textures. And on these chipsets 2048x2048 is max texture size, so I would probably have to make 5-10 atlases...? possibly more.
  15. Alright thanks, I'll try boost again and see if I can get it working. Would boost::serialization be able to serialize a vector of my own data type, like a struct? My other question is what's the industry standard for this? Maybe this question is better suited in the game programing forum. Just curious because writing out all this data to multiple data files seems daunting and time consuming.