Jump to content

Search the Community

Showing results for tags 'c++'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Directorate
  • Back End
  • Divisions
    • Arma 3
    • Battlefield 4
    • Call of Duty 4
    • Counter-Strike: Global Offensive
    • Counter-Strike: Source
    • Garry's Mod
    • Insurgency
    • Pirates, Vikings, & Knights II
    • Rust
    • Squad
  • Teams
    • Council
    • Developers
    • Media
  • Misc.


  • Pending Routes
  • Resolved Routes


  • General
    • Announcements
    • Member Activity
    • General Discussion
    • News
    • Suggestions
    • Giveaways
    • Trading
  • Divisions
    • Counter-Strike: Global Offensive
    • Counter-Strike: Source
    • Fistful of Frags
    • Garry's Mod
    • Pirates, Vikings, & Knights
    • Rust
    • Team Fortress 2
  • Teams
  • Interests
  • Support
  • Applications

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



About Me






Power Supply


Hard Drive(s)

Found 9 results

  1. This is a simple game, wanna play? Then download it here: https://drive.google.com/file/d/117Kd71IbPZCSBTxZHycjkq3K7qxR9Mwn/view?usp=sharing It was created using SFML (https://www.sfml-dev.org/) and C++. Further down the road I will be making more games, much more complex. Now that this has become a new hobby of mine. Enjoy! *If the download link doesn't work let me know.*
  2. I've been messing around with sprites and animations in SFML. I tried to animate the tux penguin from Linux and came out with this. In fact, I believe I might make this the player. I mean, why not? What do you all think?
  3. My Age: 25 My Talent: Hello, I am a c++, SourceMod, and Lua developer(I know some html) and know my way around the source engine. I am a good problem solver and can help you resolve technical problems in code or problems with software. I can help you improve your servers, help with moderation of the servers with custom plugins that auto mute people if they say a banned word in chat. I am good with using Github or git, and I know programming and documentation practices. Hours/Week: 60
  4. Howdy everyone. So, I might update this post later on to include future updates. I am currently developing a game right now. It is a precision platformer designed in a unique way. Maps can literally be made in any image editor. MS paint, Paint.net (What I am using to design the gameplay), Photoshop, etc. I am not going to show any in-game footage, but I can showcase a few nips of code haha.
  5. My Age: 18 My Talent: I have good skills in javascript, jquery, json, java and c++. I am adequately familiar with oop and am always will to learn more varied and useful skills, such as a new language. My most recent project was the NASA Hunch crew personalized reminder tool, which was presented to engineers earlier this year. I used github for the project then archived it to google drive. Heres the link if you'd like to take a look: https://drive.google.com/folderview?id=1QaL_c4fef8sKYbZodOHS4XoqVGJ2cfae Hours/Week: 10
  6. So, I have an idea. I thought of possibly making a little game related to GFL staff members. If it be advisers and directors, or server admins. And your goal is to survive levels while members of the staff roster try to murder you. It will be a basic shooter and platformer, but there will be a lot of different enemies for obvious reasons. I might even make new guns and such. The maps will be auto-generated for each level, and every few levels or so a new enemy from the staff team comes into the game. Each new enemy will be harder of course. And as you move on, I might add ways where you can level up. I might add combo stuff so you can possibly level up faster. The player sprites, will be very basic and kind of joke-like. Just the members avatars more than likely. Of course I can do a lot more and have some different changes. Right now this is just an idea I had. I want you to comment down below if you would like to be apart of this game. I might eventually contact you to ask some questions on how you would like your enemy mechanics to be like. For the time being, this is just the planning stage. Anyways, here's my idea bois. Hope you are all doing well! Update: you can apply here. Please do so if you could. https://docs.google.com/forms/d/1d8G9UBDMap4F7wKotggWbdwvd0j2dl7Zvgw81Q3BPEI And here is the official game project:
  7. Hey there everyone. So, here's the deal. I have finally reached the point in the GFL games development process where I can begin creating the in-game enemies. This means I will begin getting in contact with people to discuss their character, and plans I have for the applicants character. At the end of each day (if I have added anyone of course) I will post a message here showing all the people who have been added to the game. I will tag the applicant like this: @_Rocket_. If you wish to apply to be an enemy before I close the application process, please apply here: <Applications have been closed> The following sections of this topic will discuss a few things that concerns specific people. If you have any questions or are curious, browse through here to find out more: If You are not an applicant... And choose not to apply, this is perfectly fine. Chances are you are just here so you can play the game. The game will be completely free to download and play. I will probably even provide the source code for any programming nerds out there. I will need some patience on your end though. Game development takes time. If you want to find out more about this game, here are some other places you can go to learn more. If you are an applicant... I will need a lot of patience from you. I will likely contact you at any given moment in the future. Remember, I am making a video game. I still need to make it fun and balanced, and have a reasonable difficulty curve. If you applied to have your character appear much later in the game, there's a good chance I will not be contacting you for a while. So please be patient, I will get to you eventually. >>>>> IF YOU ARE AN APPLICANT, PLEASE READ THIS SECTION <<<<< There are some very important things you will NEED to know as this process continues. I will NOT be able to get EVERYONE who applied to be added to the game. There is a good chance that some of the applicants will not be able to be added to the game. This is not personal by any means. I should also mention. I did encourage people to put in anything they thought of in the application they submitted. However, I have gotten a few pretty crazy applications. I appreciate all the people who have applied, but remember. I am only one programmer boi. When you are requesting me to make some epic boss fight for your character, you aren't considering how much work it actually takes to make a bossfight. The bossfights for this game are going to be well hidden to everyone. I have a plan for the bossfights, and I do not plan on showing anyone in GFL these bossfights, I want them to be special and a surprise. If you are expecting to be one of those bossfights, I am sorry, but you will be very disappointed. If you are worried that you requested too much in your application, don't be. There's a reason why I am going to be getting in contact with all the applicants. We will discuss your character when the time comes.
  8. Introduction So, allow me to introduce you to a problem. Because as a programmer, your job is that of a problem solver. You will be spending a ton of time fixing bugs and working out kinks in your code, and in the workplace you might even be fixing other people's code. A good problem solver is someone who can fix these problems quickly but efficiently. Because in the end, all the libraries you have access to are just tools in a toolbox that you can utilize to do problem solving. Improving your skills as a problem solver isn't something that you can truly practice. It's moreso something that comes from experience of making your own projects. The harder the project, the more problems you'll encounter, leading to more experience you'll gain. Before The Problem This problem actually comes from something I had to deal with as I was developing my game. And I am going to use this problem to help you gain some insight into the mindset you can inherit to fix your own optimization issues. Don't worry, because this is heavily boiled down for ease of digestion. In my actual code for the game, fixing the problem required pointers and pairs and vectors and an entirely separate function, etc. Something I couldn't possibly teach you in this forum post alone without making it incredibly long. So I'll show you a very watered down version of the problem I faced and had to fix using my own problem solving skills alone. Basically, there is a block in the game that acts as a switch. When touched, it switches a bunch of different blocks into their opposite state. Again, for the sake of watering this down, true means you can stand on the platforms, false means you can't. When the player touched one of these switch blocks, the game would then analyze the entire map to find pixels that have the switchable platform color. It worked like this: Green was the switch block. Magenta was the "true" platform. Dark magenta was the "false" platform. When a green block is touched, the game would analyze each pixel and find any pixels that have the colors of either magenta or dark magenta. If it found any, it would switch that block color to the opposite color. Why is This a Problem? When you are making something like a video game, if your game is going to lag, make it consistent and make it happen when it makes perfect sense. (Like a checkpoint being touched, a loading point being reached, etc.) However, when lag spikes are sudden and inconsistent, players of your game will NOT be happy. I was faced with this problem when during my playtesting I noticed a very big issue. Map sizes are not always the same. Map sizes could range from 800x600, up to 1500x1200. This... This is a problem. Think about it, the larger the image is, the more pixels that need to be analyzed. When analyzing a pixel, the game engine will return the exact pixel color. The thing is, it actually returns a class. Every time the method x.getPixel(); is called, it returns an sf::Color object. Even if a map is 600x600, that means the game will need to analyze 360,000 pixels! Which means it will return the sf::Color class well over a quarter of a million times every frame. On a map that is 1200x1200... That's 1200 squared. That's... 1,440,000 pixels... Per. Frame. There's a very clear problem here. Because as you could imagine, if the map was any larger than 1000x800, the game would have lag frames. In a precision platformer, lag frames are dangerous and infuriating. Especially when the lag frames last for 20 frames just because the map is 1500x1200. So, how can we fix this? Well, before I continue, let me show you a watered down version of the code I originally had. class Green : public ObjectEntity { //Yata yata public: void process() override { for(//for loop for x) for(//for y) { if(color == map.getPixel(x,y)) doThings(); } } } The logic is simple. There's a for loop that covers all the x coordinates. for(unsigned int x=0;x < m.getXsize();x++) Then there's a nested for loop that runs through all the y coordinates. Now, how do we optimize this? To make it easier on you, I'm going to tell you about what you could use to fix this problem. I will give you a few hints. When you die, everything is re-loaded before you respawn. Blocks never move. Now, let me tell you the tool you would use to fix this problem. The Tool: Vectors Let me educate you on what a vector is in C++. A vector is in the standard library, aka the std:: part. If you know what an array is, well prepare to be amazed by the new and improved dynamic array. A vector is a dynamic array. What that means is, the elements in the array can be added and removed at any given time... Dynamically. The two methods you need to use here are these two here: push_back(); clear(); Push back is a method that adds an element to the top of the array. Clear is a method that clears the entire array. Vectors are a template class. This means you initialize them using angle brackets. You do this to tell the compiler what datatype the vector is going to store. This is very flexible. You can even store vectors within vectors to make a multi-dimensional array. Like this: std::vector<std:: vector<unsigned int>> vecTOR(); So, you know your tools and you have your hints. Try to figure out how to fix this problem. And seriously, give it a shot. If you get stumped don't worry. Still try, you'll never learn if you don't make mistakes. Okay, either you figured it out and feel pretty proud, or you're stumped. Either way, let me explain. The Solution Let me break this down. One way to be efficient in problem solving is analyzing what you already know, and what you are currently trying to accomplish. If you are paying attention, you would know that the game is analyzing every coordinate in the map and getting it's pixel color. It then checks this pixel color to find out if it matches the platform color. Still nothing? Pay close attention to "coordinates". Remember the hint about how "blocks never move". Still nothing? Don't worry, this is why I made this forum post. You'll learn through time and experience. The solution is to analyze every pixel once to store all the coordinate locations where the platform blocks are located. That way, the for loops can loop through the arrays of coordinates instead of cycling through the entire map. Firstly, remember. When you die/load in the map for the first time, you can still analyze the entire map during that loading period. That way, the lag frames do not matter. During that loading period, you can dynamically add pixel coordinates that share the correct color. Once the loading is complete and the gameplay begins as normal, once you come in contact with a green block, instead of cycling through 10 million pixels and constantly having to preform boolean expressions using classes, you just have to loop through your vector, take the coordinates saved, and use the coordinates to access the specific pixel that has the platform blocks and preform the process normally. So this way, instead of doing 10 million instructions, you do at the very most 50,000 if you have a HUGE map. But most of the time, you should barely even crack 500 elements to cycle through. This is FAR from the actual way the code looks in the game. The code in my game is far more complex and complicated. So I'll just provide my solution to the code I've written for this example. class Green : bla bla { struct Ye { unsigned int x; unsigned int y; Ye(unsigned int x, unsigned int y) :x(x),y(y) {} } std::vector<Ye> pixelCoords(); public methodWew() { for(Ye e:pixelCoords) { if(color == m.getPixel(e.x,e.y) doThing(); } } } Wew bois. We did some big brain hours right there. Anyways, the logic here is, I made a struct that can hold the x and y coordinates. The vector stores all the coordinates that get loaded in during load time when the entire map gets analyzed for pixels with magenta or dark magenta. Now, each frame the game will check that vector and use those coordinates to get the pixel colors, check if they match a specific color, and do the things they need to do. Hopefully this opened your eye to the concepts of problem solving to optimize performance. Thanks for reading!
  9. Introduction Some programs take hours of work to finish. This is because a programmers job is to problem solve. You will spend a lot of your time trying to fix bugs and navigate the very code you write. And eventually, you might even get your own workspace in a job where others will view the very code you write. With this all being said, efficiency is key. And when you are a beginner with programming, there is likely a couple rules you do not know about that could potentially save you hours of frustration. I am not an incredibly experienced programmer. But I do lots of research, have spent already countless hours working on projects, and more. I believe I have a few tips that could save a few beginners from pulling their hair out. This post is going to mainly focus on methods and functions. If you do not know what these are, I would recommend you consult a video tutorial and study further into the programming language you are using before reading this post. The subjects in this post may confuse you otherwise. Making a function is important to a programs functionality. Everything happens within functions. However, as a beginner you tend to misunderstand how a function should be used. Don't worry, I made the same mistakes. So let me first explain 3 key rules you want to follow when you make a function: Make a Function Readable Make a Function Clean Make a Function With Purpose Now, you may ask what these 3 rules mean. Good question. I am going to break these 3 rules down as best as I can. Listen and read carefully. These rules are likely very important, and might vastly improve your code if you are a beginner programmer. Make a Function Readable Methods and functions are made to preform tasks. When you call a function, that function will access your RAM to find the instructions that the method stores, and executes every instruction until the method is complete. However, the one thing people usually don't realize is... Well, method names are incredibly important. A common mistake I see in code is method names being too cryptic. The common excuse is "it makes the code look cleaner". This is not a valid excuse. They will also often back this excuse up with "I have comments that tell me what the method does!". Once again, this is NOT a valid excuse. Let me tell you why. When I used to make method names short, I'd find myself scavenging through my code trying to find a specific method. Not a specific method name, I was trying to find a method that did a specific thing. When you make a method name cryptic, you cannot clearly tell what it does until you read it's comments. This can help you at first, but what happens if you take a break for a few days? You are going to come back and completely forget what half the methods do. So you'll spend the next few minutes trying to find one specific method. It's... Just not smart. When you name a function, name it with a purpose. Make the method name say what it is made to do. Have it say it's purpose. You should rarely have to use comments. Let me provide an example. int incrimentDigit(int dig) { return ++dig; } This method has a name that explains it's purpose without the need of a comment. If you had to find this method in a file with 250 lines of code, it would be much easier to spot due to how obvious it is. However, what if I named it like this: int incD(int d) { return ++d; } There's a good chance you'll remember this method for a couple days. However, if you took a week break, or gave this code to someone else... They would have a hard time telling what the method actually does without having to find the method itself and read the code. Do NOT do this. Even if the method name gets rather long, just deal with it. It will save you from a ton of frustration later on. Make a Function Clean While method names can be rather long, making the code look a little less polished, it makes it much easier to read. However, that doesn't mean you lack ways to make code more elegant. I mean hell, I write code in C++, I'm pretty much contracted to write code as elegantly as possible. Here's a couple ways to clean up your code, and potentially even optimize performance. And this is often done by accomplishing the same goal with less code. But how do you do this? Well, think about what it takes to be a good writer or journalist. Their goal is to get the same message across with as little words as possible. You have a very similar job as a programmer. Here's a few ways you can go about accomplishing this goal: Ending a Method When it isn't Needed This is a pretty cool one. Let me show you some code. void runProcess(const UserObj& obj) { if(obj.exists() && obj.hasID()) { obj.incrimitDigit(); obj.establishConn(); obj.finishProcess(true); } else if(obj.exists()) obj.genID(); } Don't get me wrong, this method works perfectly fine. However, there's a cleaner way of writing it. If you analyze the logic here, it's a basic if else statement. If both the User exists and has a generated ID, run the code in the if block. Otherwise, if the User at least exists, generate an ID for the user. The thing is, there's a way to preform these checks without an if else statement. Do you know how to do it? And no, take a moment to think how you could write this code without an if else statement if you can. Did you figure it out? Well if not, here's how you'll do it. void runProcess(const UserObj& obj) { if(!obj.exists()) return; if(!obj.hasID()) obj.genID(); //Do all the other stuff you saw } This has done two things. For one, you just fixed a potential but, because now the ID generates for the User, then preforms the processes necessary if the user does exist and has an ID. For two, the code is now much cleaner. Pretty much what happened here is, if the player doesn't exist, nothing in the method needs to be executed. So, the very first thing you do is check for if(!obj.exists()) return; When you do this, everything below this line will not execute. That is because returns always end the method outright. If a return instruction is executed, the method will ALWAYS end. No if else statement required. However, if the User does exist, the code continues. The next like falls on this: if(!obj.hasID()) obj.genID(); This will check and see if an ID exists on the user. If it doesn't, it generates the ID, then the method continues normally. And from that point, all the other instructions are executed as well. The code does the same exact thing, but looks 10x cleaner. Integer Incrementing is Cool Let me show you code: if(numVal == 6) { runThing(); numVal++; } I mean, you are Incrementing the number correctly, but why not do it like this: if(++numVal == 6) runThing(); Pretty cool huh? You can use the ++ or -- at any time, even inside arguments. It's really useful to make code a little cleaner looking. Now be careful. The position you put ++ in will change the order in which things happen. Always remember, code is read from left to right. Let's say numVal is currently equal to 5. Doing if(6 == numVal++) would return false. Why? Because you incremented numVal by 1 AFTER the boolean operator was already executed for the if statement. What you want to do is this: if(6 == ++numVal) this will increment numVal by 1 BEFORE the boolean operator is executed. This way, the if statement goes through because the boolean operator returns true. Make a Function With a Purpose What the hell does this mean? Well, it's simple. Always make functions do 1 thing and 1 thing only, and make sure it does that thing well. This is the biggest mistake I made when I started out as a programmer. I'd always make functions do more than 1 thing. A function should only have 1 purpose. This makes code much easier to bug test and edit. This one rule will save you HOURS of uneeded bug finding and hair pulling. If your method takes 5 different arguments, has more than 10 lines of code within it, etc. There's an extremely good chance you're function is doing more than it should be. Methods should be short, efficient, and incredibly good at preforming ONE task. This makes it much easier to understand the function. This also makes it easier to know what functions to use at what times, and what functions to edit if something goes wrong. As soon as I started following this rule, my bug fixing started taking at most 20-30 minutes instead of 3-4 hours. I am serious, PLEASE, make sure your functions only serve 1 purpose. This is CRUCIAL for your SANITY. And more importantly, it is incredibly crucial for other people's sanity when you get a programming job and other people have to read your code. If this was confusing in any way feel free to ask questions. I can provide answers and even write actual code in an actual text editor to provide proper examples that visually demonstrates what is explained here. If I ever make a video covering this topic, I will link it.
  • Create New...