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

ChaosCommand

Members
  • Content count

    75
  • Joined

  • Last visited

Community Reputation

122 Neutral

About ChaosCommand

  • Rank
    Member
  1. Quote:Original post by MaulingMonkey using (StreamReader reader = File.OpenRead("MyFile.txt")) { /* Not knowing C#, I don't know exactly what "using" does (I'm guessing * something to do with scope), but this is similar to, in C++: * std::ifstream reader("MyFile.txt"); * Should be pretty obvious. You're creating a Input/Reader Stream which you'll * use to read from the file "MyFile.txt" */ string line; /* Again, self evident. In C++ this would be: * std::string line; * Or in fact the exact same thing if you were using the standard namespace. */ char[] delimiter = new char[] { ' ' }; /* Again, pretty obvious. Creates an array of characters called delimiter. * If we wanted to parse a file shaped like this: * Full Name (Can Include Spaces),Age,Weight,Etc * We'd put a comma rather than a space as the delimiter(s). */ while ((line = reader.ReadLine()) != null) { /* Yet once more, pretty obvious. Basically, read one line at a time from our * stream, until we run out of lines. In C++ we'd write: * while( std::getline( reader , line ) ) { */ string[] tokens = line.Split(delimiter); /* This uses a C# string function, split, to seperate our line into multiple * strings. If our line was "I like pie", and we used a space for our delimiter, * tokens[] would contain: { "I" , "like" , "pie" }. * This can be done similarly in C++ with a few extra lines like so: * std::string token; * std::vector< std::string > tokens; * std::stringstream ss( line ); * while ( std::getline( ss , token , ' ' ) ) { //gets up to the next space * tokens.push_back( token ); * } */ firstName = tokens[0]; lastName = tokens[1]; /* This one's pretty obvious again. Would work directly as is in C++ too. */ Awesome, thanks for the help, I understand it perfectly now. I wish I could learn both C# and C++, I just can't decide, that is why I'm learning both at the same time... then in the future, I can hopefully be prepared if I have to focus on one specific one.
  2. Quote:Original post by TangentZ You can use the Split() method of the String class. *** Source Snippet Removed *** That works perfectly... I modified it to work with my game, but I just don't understand HOW it works, I'd probably not be able to do it again unless I asked for help again. MSDN doesn't really offer an explination in english terms *at least that is how I look at it* Any additional insight into how it works, or maybe a step by step of what it does, it would be awesome.
  3. I'm currently making a game, Total Tennis Sim. I am programming it in C++, but I was getting a little stressed and wanted to take a break from it and I decided to get back into C#, I only learned the bare basics. Anyways, I want to read in a file, and then store information in variables. For example: I have a file that has the following: John Smith 20 English 19 15 4 16 29 Basically in my tennis game, it would be something like First Name, Last Name, Age, Nationality, Power, Strenth, Agility, Blah, Blah, blah. Anyways, I have all of this on the same line. Now is there a way that I can read in all of those into variables. In c++ it is simple as database >> fName >> lName >> age >> nationality >> blah; But how would I do this in C#. I know how to do File.ReadLine(VARIABLE); to get the whole line as a string, but what about getting numbers and names and stuff on the same line.
  4. Here is probably a long read for some of you, it is for my new game Total Tennis Sim. I'm still working on less important things on my game (like files, finishing up interface, still working on the database) but I'm thinking ahead about the AI in my game. Here is what I got planned out (some taken from the design document): The court is divided up into 8 sections (Could be divided into more later for much more accuracy, but 8 is good for now), pretty much like a chessboard. Each side of the tennis court, has 4 zones. Example from google: [image]http://wings.avkids.com/Curriculums/Tennis/Images/crt_01a.jpg[/image] (still got no clue on how to post images on these forums) In these 4 zones is where the tennis player can be, and will do the following:Match Engine Flow: Player -> Player Location -> Player Action -> Location of/to Action -> After Action (if needed) -> Player Location First the player will be identified, then the player location will be identified, next the action from the player will be executed, then the action will go to where it needs to go *like the ball being hit across the net to the other player*, then any player after action *like standing up after a dive and charging the net*, and then once again the player location will be evaluated, and it will be the other players turn. It sounds simple, it is meant to be, right now I'm just trying to get the absolute basics. Now, tennis is kinda like pong, I stupidly, only realized that awhile ago. The only twist is, there is the addition of knocking the ball over a net, keepting it in bounds, and you can move up closer to the center. Now, first thing I want to get out of the way is player movement. I want to simulate real life, and in real life, tennis is all about anticipation *which is an attribute in the database, for each player*. So I have to mix in the player location, and then anticipate where the ball will go, and then act accordingly. In real life, most players are either running insanely to chase down a ball going the opposite direction, or they are either setting up to try to be near the middle so they can quickly move either direction. So in the game engine I will have to account for this somehow. Then, I will have to take in a player's personality, if he likes to charge the net, and if he does, he is either going to do it right after he serves, he gets the other player in a bad position and he is chasing down a ball, or the other player hits a shot that is meant to be close to the net. I am guessing Positioning, Decisions, Creativity, and Attitude will be evaluated to figure this one out. BTW, stats are based on a 1-20 rating system. So, I believe that pretty much takes care for the bare basics for player movement, any one else have any ideas, or anyting I missed, please let me know. Now, the other half of this, is the ball itself, in comparing it to pong, the ball is absolutely controlled by gravity, the force that it is hit by, and somewhat of a luck and experience. Also I have to account for the ball being hit out of bounds. On first serve in tennis, again depending on the player (which I will need to look up some real life serving statistics), they either cream the ball on their first serve, get an ace, fault, let, or the player returns it normally, doesn't return it well, and it hits the net or misshits. For now, I'm not sure if I should implement ball height, because, even though later on, the ball will have to be tracked heavily, right now i'm only in the beginning. I guess it just depends on if i'm evaluating the action, then displaying it, or if I'm doing it *on the fly* evaulating and displaying at the same time. So, I'm thinking for ball height, there will be 3, high, low, and middle. High being a lob, low being hit the net, or barely getting it over, and middle being somewhere in between, I guess it is a fuzzy subject at the moment. Where the ball goes, is dependent on the players actions, and his personality, and the current situation basically, my job is to check if the ball goes over the net, if it stays in bounds, what kind of shot it came from, and if the other player will have anything to do with it. Court type will also playa big deal with the ball, so I'll have to look up some statistics on differences between court types. So for now, I think that pretty much wraps it up for the basics. Anyone have any questions, or hopefully any suggestions for what I'm doing. If even just telling me this idea doesn't suck completely could also help as well ;) j/k After this, I hope to move on to Soccer (Football for anyone else who gets offended) Simulation. Which, if I think this is hard, managing 22 players... yikes, I can just imagine the horrors of the database for that game, maybe I'll have some help when I get that far. Anyways, thanks in advance for any help, suggestions, criticisms, all that good stuff.
  5. And I'm sorry this thread turned from a question about a database, to me explaining how the game is going to work out. It's almost 5 am, I can't think anymore :P
  6. Here is a section of the design document for the game 6. Match Engine The court will be divided up into 8 sections, like a chessboard. Each section will be a zone of play for each player. In each section actions and reactions will take place and will be evaluated by the AI system and come up with the solution of what will happen and the players will act accordingly. ========= | A1 | A2 | |---------| | B1 | B2 | |=======| | C1 | C2 | |---------| | D1 | D2 | ========= Match Engine Flow: Player > Update Player Location > Player Action > Location of/to Action > After Action (if needed) > Update Player Location Match Engine Example: --------------------------------------------------------------------- Score 0 - 0 P1 Morale = Excited P1 Condition = 100% *Equivalent to stamina, lower condition = higher chance of injury or being tired, not working as hard* P2 Morale = Calm P2 Condition = 100% Crowd Favoring = P2 Player 1 at A1 serves (normal serve) a powerful ball to C2 | P1 Stays Player 2 at D2 hits (normal shot) the ball back over the net to A2 | P2 Stays Player 1 at A1 moves (slowly) to A2 and hits (powerful shot) to D1| P1 Moves Forward to B1 Player 2 at D2 moves (quickly) to D1 and dives (Evaluate Chance) but Misses the ball Update Score 15 - 0 P1 Morale = Very Excited P1 Condition = 99% P2 Morale = Determined P2 Condition = 97% RESET --------------------------------------------------------------------- Yeah, so that is basically how it is going to work (as planned). It's my first time attempting a sports simulation, or a big project for any matter. A lot of work is required, but, I am finally interested in a project and I'm sure I'll finish this one, even if it won't be everything i'd expect, I'm still aiming to finish it.
  7. Quote:Original post by fuchiefck hmmm.... sounds like a fun game... maybe you could incorporate equipment? like racket make/model? and each racket have can influence those technical/ability points? clothing? type of balls? kinda like a weapon/armor/items thing in RPGs... hehe.. and also, money of course, so u can buy equipment for your player... also, I think strings are easier to use than char arrays, esp when you wanna read/write files, I gather you'd be using a lot of string tokenising....? I guess strings are better. The ideas you had were nice, but, definately for a different game, one you actually play. Right now i'm searching for the match engine itself, running the match, calculating as real to life as possible. But you did give me an idea, Court type is very important, I didn't account for this at all. Racket type could also be implemented later on, maybe give a bonus to power, and have negative affects as well. Good stuff. I made a class for the player in the database, and am working on that. Here is the match engine itself, in it's extreme infancy Match Engine.cpp #include "match engine.h" void matchEngine() { CPlayer player1; CPlayer player2; // Get the stats of the player // Obviously I need to figure out a way // to pick the player, and then search in the // database to get that players info player1.getStats(); // player 2 as well // Get conditions (weather, court type *thanks for that*) // Compute data and match // Display Commentary // Update score // Check if game is over, if not, keep playing } Match Engine.h #include "main.h" void matchEngine(); class CPlayer { public: void getStats(); private: string playerName; int playerAge; string playerNationality; int playerHeight; string playerDescription; string playerAttitude; int playerAttributeServe; int playerAttributeVolley; int playerAttributeReturn; int playerAttributeCurve; int playerAttributeSpeed; int playerAttributeStrength; int playerAttributePower; int playerAttributeJump; int playerAttributeReflexes; int playerAttributePositioning; int playerAttributeDecisions; int playerAttributeCreativity; int playerAttributeShotNormal; int playerAttributeShotTopspin; int playerAttributeShotLob; int playerAttributeShotPower; }; getStats Function *Basically opens the database, and grabs the attributes, stores them in there respected variable void CPlayer::getStats() { fstream database; //Open the file as input-only database.open(fnameComplete.c_str(), ios::in); // GET ATTRIBUTES AND STORE IN VARIABLES // A WHOLE bunch of crap you don't want to see // Finished with file, close it database.close(); } There is a lot of other stuff and files, but that is the basics to what i'm working on right now. On the TODO List: 1.Figure out how to pick the tennis player out of the database, and read that players info and stats. 2.Finish up the database editor (basically have to make it to write out a new database entry) 3.Finish up the interface (It's the console, but, it is still work to do) 4.Match Text Commentary (... This will cause headaches) 5.AI for the match engine 6.Score system (.. tennis isn't perfect, especially with the numbers for score) 7.... to actually make it this far
  8. I'm working on Total Tennis Sim (name subject to change) I'm planning out the database. Well, here is what I got so far: ------------------------------------------------------------- Player Details (read as strings... or as char arrays?) Personal: Name Age Nationality Height Description Attitude Player Attributes (Rated from 1 – 20) (read as integers) Technical: Serve Volley Return Curve Physical: Speed Strength Power Jump Mental: Reflexes Positioning Decisions Creativity Shot Ability: Normal Topspin Lob Power ------------------------------------------------------------- Now, I am working on a database editor, the game is going to be run from the command line, and so will the database editor. I will worry about writing to the database from the editor later. But my question is, how would I set up to read in the data and store it to be used in calculations in my tennis sim engine. Here is what I was thinking: 1.Create the file stream, open the file for read-only. 2.Have each stat on it's own line, and the number for the stat following after it. 3.Create an int for each stat. 4.Create either strings or char arrays (Which would you suggest?) for the name, description, nationality and such. 5.Read in each line, skip to the word, go for the number, read in the number and then store it in the variable, and for the strings, just read in the whole line. 6.Close the file. Now, is that how I should do it, or is there an easier way, or a better way you could think about it. I'm open to suggestions. Thanks in advance EDIT: Oh and btw, if anyone happens to look over what I got so far, and feels that I'm leaving anything out... please... please let me know, the attributes and personal info is all I feel that is needed at the moment, but maybe when I start programming the game, I might realize i need something else, so if anyone has any ideas... just throw it out here, it would help me in the long run.
  9. Quote:Original post by Drew_Benton Quote:Original post by ChaosCommand That sounds like an interesting idea, I guess you would have to do this through the Win32 API? That would be an interesting tutorial for someone to write up, I'd be interested in that, especially for my text based Tennis Simulation I'm programming. Actually you could do it in whatever you wanted to, SDL, Allegro, OpenGL, or DirectX. I'll see if I can throw something together showing this in SDL. I need something to use my input library on anways [wink]. That would be awesome! If you could shoot me an e-mail if you get it finished, that would be great too.
  10. Quote:Original post by Fruny Quote:Original post by Quak the fstream.h fixed it. Thanks to you, shame on me :| NOT <fstream.h> but <fstream> [attention] Now I know the reason that they have fstream instead of fstream.h (fstream is newer), but what is the actual difference(not between the two include files, I know WHY) but, isn't #include <fstream> still pointing to a .h file, or is it including just a file named fstream, or is it something different. Why doesn't M$ just make it that VS just has all the include files to be without .h or is there something else that I am missing. Not really sure about it, but I was just wondering about it. Edit: Better yet, can anyone just explain the difference between <fstream> and <fstream.h>,... not there reason for being seperate, but what the actual difference is between the naming (if you know what I mean), I don't even have <fstream.h> on VS 2005 Beta 2. I'd search through the include directories myself, but I'm at college.
  11. Quote:Original post by Drew_Benton In short, no. You would have to display it using ASCII. For example, something that looks like this, but you would have to do all the coloring of the text font and etc to make it look right. Alternatively, you can make a graphical based program that *looks* and *acts* like a cmd window and take that approach as well. Just an idea though. Good luck! That sounds like an interesting idea, I guess you would have to do this through the Win32 API? That would be an interesting tutorial for someone to write up, I'd be interested in that, especially for my text based Tennis Simulation I'm programming.
  12. Quote:Original post by Darkrider I need lots of help on using C++, I'm a bit stuck on some of these topics shown down and need lots of help to understand them correctly. 1. Basics of C++. Structure of a C++ program. Variables. Data types. Constants. Operators. Communication through console. 2. Control structures and Functions. Control Structures. Functions . The funny thing... he didn't even make this into a question. Here is a little review of one of my favorite books so far: Game Programming All In One by BRUNO MIGUEL TEIXEIRA DE SOUSA (Why can't I have a spanish name?) I liked very very much. It really goes over the basics of C++, then the advanced stuff, and relates it all to games, and gives examples, then goes off into 3D. He spends 300 pages on C++ 50 pages on basic windows to get you into directX And then the rest he goes into detail with DirectX and 3d math and other stuff. Book is in total 907 pages It really is the book that has actually made me want to read it. So if you want to get one book that really shows you all the way, I'd suggest you check this one out. If not, I heard Accelerated C++ was a good book as well, but I can't comment on it. Good luck.
  13. Quote:Original post by Agony Quote:From MSDN: · ios_base::in becomes "r" (open existing file for reading). · ios_base::out or ios_base::out | ios_base::trunc becomes "w" (truncate existing file or create for writing). · ios_base::out | app becomes "a" (open existing file for appending all writes). · ios_base::in | ios_base::out becomes "r+" (open existing file for reading and writing). · ios_base::in | ios_base::out | ios_base::trunc becomes "w+" (truncate existing file or create for reading and writing). · ios_base::in | ios_base::out | ios_base::app becomes "a+" (open existing file for reading and for appending all writes). Note that it says "open existing file for reading and writing". So it will fail if the file doesn't already exist. You'll need to use a different mode for opening, or check to see if the file exists before hand, and create it if it doesn't. *** Source Snippet Removed *** Nice, that worked, seems kinda strange that it just doesn't create it with both flags, but, at least it works now. Now I can finally start working on this thing and hopefully make progress. Thanks for all the help.
  14. Is there a bug in fstream Because I seriously cannot create a file without using ofstream or ifstream... Or is it supposed to be that way, or is my version of VS screwed up, I really need to know, this is the most annoying problem I have ever had and my patience is running out.
  15. And how would I specify a directory to save the file, like the directory the program is running from, or a specific directory?