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


  • Content count

  • Joined

  • Last visited

Community Reputation

154 Neutral

About Zael

  • Rank
  1. Is there any reason you are loading them from assets instead of resources? As I recall loading them from resources is slightly easier.
  2. This has been posted many times before. In short though: C# and XNA are good for a beginner. You should probably be prepared to make your first several programs (games) text based stuff to get a feel for program flow and the art of programming. [url="http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-csharp-express"]Visual Studio Express edition[/url] is free from Microsoft's website. I don't actually do much C# myself, so I can't really help as far as tutorials go. Good luck!
  3. I will see if I can take a moment to look at it more in-depth over the next few evening, but right off the bat, you can make it a lot cleaner if you look at using functions. Functions help you abstract different procedures and not only easily re-use code, but also make the code itself more readable. In case you haven't encountered them before I have included a small example. [CODE] #include <iostream> using namespace std; int sumOfRange(int a, int b); int main() { int a, b; cout << "Provide first number: "; cin >> a; cout << "Provide second number: "; cin >> b; cout << "The sum of all numbers between " << a << " and " << b << " is: " << sumOfRange(a, b) << endl; int c,d; cout << "Provide first number: "; cin >> c; cout << "Provide second number: "; cin >> d; cout << "The sum of all numbers between " << c << " and " << d << " is: " << sumOfRange(c, d) << endl; } int sumOfRange(int a, int b) { int total = 0; for(int i = a; i <= b; i++) { total+=i; } return total; } [/CODE] The first thing I do is declare the function on line 5. All functions must be declared before using. A function is comprised of really three parts. The first is the return type. In this case the function returns an int. The second is the name of the function. This is how the function is called. The last thing is a list of parameters. I believe there is an upper limit on the number of parameters a function can have, but I have never hit that limit (it is pretty high). Each parameter is essentially a variable that is declared just like you would inside a function except that it is a copy of the whatever value was passed to the function. The next thing I do is define and declare my main function. Inside my main function I use the the function I declared on line 5. Finally after my main function I define my function. The function definition is essentially the code that is executed when the code is used. A minor, but essential thing to understand is that because parameters are copies, if you change the value of a parameter in a function the variable used when calling the function is unchanged. [CODE] #include <iostream> using namespace std; void functionThatDoesNothing(int a) { a = 10; } int main() { int a = 5; cout << "The variable 'a' is: "<< a << endl; functionThatDoesNothing(a); cout << "The variable 'a' is still "<< a << endl; return 0; } [/CODE] You can see from this example that the function does not change a. I have also shown that you can define the function at the same time you declare it. It is usually best to define and declare the function separately if you have more than one file (declarations go in the .h or .hpp file and definitions go in the .cpp file). If you want to have the parameter directly affect the variable that was used when calling the function you can use what is called "pass by reference". Whether a function parameter is "pass by value" or "pass by reference" depends on the way it is declared in the function declaration. To make a variable "pass by reference" you simply place an '&' character before the variable name. Below I will demonstrate the same code as above, except with "pass by reference". [CODE] #include <iostream> using namespace std; void functionThatDoesSomething(int & a) { a = 10; } int main() { int a = 5; cout << "The variable 'a' is: "<< a << endl; functionThatDoesSomething(a); cout << "The variable 'a' is now "<< a << endl; return 0; } [/CODE] "Pass by reference" can get a little bit dangerous (your code will crash) if you use it in certain ways (like for the return type of a function), but for the way I have demonstrated above it should be safe in most if not all situations. P.S. Classes and Structs can also make code a lot cleaner and more readable, but I think learning to write your own functions first is a nice step in the right direction.
  4. Didn't mean to insult you. You would be surprised at some of the simple things people will ask how to do. In a cmd window I am not aware of any mouse functions (could be wrong), so you may still need to do a simple menu like that when the user makes choices. Of course maybe you are more creative than I. Ideally you would use a system library that reads each key as it is pressed (instead of waiting for the user to hit the enter key). Most text based games I have played use a method like that with certain keys toggling a menu.
  5. Typically in a text based game a menu will be simple output with different input option. Example "Menu": [CODE] int choice = 0; while(choice != 2) { std::cout << "What would you like to do?\n"; std::cout << "1) Start a new game\n"; std::cout << "2) Quit\n"; cin >> choice; switch (choice) { case 1: startGame(); break; case 2: return; break: } } [/CODE] Does that make sense or are you asking something else?
  6. Check out [url="https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&sqi=2&ved=0CDQQFjAA&url=http%3A%2F%2Fprojecteuler.net%2F&ei=bDqUT9-yF-Gf6QGSneyqBA&usg=AFQjCNFW7PrMk0NSvKgoR9RYdherBt3i6Q"]Project Euler[/url]. It is basically exactly what you have described.
  7. Like crancran said, 1 and 3 will vary based on previous experience and just how quickly you learn things. I think 2 is a little bit more definable, but I think it is more about making sure you know the content of said lessons than the actual number of lessons you go through. I personally think you should feel comfortable with the everything up to and including Object Oriented Programming before starting a 2D game (from the tutorial series at [url="http://www.cplusplus.com/doc/tutorial/"]http://www.cplusplus.com/doc/tutorial/[/url]). I would start trying a simple text based adventure game (kind of like the you-choose-the-ending type books) by the time you get through Control Structures. Depending on the simplicity of the game and the 2D library you choose to work with, you could conceivable start writing a 2D game at that time as well, but I wouldn't recommend it yet. Also, even though they are not really called out in that tutorial series I would strongly recommend looking at and learning how to use std::vector and std::string as soon as possible. While it is good to know about raw arrays and character sequences they can lead to a lot of bugs that are easily avoided by using the string and vector classes. As for 4, I started my first full-time job as a software developer last year at about this time. I still love programming, and still spend a lot of my evenings working on personal programming projects (most of them game related). I still hope to break into the game industry someday (probably as an indie), but I have to pay off my student loans first. For me programming has always been a creative outlet. I can literally create worlds with whatever rules I set for them, and then see them on my computer screen. Nothing else I know has ever let me do anything like it. 5) I don't quite understand question 5 to be honest. P.S. SDL requires the use of pointers. I have never used SFML, but if it doesn't require the use of Pointers then you could probably create a simple Snake clone by the time you have finished Control Structures. I would still recommend getting classes and inheritance down. They make your code much more managable.
  8. Looks to me like the problem is that you are simply repainting the time without repainting the background first. Think of the surface as an actual canvas for a second. You have a picture on the there. Then you create a picture of the time. Next you paint that time picture onto your canvas surface. Before restarting the loop, you free the time picture (this doesn't affect the canvas image which still has the time already painted onto it). Then you get the new time, and paint the new time onto the surface (over the old time, but without removing the old time). If you want to erase the previous surface, what you really need to do is at the beginning of each loop re-apply the background (thus painting over the old time). SDL_FreeSurface frees the image from memory, but it doesn't erase the image from other surfaces on which it has already been "painted". Does that make sense?
  9. Don't be scared. I started when I was just two years younger than you, except I started with Quick Basic. I am very impressed that you trying C++ at such a young age. Some pretty basic tutorials are available at: [url="http://www.cprogramming.com/tutorial/c++-tutorial.html"]http://www.cprogramming.com/tutorial/c++-tutorial.html[/url] and [url="http://www.cplusplus.com/doc/tutorial/"]http://www.cplusplus.com/doc/tutorial/[/url]. The important thing with programming is not just learning the syntax (language) but also getting into a logical mindset and developing your ability to think through a problem. I strongly recommend trying some of the problems from [url="http://projecteuler.net/"]http://projecteuler.net/[/url] to build up your ability to think through problems as you start to understand the language. Depending on where you are in Math (Algebra or Pre-Algebra?) you should be able to do some of the easier problems without too much difficulty. Feel free to PM me (or just post) any questions, and I will try to answer them. At one point I started writing an Intro to C++ book aimed directly at your age group; however, life has taken over, and to be I honest I enjoy programming more than writing about it.
  10. How have you made your current games? Has the view to gamedev (this website or game development?) changed since ... 1990? 2000? last year? There are 10s if not 100s of ways to start making games ranging from GameMaker to Unity and from HTML5/Javascript to C++ with DirectX. It depends little bit on how much you want done for you and how custom your game needs to be. If you provide a little bit of background we may be able to provide more in-depth answers.
  11. Your logic listed sounds fine to me at a high level. Perhaps you could be more specific with what you are looking for? What logic do you feel you are currently missing that you need? I don't think many people on this forum use VB, so we probably can't help too much with VB classes and libraries. It seems to me like you might want some sort of logic for determining if the price is too high (go to another store), or if the quality of the products aren't good (go to another store). Aside from that I might look at path-finding algorithms to go to the products (if you are doing a 2D game instead of just text based).
  12. It should work for crossing the Y-axis just as well. I will attempt an English translation of the algorithm. First, get the direction of rotation to go to the current target. Then, create a second target. This second target is the same as the actual target but offset by 2 PI. If the target is less than 0 then add 2 PI to it to create the second target; otherwise, subtract 2 PI. If for example we have a target of 1 radians, we now have targets of 1 and -5.28319 radians. Next, we identify which one is closer to the currentRotation. If it is our second target (-5.28319 radians in the example) then we change the direction. Let's assume the currentRadians are -3.1. The second target is closer so our direction should now be -1. Now we take the currentRotation and add the movingRotationSpeed times the direction. This will get things rotating in the correct direction. The next bit is bookkeeping. If the currentRadians are greater than PI we want to reduce it by 2 PI. This keeps it in the same position but keeps the value between -PI and PI. We do the same test to check if currentRadians are less than -PI and if so, increase the value by 2 PI. The final bit is because we are dealing with floats. When dealing with floats it is extremely unlikely that we will get an exact match. So once our currentRotation is within the movingRotationSpeed of the target we simply set it equal to the target. Example: currentRotation = -2.9 targetRotation = 2.5 movingRotationSpeed = .1 First we check the direction. Since targetRotation minus currentRotation is greater than zero we set the direction to 1. direction = 1 Now we create the secondTarget. Because the targetRotation is greater than 0, our secondTarget will be targetRotation minus 2 PI. secondTarget = -3.78318531 We can see that our currentRotation is closer to our secondTarget, so we change direction. direction = -1 Now we move my movementDirection*direction. currentRotation = -3.0 (iteration 1) currentRotation = -3.1 (iteration 2) currentRotation = -3.2 (iteration 3) On iteration 3 the currentRotation becomes less than negative PI, so we add 2 PI to the result. currentRotation = 3.08318531 On iteration 4 we find that the currentRotation is greater than targetRotation, so our initial direction is -1. We also find that targetRotation is now closer than our secondTarget, so our direction stays at -1 from here on out. direction = -1 We continue iterating. currentRotation = 2.98318531 (iteration 4) currentRotation = 2.88318531 (iteration 5) currentRotation = 2.78318531 (iteration 6) currentRotation = 2.68318531 (iteration 7) currentRotation = 2.58318531 (iteration 8) On iteration 8 we find that we are within the movingRotationSpeed of our target, so we simply set the currentRotation equal to the targetRotation. currentRotation = 2.5 Does that help/make sense? P.S. Looks like SimonForsman's code does essentially the same thing in a little bit different order. P.S.S. An if statement is actually more correct because the while loop should essentially be replaced with the game loop. Your condition should be if the angles are not equal do the code that I have in the loop.
  13. What that line says is if the targetRotation is less than 0 set the otherTargetRotation to targetRotation + 2PI; otherwise, set it to targetRotation-2PI. Here is complete working code with the missing bits filled in. This has been tested and works. [CODE] #include <iostream> #include <cmath> using namespace std; #define PI 3.14159265 int main() { cout << "Current Rotation?\n"; float currentRotation; cin >> currentRotation; cout << "Target Rotation?\n"; float targetRotation; cin >> targetRotation; while(currentRotation != targetRotation) //rotate { int direction = targetRotation - currentRotation > 0 ? 1 : -1; float otherTargetRotation = targetRotation < 0 ? targetRotation + 2*PI : targetRotation - 2*PI; cout << "Target: " << targetRotation << endl; cout << "Other: " << otherTargetRotation << endl; char c; cin >> c; if(abs(targetRotation - currentRotation) > abs(otherTargetRotation - currentRotation)) { direction *= -1; } currentRotation+=.1*(float)direction; if(currentRotation > PI) currentRotation-= 2*PI; if(currentRotation < PI*-1.0f) currentRotation+=2*PI; if(abs(targetRotation-currentRotation) < 0.1) currentRotation = targetRotation; cout << "Current Rotation: " << currentRotation << endl; } } [/CODE] You will obviously want to set your own thresh hold and velocity, and remove the input/output statements. EDIT: Some of my code was cut-off in my copy-paste. It should now be fixed.
  14. Sounds to me like your bottleneck is collision detection (though I don't know how Clanlib does graphics). Might be best to try a physics engine like Box2D for collision detection. Testing each object against every other object adds up very, very quickly. sum(1:n-1) quickly. So at 80 objects you are testing 3160 collisions every frame. A physics engine (like Box2D) should be able to split your space into regions so that cells only check against other cells in the same region. Assuming for a moment that your 80 cells are evenly split into 4 regions, that already reduces your collision checks per frame to 760.
  15. I have to ask why not just use vector math? [CODE] float unitVectorX = b.x-c.x; float unitVectorY = b.y-c.y; float distance = sqrt(unitVectorX*unitVectorX + unitVectorY*unitVectorY); unitVectorX /= distance; //results in amount of x to travel per unit unitVectorY /= distance; //result in amount of y to travel per unit c.x += unitVectorX*velocity; c.y += unitVectorY*velocity; [/CODE] Maybe just my opinion, but I find it far simpler to think about. I could be wrong, but I also believe it is significantly faster than having to use the trig functions.