Please try my game out

Pages: 12
So I made a game (not telling you what it is since you can find out for yourself).
I want you guys to test it out and play it. :D

If you think my game is a virus then I also included source code so you can compile yourself after viewing it. Otherwise you just have to open my .exe file.

Note: Windows computers only. [EDIT] Sorry my mistake. It is cross-platform. (works on any OS)

Link: https://drive.google.com/open?id=0BwG7XPYoWEMXMHhJZndYTTJYYlk

Please tell me what you think. Thanks a lot!
Last edited on
@WatchdogMan

I'm confused by your reply...
You suddenly give me links to your program and talk about how to add a background image to YOUR program... and give me a lot of links.

It looks like spam.

By the way my program works on any platform. My mistake.
boost lexical cast wrote:
"I'm confused by your reply...
You suddenly give me links to your program and talk about how to add a background image to YOUR program... and give me a lot of links.

It looks like spam.

By the way my program works on any platform. My mistake."

Don't be unfriendly.
Do you understand English? You should be able to test my restaurant program without a problem. Did you read my instructions closely enough?

By the way, what I provide is pure C++ code not an executable. It cannot be spam or anything like malware.

Don't be unfriendly.
Do you understand English? You should be able to test my restaurant program without a problem. Did you read my instructions closely enough?

By the way, what I provide is pure C++ code not an executable. It cannot be spam or anything like malware.


Well I tried to test your program but my compiler does not support some functions and the online compiler didn't work for me. Have you tried out my program? I included the source code so you can read and compile yourself to make sure it isn't a virus. Also the .exe file.

I actually would like to know how to make the .exe icon different. AND how you make your quotes in the format "name wrote: ".
Last edited on
Well I tried to test your program but my compiler does not support some functions

What OS are you using?
What C++ compiler are you using?
What are the compiler errors you received?

Well I tried to test your program but my compiler does not support some functions and the online compiler didn't work for me.

It is because the website http://rextester.com/l/cpp_online_compiler_visual does not support direct user input mode.

Note: Windows computers only.

Note : If you say so, my code is 100% guaranteed to work. As long as you are using Visual Studio.
Last edited on
So... I don't want to download Visual Studio since it's rather large and takes a while. I'm using Code::Blocks.

And in my opinion you should make you program so it can compile on any up to date compiler and so it can run on any OS.

I'm using Windows 10 and in Code::Blocks I'm using GNU GCC up to date.

Check my edited post up there ^^^. (my original post)

And also, when I try to run your code on rextester it says:
Process killed because it ran longer than 20 seconds
Last edited on
My program uses a function to set color text for console. So that is why I was forced to use the version for Windows. That is all.

Of course, I wanted to target cross-platform from the start, but too bad you do not have a C++ compiler made specially for Windows. If Visual Studio 2015 Community is too heavy, you can try the VS 2012 or VS 2010 version.

Edit :
And also, when I try to run your code on rextester it says:
Process killed because it ran longer than 20 seconds

Let me repeat. It is because the website http://rextester.com/l/cpp_online_compiler_visual does not support direct user input mode.
Last edited on
Could you please test out my game... You double click the .exe or you can compile the source code.
This link may help you :
http://www.cplusplus.com/forum/general/107306/

Still, you need to download less, I bet.

P.S : I will try testing your game when I am done with my lunch.
Last edited on
You are giving people an infected executable program here.
https://www.virustotal.com/en/file/2cfc944b2dc470bf98fa5d032fb2ac89c79f3ef6e85d0fac35621f596747a9d9/analysis/1476188562/

Also, I could not compile your project either. You say it is cross-platform, but I am using a C++98 compiler. What a waste.

Note : Cross-platform means not only must it be able to compile on all OS, or platforms, it must be able to comply with C++98 standard (at least). Truthfully speaking, there are still a large number of people who are still using C++98 compilers, so take it into account so that you write better programs next time.
WatchdogMan wrote:
Note : Cross-platform means not only must it be able to compile on all OS, or platforms, it must be able to comply with C++98 standard (at least). Truthfully speaking, there are still a large number of people who are still using C++98 compilers, so take it into account so that you write better programs next time.


So many thins wrong with this comment here, boost lexical cast you can just ignore basically everything he said there.

Not sure where he/she came up with the idea that cross platform support means that you need to have backwards compatibility with C++ standard almost 20 years old. Not to mention that supporting an almost 20 year old standard means you can't use any modern features at all. That is not how you write "better programs" as he/she says, instead it is how you cripple yourself by using outdated technology.

More than likely he is a troll and everyone should just ignore whatever he is saying.

