Sign in to follow this  
JeromeIba

Making a "Game" using C: Where should I start?

Recommended Posts

Hi guys! I want to make a "game" using the language C. It's sort of a task that I was assigned to, but I have no prior knowledge in Game Programming so it's kinda bumming me out. There are lots of intricate details in the specification manual that I got which adds more stress :)) I've tried looking for tutorials in the internet, but I haven't seen one that would really help me so I came to this site (via friend recommendation).

So I'm asked to make this "game" wherein there is a walled environment (min size is 20 rows x 70 columns). So there is no real objective in this game. There are supposed to be 3 big blocks and then there is a character that is supposed to move in all directions (up, down, left, right, and diagonally). The user can generate food, and the user can also make that character eat the food. The user can make the character run (move 2x it's normal speed) and the user can also generate blocks, separate from those 3 blocks and the user can make the character move those blocks.

Another complicated thing is that the user should have the ability to change the character's color and the blocks beside it (Think of it as sort of like de Blob).

Soooooo, how do you guys suppose I start? Any help will be HIGHLY appreciated. Thank you and God Bless!


P.S. You guys can also reach me through:

chromium_salvation@yahoo.com
jerome_ibanez@dlsu.ph
jerome_ibanez@dlsu.edu.ph


Share this post


Link to post
Share on other sites
[font=arial, verdana, tahoma, sans-serif][size=2]Learn C. Separate the input, the displaying of information and the game logic as clearly as you can. If you encounter problems making progress, post more specific questions.[/size][/font]

Share this post


Link to post
Share on other sites
[quote name='Ecofina' timestamp='1311051116' post='4837207']
Use a game engine instead, like GameMaker. C sucks anyway.
[/quote]
At least C grants you a job in software industry unlike GM. ;)


Share this post


Link to post
Share on other sites
[quote name='Ecofina' timestamp='1311051116' post='4837207']
...C sucks anyway.
[/quote]

That's an interesting comment coming from an aspiring game developer. I guess this person has never heard of Unix, Quake, or John Carmack.

Share this post


Link to post
Share on other sites
Start by learning C, as already suggested, then make a smaller game first, I would say. A "guess the number" game maybe, just to get the "feel" for it.

Solving these tasks basically mean breaking down the problem. It's fairly easy with your game, if you are a bit more experienced.


First, you need to display something (maybe just "place holder" "graphics"), but it's important to see what you are doing. Display something, then hard code the maze (manually filling out an "array" in the source code), then display it.

Then, "make the character": a little block that you can move around with the keyboard for example (during game development, you will implement lots of stuff that will be totally dropped later, but you will need those temporary quickly-hacked stuff to be able to test your important functions/features).

Next (if I understand correctly), you will need to perform some kind of order mechanism: implement input (to be able to determine to which "tile" the character needs to move). Then implement movement to that tile (discard walls at this point)

Next (if I understand correctly), you will need to implement "path finding", to avoid and navigate between walls.

After that, all the other fancy stuff should be pretty straightforward.


So: this task is a bit out of reach if you are a total beginner, start with something simpler, then move on to this "project".

Share this post


Link to post
Share on other sites
Are you talking about making a DOS game?

If not, and working with only console application, then something you'll want to look into is how to clear the screen so that each new display is the only thing displayed.


EDIT: took out some bad information Edited by IggyT

Share this post


Link to post
Share on other sites
[quote name='IggyT' timestamp='1311064195' post='4837259']
Are you talking about making a DOS game?

If not, and working with only console application, then something you'll want to look into is how to clear the screen so that each new display is the only thing displayed. There are C libraries just for that that you'll want to look for.

[url="http://www.cplusplus.com/reference/clibrary/cstdlib/system/"]http://www.cplusplus...cstdlib/system/[/url]

system("cls");

Is the function I've used in the past to clear the screen in a windows console application. It's part of the cstdlib. I've meddled with console based games before but the most I've made is a card game for which I used system("cls");

That's the only tip I feel comfortable with giving at this point, and alvaro gave good advice on how to start thinking about your project.
[/quote]
No, please don't do that. -When you can, [url="http://www.cplusplus.com/forum/articles/11153/"]avoid using system calls[/url] like that. Also C++ libs != C libs.
Chcek out this great tutorial if you want to create a proper Windows platform-dependent console application: [url="http://www.adrianxw.dk/SoftwareSite/Consoles/Consoles1.html"]http://www.adrianxw..../Consoles1.html[/url]
(And native console applications are always platform dependant. -Creating your own console in your favourite cross-platform graphics library is a possibility for platform independence...)

Share this post


Link to post
Share on other sites
Thanks for the links guys!

By the way, I know how to use C, but like what I've said, I'm a total beginner :D

So how do you guys suppose i make the border of the game?

@Iggyt: Yep, I've thought of doing it like that, similar to those old text based RPGs.

Share this post


Link to post
Share on other sites
If in the console you can use a simple

char map[20][70]; //array

And then use loops to set the outlying borders. Then a simple collision check would be to see when the character moves if that next space is whatever you use for borders, and if it is then -1 from his current location after you calculated that movement so that he's not inside the border before you display.

alternatively you can set the borders at the declaration of the array, too.

@SuperVGA ...huh, I had no idea they were so messy. I received the code from a friend that had been using it a while and blindly trusted it, thanks for the link.

Share this post


Link to post
Share on other sites
[quote name='Ecofina' timestamp='1311051116' post='4837207']
Use a game engine instead, like GameMaker. C sucks anyway.
[/quote]


You can do a lot more in C than you can do in game maker. Anyway, keep going with C. It's a good script to use. I C++, but I'm not suggesting to use it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this