Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

163 Neutral

About chosenkill6

  • Rank
  1. chosenkill6

    C/C++ Refresher

      Programs running in the system tray need to use Win32 or a library like Qt.   Programs that don't require any visuals serve many purposes. If you're on a Windows operating system, do Ctrl+Shift+Esc and switch over to the 'Processes' and 'Services' tab. How many of those programs do you see actually visible on-screen?    Many programs you can run from the command line, and some are very powerful. Microsoft, Linux, and Mac all have many programs built in that don't have any interface. ImageMagick is a famous one (downloadable) that lets you manipulate image files in-bulk. Many webservers have it pre-installed, but I use it on rare occasions on my Windows machine.   Here's another example of one: Open a command prompt (Start -> Run -> cmd.exe), and type in 'ping www.google.com' to have your computer send a network packet to Google's webservers, and measure the amount of time it takes to go there and back. 'ping' is a program built into almost every operating system. Non-visual tools like these often do one thing, and do it well, and people chain the output and input of multiple "command-line" programs to run complex tasks on bulk files. Some can be dangerous to use, though, if you accidentally ask them to delete files you didn't want deleted - I almost did that the other day.    Game-wise, these kinds of programs don't serve much purpose... but game servers don't have visual interfaces, and so don't need graphics APIs (They all use other kinds of APIs, though - like the built-in networking APIs most machines have, or file-access APIs, or etc...).   Oh i understand now, I thought you meant they could be made with the standard C++ libraries which is what confused me haha. I figured I'd need some sort of API for it anyway.   Thank you very much for the helpful information, I know what I need to do now :D
  2. chosenkill6

    C/C++ Refresher

    The advantages of third party ones is that the code works on Windows, Mac, and Linux, and sometimes other platforms like Android, iPhone (with additional work required), instead of just working on Windows machines. Oftentimes, they're better designed than Win32 also (IMO), because Win32 has to remain backwards compatible with almost two decades of features that are deprecated, and also has to work across many different languages and so can't take advantage of certain language features. Other Microsoft APIs like DirectX do alot better, because each DirectX version has the freedom redesign itself from scratch.   The more modern Microsoft APIs I don't have experience with, mostly because they either use different languages (like C#) or they require you to use Microsoft's tools, or they require non-standard dependencies on Microsoft Runtimes (like .NET). Maybe someone with experience with them can comment. I'm a huge Microsoft fan (love Microsoft Excel and Win7), but I don't like working with the Microsoft libraries I've interacted with so far - though I admittedly haven't tried too many.   But really, your API depends on your goals. If you're wanting to make games, consider SDL 2.0 or SFML 2.0 for 2D hardware-accelerated graphics, and input and sound. If you want to make cross-platform desktop applications, I'd re-recommend Qt. If you're wanting to make services that run without anything visible onscreen, then pure C++ would work without a graphics API.   C++ is a very huge language that takes several years to master. By all means continue to explore it! But when it comes to C++, it's often better to underestimate than to overestimate your capabilities. Or maybe I'm just misunderestimating your capabilities for you.  The book I mentioned won't teach you all of C++ (no single book can), only C++'s standard library. You'll probably want to bookmark cplusplus.com, cppreference.com, and the notable C++ FAQ as go-to sources for information.   Thanks for the detailed explanation! I think I will look into Qt and maybe some other 3rd party API for now because I do plan on releasing it for other platforms as well and the backwards compatibility seems like an unnecessary disadvantage I can overcome by simply using a more modern API.   I've started reading on cplusplus.com already so for now I think I'll just get myself up to speed on C++11 and then start my application development.   I'm curious about the part where you mentioned that programs that run in the background don't need a graphics API. What would I need for such a program? Just a simple program running in the system tray.
  3. chosenkill6

    C/C++ Refresher

    That book looks exactly like something I am looking for, I will look into it for sure!   Would it be better to use the Microsoft wrapper API? What is that called and how does it differ from third-party ones such as QT? I would prefer to stick with the official one by Microsoft unless there are specific advantages to using a third-party API.   I made 2 games (Pong and Pacman) in C only but I learned C++ shortly after and started remaking my Pong using C++ and OOP, didn't finish the game but I'd say I was fairly sufficient in C++. I would like to continue with C++ but I was unsure which would be more relevant to Windows programming.
  4. chosenkill6

    C/C++ Refresher

    I've been away from C/C++ programming for quite some time now, been doing a lot of work in Java (mostly making games) but I have made games in C in the past using SDL so it's not like I am learning a new language but I feel like if I just dove right back into it I would struggle. What would be the best way to get a quick refresher in C/C++ because I would like to start getting into some Windows API programming now. I looked up some C/C++ tutorials but they all start with very basics such as what a variable is etc. I would just like to get familiar with the syntax and language specifics quickly. What would be the best way to get started developing as fast as possible? Thanks!
  5. Very original name.. I know.... I have just published my very first android game and very first published game as well! It isn't much but I am proud of it. You can download it here. Any feedback would be appreciated. Thanks!
  6. Is it possible to create a java popup without a windows bar without the close, minimise buttons etc? I would like to create a java app that runs in the background but when certain conditions are met it will create a popup but I don't want a window but instead a small popup I can design. Any classes that Java provides to get me started would really help.   Thanks
  7. chosenkill6

    Ordering strings

    Thanks for the java collections link! It worked :D   Thanks for the help :D
  8. chosenkill6

    Ordering strings

    The array of students is created elsewhere and each student contains firstname, lastname, grade, age, email. I would like to list by first name but then have the appropriate lastname, grade etc with that first name. So if i have student[0] and it contains 'b' for every field and i have student[1] and it contains 'a' for every field i would like to have output:   a a a a a b b b b b
  9. chosenkill6

    Ordering strings

    That is exactly what I am doing. I have an array of 20 students. Each read method takes a student object as a parameter and reads the appropriate information from a file for that student. How would I implement such a custom comparator?
  10. chosenkill6

    Ordering strings

    I have a method which loads data from a Student object. I would like to be able to get a string from that method which holds the data the student class contains. public static String getData(String order) throws IOException{ //create string array for each type of data student object can hold String[] firstNames = new String[numberOfStudents]; String[] lastNames = new String[numberOfStudents]; String[] grade = new String[numberOfStudents]; String[] age = new String[numberOfStudents]; String[] email = new String[numberOfStudents]; for(int i = 0; i < numberOfStudents; i++){ //get data from each student object firstNames = readFirstName(studentArray); lastNames = readLastName(studentArray); grade = readGrade(studentArray); age = readAge(studentArray); email = readEmail(studentArray); } //HERE i would like to be able to order by first name or last name but i //would like to keep the last name and grades with its own first name if(order == "FIRST_NAME"){ }else{ } return "NULL"; }   I hope I am being clear for what I am trying to achieve. It may be difficult to understand from just looking  at this method.   Thanks
  11. chosenkill6

    Calculating normal force

    I hope it is okay to ask physics questions unrelated to games but I am really struggling with this question. Please help me understand how to go about doing this.   A sled of mass 26kg has an 18kg child on it. If big brother is pulling with a force 30N to the right and 10N up while big sister is pushing 40N right and 16N down, what is the normal force?
  12. chosenkill6

    Function Recursion

    The analogy you presented, the child can have more children, kind of confuses me. If I am using recursion, I am making another call to the method I am in, so does that not mean that I am simply going back and forth between 2 children?   The recursive function operates on each node, which calls the recursive function on all it's children, i.e: if we void Func(Node N){ for(int i=0;i<N.Children.Count;i++) Func(N.Children); return; } which allows you to operate on an indeterminable number of children. Made a small change for doing unnecessary work. That code has a side effect. You're returning a void method? What is the point of that. What you should do is say that once it returns successfully, you break out of the loop: if (coin != toonie) { coin = 0 + (int) (Math.random() * ((6 - 0) + 1)); checkCoins(coin, turns); break; } Once it returns successfully, you break out and avoid a side-effect of the method.   (Yes, I know it's an unimportant side effect that doesn't actually affect anything, however consistency !)   (I just want to point out that there are some non-elegant pieces of your code, such as using an int assigned to a random number to toonie. You could create a class with an state called isToonie class Coin { bool isToonie = false; }   and then have your code make more sense (instead of: if (coin != toonie), we get: if (coins[index].isToonie))).   Cheers !   Thanks for the pointers! Fixed my code, works like a charm
  13. chosenkill6

    Function Recursion

    package mainPackage; public class RecursionCoin { final static int toonie = 6; static int[] coin = {0,0,0,0}; static int turns = 0; public static void main(String[] args) { for(int i = 0; i < 4; i++){ coin = 0 + (int)(Math.random() * ((6 - 0) + 1)); } checkCoins(coin, turns); System.out.println(turns); } private static void checkCoins(int[] coin, int turns2) { turns = turns2 + 1; for(int i = 0; i < 4; i++){ if(coin != toonie){ coin = 0 + (int)(Math.random() * ((6 - 0) + 1)); checkCoins(coin, turns); } } } }   I am going to try a few more problems on my own now just to make sure I fully understand this. Can someone just skim through my code, see if this makes sense? Thanks!
  14. chosenkill6

    Function Recursion

      Okay, so we could use some recursion:   (Code is in JavaScript because JavaScript is basically universally easy to read for people who have a background in almost any standard programming language. That doesn't make it good, though ).   function findSmallestNumber(currentNumber, currentFunctionCall, amountOfFactors) { if(currentFunctionCall > amountOfFactors) { return currentNumber; } else if (currentNumber % currentFunctionCall === 0) { ++currentFunctionCall; return findSmallestNumber(currentNumber, currentFunctionCall, amountOfFactors); } else if (currentNumber % currentFunctionCall !== 0) { ++currentNumber; currentFunctionCall = 1; return findSmallestNumber(currentNumber, currentFunctionCall, amountOfFactors); } } var amountOfFactors; do { amountOfFactors = prompt("How many factors are there (0 - ?)"); } while (amountOfFactors.isNaN); console.log(findSmallestNumber(1, 1, amountOfFactors)); (What's awesome about learning recursion is that this makes sense )!   So, I tested this with 1-10 and it worked. However, try it with 1-20 (This link will bring you to a page with my code. Click the "run" button to see it in action!) You should get the error "Too much recursion". The compiler can't handle 25,000,000 function calls (I solved the code euler problem, obviously, so yeah, there's that many). So, we have to translate it into loops: function findSmallestNumber(amountOfFactors) { var currentNumber = 1; var currentFactor = 1; while(currentFactor <= amountOfFactors) { if(currentNumber % currentFactor === 0) { ++currentFactor; continue; } else if(currentNumber % currentFactor !== 0) { ++currentNumber; currentFactor = 1; continue; } } return currentNumber; } var amountOfFactors = 0; do { amountOfFactors = prompt("How many factors (1 - ?)", ""); } while (amountOfFactors.isNaN); console.log(findSmallestNumber(amountOfFactors)); This is the same function, using loops. We see that it works the same, however it will work for an (almost) infinite amount of number.   (One more thing, don't try the script using a while() loop with the value "20". It will cause your browser to freeze because Javascript really isn't meant for this Because it's an interpreted language and it's not actually that useful ).   Cheers ! Ah that makes sense! I think that is where I was struggling, failing to understand when to use which. Thanks for clearing that up :D
  15. chosenkill6

    Function Recursion

    That, in my opinion is a really bad problem to introduce recursion to. also, if you use Juliean's solution(which is probably the solution i'd come up with), their's the tiniest of tiny chances that you could overflow the stack because you never actually get the required number of toonies, the odds are astronomically small, but that solution does open up such possibility's. Your instructor should have presented tree based searching as an introduction to recursion, as this is where recursion is not only the best option, but is pratically the only option. for example, say you had this tree structure: (N = Node): N / | \ N N N / \ / | \ / \ N N N N N N N | / \ N N N | N each node has x number of children, and each child can also have any number of children, how would you reliable iterate over all the nodes? That is where recursion shines, however the problem you have can, and imo is safer/faster to solve using loops rather than recursion. edit: actually, as it is now, Juliean's solution will cause a crash since you can never pick a toonie(change the value of toonie to 6) The analogy you presented, the child can have more children, kind of confuses me. If I am using recursion, I am making another call to the method I am in, so does that not mean that I am simply going back and forth between 2 children?
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!