As for your game if you can upload it to a GitHub or similar repo I would be glad to test it out and look over the source if you would like.
Last edited on
@Z e r e o

Thanks. My game is on GitHub now: https://github.com/SrandTimeNULL/Ball-Cups

Please try it?
That's not how Github is supposed to be used :)
You should upload the source files not an archive of them.
(eg. look at one of my repositories: https://github.com/amhndu/gravity)

I tried the game, it's nice!
I like the sliding visualisations, good work.


BTW, It's not cross-platform, since you use conio.h and system function.
If you want to stick to the terminal, look here: http://www.cplusplus.com/forum/general/41965/#msg226792

But terminal is a bad place for games, if you want to make more games, you can use graphical libraries like SFML (https://sfml-dev.org) or SDL. (I suggest SFML)

And there are things like OpenGL/Vulkan for 3D hardware-accelerated graphics, and 3D libraries like Ogre3d, Irrlicht etc. But they are too complicated for beginners.
Last edited on
So I took a look at the source. Some suggestions:

In line 6 of main.cpp, you are declaring GameOptions as a pointer.
That is not needed at all, declare a regular integer and pass the address of it in the menu() function call.
Also you can easily replace the goto in main.cpp with a while loop.
GOTOs are considered bad because they can create hard-to-understand or hard-to-debug code (also called "spaghetti code")

In game.cpp, you include conio.h, turns out you don't need that header at all!
Replace getch() with std::cin.get() and remove that file.
The code is still platform-dependent because you use system. See system makes the OS run those commands, different OSs have different commands available, so on Linux "cls" does not exist but replacing it with "clear" works.

I see that you've hardcoded the cup transistions, try and replace it with the help of loops.

And you seem to be using goto to skip a portion of code (for a random player ?).
That is a terrible, terrible idea. Just comment that block of code (/* .... */) !
@a k n

Thanks a LOT for trying out my game. Also thanks very much for your advice and looking at my code!

I used the goto to skip the if statements that would switch the cups depending on which cup the ball is in.

I tried to think of a way to use a loop to make the cup transitions but it was too complicated since I had to think about newlines, spaces, lots of conditions, etc.

How would I go about making it cross-platform? I used to use the Windows Sleep() function to pause but I used the chrono and thread library instead. But how to clear the screen a cross platform way? I'll use std::cin.get() from now on.

Again, thanks for being so helpful!
Last edited on
The only thing that's keeping your code from being cross-platform is the clear part.
All the other calls to system could be removed.

But for such a small thing, using a library like *curses would be too much, what you can do is create a function clear():
1
2
3
4
5
6
7
8
9
10
void clear()
{
    #if defined(_WIN32)
        system("cls");   //On windows, do this
    #elif defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
        system("clear");//On Linux/OS X/BSDs
    #else                   //For an unrecognized OS, just print 50 newlines
        for (int i = 0; i < 50; ++i) std::cout << std::endl;
    #endif
}


I used the goto to skip the if statements that would switch the cups depending on which cup the ball is in.

That is fine, but try not to use gotos in future projects, it'll save you some headaches ;)
Last edited on
@a k n

How does the #if defined(_WIN32) and other #if defines work?
They are preprocessor directives.
The section between #if and #elif will only be considered for compiling if the "_WIN32" macro has been defined and similar for the other two blocks, this is just like how header guards work (like in your functions.h).

Now different platforms generally have such definitions, eg. *nix systems define "__unix__" while Windows defines "_WIN32", we can use these to wrap platform dependent code.
@a k n

Thanks!
But using this wouldn't you need to compile on different platforms to make different programs for each platform?

What if you could detect which platform the program is running in at runtime? Then you could compile once and run on all the platforms it supports with one program.

One way I have in mind is to run commands (terminal) that are specifically Windows, Mac, Linux, etc. based. Since the system() function returns an int value of 0 if it succeeds and anything other than 0 if it fails, couldn't you check which platform the program is running on?

You could determine the platform by setting a variable based on those preprocessor directives, but it wouldn't be of much help. C++ is compiled into machine code with OS-specific calls and formatting. In this particular language, code that is "cross-platform" simply means it can be compiled on different platforms without need of modification.

Windows, Mac, and Linux also use completely different formats for compiled programs. Windows uses EXE files, Linux typically uses BIN (with the file execution bit set), and I'm not familiar with Mac. But an executable file compiled for one OS will not natively work on another.

If you want to write a truly cross-platform program - one that doesn't need to be compiled separately on each platform - consider writing your game in a higher-level language, such as Python or Java.
Last edited on
Pages: 12