Cheat-Proof techniques for Online Game(TCP) [closed] - c++

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm creating a game and i'm really worried about hacking, so i'm writting a anti-cheat inside the game, i searched how the hacks now-a-days are written and i found some patterns, first of all, almost every hack uses a thread(Usually with CreateThread()) to create the checking loop(check if hack is on/off), do any of you have a good way to check if the thread is not from the game?PS:I also use threads from outside the code(inside DLLs)

It is almost certainly better to find a different way to "anticheat", since as cdhowie points out, there's nothing to prevent someone clever from splatting over your anticheat code with something that doesn't do what you want.
There are some techniques that work much better:
Let the server do all the "important" stuff, such as figuring out what score you get and how many lives you have left, and if the player becomes a zoombie (tries to move after he's dead), something is wrong.
Another method that I think works reasonably well is to basically record a "log" of how the player got to where they are - how many lives they used, how many enemies killed, what type of enemy, score of each enemy, weapon used, shots fired, how long it took to do all that, and then let a server verify that it's "reasonable" - so if someone ups the number of lives they have, or changes the weapon to create 100x the damage, or slows down the enemies or speeds up the players time, it will show up in the "log", and the log can then be discarded as "fake".

Related

is declaring variables in between code bad practice? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I realize this might be a controversial topic, but as a prospective developer who is entering industry in a couple of weeks, I'm trying to get an idea of the do's and dont's when writing code.
One of the things that even my professors seem to be at odds on is where should local variables be declared. I've had professors insist that the only way is to declare them all at the start of the function. This has the benefit of not reconstructing a new object every time a loop is entered, for example. But it has the draw back of making logic harder to follow since you don't know which variables are used in which scopes.
Other professors say that it is good practice to declare them when you use them. Even if it's in the middle of the lines of code. This seems to be more of a Python style of coding and could possibly clutter the code with, verbose, and unnecessary type information. Also, this could incur a performance penalty since the object will get constructed and then destructed in every iteration of the loop.
Then I had another professor say to declare them at the start of their respective scopes. So ideally, after each { there would be declarations for all the variables used in that scope. This seems to offer the best readability, and the worst performance since now the object could potentially be constructed and then assigned to (two separate, possibly expensive operations) in every loop iteration.
I hope you can see how a new programmer can get confused about what format to follow. So is there consensus in the work field about which style is the "best"?

Ecology C++ Code [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
New to C++ and stuck on how to start coding this problem which is an Ecology question at first to start a cell with plants antelopes and tigers. Based on initial population, birth rates, food supply, dying off and migration into other cells (once 1 cell is discovered then can expand more). Did some tests on paper to see that plants are going to need a Cap because plants multiply more than antelopes can eat them. I dont really know how to start this if anyone can give me a starting point then that will be grateful.
Thank you.
I sounds like you're trying to build an individual, agent-based, or microscale model: this being subsets of the more general topic of discrete event simulation. Looking into those topics and reading some of the literature and books around them would be a good start.
One way to get started conceptually might be to play with SimPy. Once you think you understand how its pieces fit together and how to build a model, you'll be in a better position to move to a higher-performance language, like C++, where you'll need to build more of the components yourself.
You should also learn how to program. Having to ask a question as general as you are at the beginning of this endeavour should give you pause: people have devoted careers figuring out how to do this the right way. That said: C++ is a decent choice of language because you'll need to run your model not just once, but tens of thousands of times, in order to get an idea of how variable your results are. Remembering that the number of interactions between variables grows exponentially in the number of variables, you'll also want to explore different combinations of environments with an eye to testing the strength of your assumptions.
All of this will also probably require the use of a high-performance environment: you'll want to learn about MPI, R's HPC packages, jug, or Spark: each of which would have to be tamed to work with your implementation of the model.
This paper I recently published has a relatively simple agent-based model, along with an analysis and source code, which might help you get started. It may also help you understand the enormity of the undertaking you propose.

Is my company doing this right, sharing data between exes? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
First off, my company is into power grid, not IT, so software is kinda a secondary role here.
I work on a power system simulation software, very old code base in C++ with MFC, like 15 years old. What we do is take large amounts of data, ~100,000 floating point values then format and write to a text file (most of the code actually uses the C FILE structure to do this). Then, it's read by a separate engine exe which computes the electrical algorithm (Electrical algorithms are mostly numeric solutions of system of diffn equations) and then writes back huge amount of data to another text file, which we read and update the UI.
My question is, is this how it should be done? It there a way to skip writing into the text file and directly pass the data to the exes?
exes are called using CreateProcess() MFC function.
EDIT::
Sorry, site won't let me comment.
#Vlad Feinstein Well, yes, it's like a Ladder. A thing called load flow solves power flow through the lines, which in turn will be used to find stability of the systems, which in turn for overvoltage ect. It's huge, the UI is million+ lines of code, engine exes another million maybe.
Doesn't MFC already implement IPC using Dynamic Data Exchange? I can pass strings to another process's PreTranslateMessage() func. A scaled up version of that?
There is no such a thing as "should be done as ..." there are multiple methods to do IPC and while the method you describe might not be the fastest, it is a viable solution nevertheless. If the performance doesn't bother you in this particular case you should not bother with modifying it. It is exactly the case where the phrase "if it ain't broke, don't fix it" applies.
Probably, you would not want to make any new IPC in the application that way, though.

Efficiency vs Memory tradeoff [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am creating an interactive sudoku board in c++. Whenever the user changes a value, I would like to check if the board is completed. The board will be completed when all spaces on the board are filled. My two ideas of how to do this are:
Create a private data member that holds the amount of filled spaces. To check if the board is completed I will simply have to check if this value equals boardLength^2
Create a member function that iterates through the board and returns false when a blank space is found and true if it goes through the board without finding any blank spaces
Is this a matter of preference, or is there a more accepted/correct way to do this?
Is this a matter of preference, or is there a more accepted/correct way to do this?
There is an accepted and correct way of optimizing, in general:
Optimize for speed or memory footprint when you actually need to, when you identify an actual problem. Your project's unique requirements will govern what constitutes a "problem".
Otherwise, optimize your code for readability and maintainability.
In your particular case:
Chances are that no matter which algorithm you choose, your check will happen so quickly that you will not be able to measure it, and the user will never notice the difference between the simple solution and the "fast" solution. Any attempts to optimize this (at the cost of complexity or readability or time spent writing code) are poor trade-offs.
Use the simplest possible solution. Once finished, if there is a noticeable delay on user input, and you can confirm that it's caused by an inefficient check for board completion, consider ways to improve your algorithm.

What can a second year computer undergrad do which might be considered worthwhile in the future? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Besides taking classes I mean. I want to make myself stand out from the crowd. I am very good at building logic/algorithms. Like I can implement any problem in C. But I don't know how to harness it! Like what to code!?!
All I have made upto this point is games that too in C's console, using ASCII and character arrays. Snake, Sudoku (making a puzzle and solving too), rip-off of Mario Bros., tictactoe with AI. But making games won't get me anywhere.
I was wondering if I could get suggestions from you guys?
I know C++/C and a little Java. I have just got started with data structures. So, it would be great if it would be relevant to data structures. I know about most trees and types of data structures. Thanks a lot for your help.
I know it's off topic but I have nowhere else to turn to.
Pay attention in your finite automata classes. Learning the basis of all languages makes "knowing" a language irrelevant.
If your school offers it, take some business computer systems classes.
Try to get some project management experience under your belt. This could be done by doing work for charity or an internship for a prof.
Of course there is always open source projects as well.
Get a job. I was working for a small development shop as a second year student.
Open your own company, and start doing some mobile apps. The sky is the limit.
If you want to have long term impact, you can do one of two things:
Be a genius, and invent a new gizmo everybody needs. [Extra points].
Build a foundation for something. Add to it cleanly, continuously. Eventually it will have enough mass to have an impact.