Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,485 members, 7,819,760 topics. Date: Monday, 06 May 2024 at 10:33 PM

What Do I Do? - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / What Do I Do? (1045 Views)

(2) (3) (4)

(1) (Reply) (Go Down)

What Do I Do? by gameaddict(m): 11:53pm On Oct 03, 2009
I've been learning C++ and java on my own for about three months and all the while loving it. It's difficult learning these languages at the same time so i create space sometimes and usually dedicate a few days of the week to a particular programming language. It has helped me a lot and i've sometimes been able to identify important differences that would surely be important when i decide to use any language for any task.

Now the real issue is that although i am getting a good grasp of both languages, i haven't been able to create anything yet except a few simple programs which are sometimes exercises from the textbooks i use. I would like someone to advise me on books to find simple examples, exercises and tutorials on this languages especially based on games to broaden my knowledge and skills. I would prefer text based games for now unless you can give me a good reason to dive into learning about any graphic library right now(note i'm not very good yet).  grin

I would also like to meet other programmers(both beginners and experts alike) especially those into game programming to gain knowledge and know the way forward in Nigeria. Although i am not learning this at school(i'm reading economics), i am  very determined and open to any suggestion and criticism.  grin

/*-- about 2 years later: the secret plan now hidden---*/ I expecting your replies.  grin
Re: What Do I Do? by Nobody: 5:56pm On Oct 04, 2009
jumpin into gaming is a bit too soon.best bet is to start with simple 2d.there are many tuts online.and dueal cud help me.
Re: What Do I Do? by gameaddict(m): 1:25am On Oct 06, 2009
I am doing any serious game coding yet, so i dont do any graphic. The games i'm trying to create for now are text based adventures. I am doing this because i'm sure it will help me learn to control my programs better and give me a good grasp of the various topics because i'm trying to implement what i learn from every topic. Please help me get links to tutorials related to text based games to aid me. Thanks.
Re: What Do I Do? by dueal(m): 4:42pm On Oct 10, 2009
@gameaddict. Good thing you are learning C++ and 'Java' as your first programming languages. As pc_guru rightly stated, it's a bit too soon to try your hands on game programming even if it's just text based, I'll advice you stick with learning C++/Java and once you have gotten to a certain piont where you live and breath the language and programming, then you can jump to creating what ever program you mind can think of. It takes time an practise.Keep coding.
Re: What Do I Do? by segsalerty(m): 5:15pm On Oct 10, 2009
Nice Determination ,
Just keep on ! dont stop ! dont let anything/ anyone depress / discourage u in anyway !
keep looking at where u wanna be and keep working towards it ,
Discover yourself and discover ur personal way of learning !
what works for u might not work for me and vice versa.
Good luck bro
Re: What Do I Do? by gameaddict(m): 2:37am On Oct 11, 2009
Thanks guys, i really appreciate your help.
One more thing, Could you direct me to any good place in lagos where i can get new programming books(i'm tired of ebooks. My eyes are beginning to hurt) just in case i happen to have any money while passing by. I recently passed through yaba market but didn't know any good places. In my haste to get home i found a roadside bookseller who suggested getting me a few books. I bought the black art of java game programming from him and told him i'd buy the deitel c++ book if i passed by which is next wednesday. I got home and discovered that the book was a few years old(real old. It was based on jdk 1 .0.2) and examples it used contained some deprecated methods. Moreover, the cd containing some source codes was missing. Gosh.
Re: What Do I Do? by sweetpawn2: 8:44am On Oct 19, 2009
gameaddict!
Seems you and I have many things in common!
Like you I went into programming because of games.
I wrote my first game in qbasic and perfected it much later with visual basic.
My latest game project is an online chess game for which I developed a website to download the game @ www.chessmate.tk
You can check it out some time.
Now,in my time,there was no google but I did what I had to do.
You dont need 100 text books to build a game. You need your ideas and good algorithms. . .
Re: What Do I Do? by sweetpawn2: 8:58am On Oct 19, 2009
The code is simply a tool used to implement your algorithm, just as words are tools that mirror our thoughts. So you dont have to learn the whole coding vocabulary to write a good program much in the same way a child can talk sense with out having a masters degree in english.
If you know your if statements,for loops, variables and string manipulation dude, we can start a text based game right now!
Let me be your tutorial and material !
If you agree to that, we will make your first text based game. . .
Re: What Do I Do? by sweetpawn2: 9:04am On Oct 19, 2009
. . .
Re: What Do I Do? by sweetpawn2: 9:04am On Oct 19, 2009
We will use c++ as the language.
Do you have any game in mind. If so post about it so we can see how we'll make an algorithm for it and code it.
If not, I have a couple of games we can design.

I will be waiting for your response my potential game developer to-be !
Re: What Do I Do? by gameaddict(m): 7:44am On Oct 23, 2009
@ sweet_pawn
I'm sorry i did not reply earlier.
I just got into unilag's diploma programme and i'm currently being bombarded with lectures but thanks for the posts. Time isn't on my side right now as i'm yet to find accomodation and settle into the enviroment.
Anyway, my email is redacted_@gmail.com. Please send me yours cuz i'd like to learn from you.
PS: A few weeks back, i was making a prototype battle function for the text based adventure i was making but when i used the c++ rand() in it, i notice the outcome was the same each time i ran the program. Is there any solution to it and how can i make the program sleep for a few secs before printing each output?
Thanks again.
Re: What Do I Do? by sweetpawn2: 9:51am On Oct 23, 2009
hi gameaddy,
I will send you my mail.
I see you have got some project going on and it sounds interesting! You could mail me the details of what the games all about.
Now lets tackle your problems,
Re: What Do I Do? by sweetpawn2: 9:52am On Oct 23, 2009
To create random numbers every time you run:
#include< time.h >
srand(unsigned(time(NULL)))
//the above code and include will allow you to generate new random numbers when you use the rand function. . .
Re: What Do I Do? by sweetpawn2: 9:52am On Oct 23, 2009
To delay your program:
#include(windows.h)
// add the above include
Sleep(1000)
// add the line above to where you want the delay to start. This will delay for 1 sec
Re: What Do I Do? by sweetpawn2: 9:53am On Oct 23, 2009
. . .
Re: What Do I Do? by sweetpawn2: 10:03am On Oct 23, 2009
. . .
Re: What Do I Do? by sweetpawn2: 10:03am On Oct 23, 2009
. . .
Re: What Do I Do? by gameaddict(m): 2:27am On Oct 24, 2009
Thanks for the suggestions.
The sleep() worked fine but i used some variables and a formula to create a limit of 1 to 10 for the rand() cuz i wanted to use it to determine turns for first attack and also if the cpu dodges or is hit by the attack. I'll make sure i post it from my PC later(currently posting from mobile).
Thanks.
Re: What Do I Do? by Lovegame: 3:03am On Oct 24, 2009
java is system independent language but is a little heavy because it uses
java virtual machine to run on
web applications are small and had to be supported on multiple OS
so java is used

c++ although platform dependent uses Little system resources
games run many programs at a time so they are made in c++
if they would be made in java they would have required a lot of ram and CPU resources

see it really depends on the platform you are using
for eg.if you are making a game for a console like PS3,XBOX 360 or Wii
memory is limited they have ram in range of 256-512 MB
so c/c++ is used and java is avoided

for computer games where ram is available in plenty say 2GB
many online games are java based (also consider they are focused on all browsers and operating systems)

java games are also common on mobiles because in this field there are many architectures many operating systems
so to have maximum profit application are made in java so it can be played on most models although these applications are terribly slow

here a nseries or s60 platform phones give an edge
because 25% of world phones are powered by s60 devices NOKIA provides s60 platform with carbide c++
making these devices run c++ applications based on arm processor architecture that perform faster than java applications
c++ applications are 60-80% faster and use 40-60% less ram!!




visit www.naijavine.com, your sure money nigeria social bookmarking and blogging
Re: What Do I Do? by Lovegame: 3:07am On Oct 24, 2009
java is system independent language but is a little heavy because it uses
java virtual machine to run on
web applications are small and had to be supported on multiple OS
so java is used

c++ although platform dependent uses Little system resources
games run many programs at a time so they are made in c++
if they would be made in java they would have required a lot of ram and CPU resources

see it really depends on the platform you are using
for eg.if you are making a game for a console like PS3,XBOX 360 or Wii
memory is limited they have ram in range of 256-512 MB
so c/c++ is used and java is avoided

for computer games where ram is available in plenty say 2GB
many online games are java based (also consider they are focused on all browsers and operating systems)

java games are also common on mobiles because in this field there are many architectures many operating systems
so to have maximum profit application are made in java so it can be played on most models although these applications are terribly slow

here a nseries or s60 platform phones give an edge
because 25% of world phones are powered by s60 devices NOKIA provides s60 platform with carbide c++
making these devices run c++ applications based on arm processor architecture that perform faster than java applications
c++ applications are 60-80% faster and use 40-60% less ram!!




visit www.naijavine.com,  your sure money nigeria social bookmarking and blogging
Re: What Do I Do? by Kobojunkie: 4:28am On Oct 24, 2009
@Poster, spend more time honing your algorithm skills. I happen to be working myself on creating more complex applications but figured out early that it is all about bettering one's ability to handle algorithms and I am not talking simple but very complex, mathematical cases. So, work on your math skills as you learn or you will find that all the simple chess games and ludo games no longer accepted as talent games in months to come.
Re: What Do I Do? by aquastar(m): 2:59pm On Oct 24, 2009
Your can read Killer Game programming in Java but that is after you are comfortable in the java language itself
Re: What Do I Do? by gameaddict(m): 5:00pm On Oct 31, 2009
Thanks guys.
This is the test version battle function. I added the class and the main function so anyone could test it. Its not well documented yet but i hope you understand it.
Note: attack and defence are not used. health is the only integer i initialised and I use Dev c++.

Also note: I used SorD to determine if the attack is parried or attack suceeds

Please comment on the function and if you wish to suggest any modifications please do.



#include <iostream>
#include <cstdlib>
#include "windows.h"

using namespace std;

class Character
{ public:
Character(int h=100, int a=50, int d=50) { health = h; attack = a; defence = d;}
int health, attack, defence;
};

Character me, enemy;

int battle(int &x, int &y){
while(x !=0 || y !=0){
Sleep(1000);
cout <<"\n your health = "<<x<<", Enemy health = "<<y;
int min = 1, max = 11, range = max - min + 1;
int firstBlow = rand()/100%range + min; //first attack and subsequent attacks;
int SorD = rand()/100%range+min; // if the attack suceeds or is defended;
if(firstBlow <= 1 || firstBlow >= 5 ){
Sleep(1000);
cout<< "\n You attack!"<<endl;
if(SorD <= 1 || SorD <= 6){
Sleep(1000);
cout << " You hit!"<<endl; y -= 20;
Sleep(1000);
cout<<" Enemy Health = " << y <<endl;
Sleep(1000);
cout<<" Your health = "<<x<<", Enemy health = "<<y<<endl;
if(y <= 0) break;}
else if(SorD <= 7 || SorD <= 11){ Sleep(1000); cout<<"\n Enemy parries!"<<endl; }}
else if(firstBlow <=6 || firstBlow >= 11){Sleep(1000); cout<<"\n Enemy attacks!"<<endl;
if(SorD >= 1 || SorD <= 6){
Sleep(1000);
cout << " Enemy hits"<<endl; x -= 20;
Sleep(1000);
cout<<" Your health = " <<x<<endl;
Sleep(1000);
cout<<" Your health = "<<x<<", CPU health = "<<y<<endl;
if(x <= 0) break;}
else if(SorD >= 7 || SorD <= 11){ Sleep(1000); cout<<"\n you parry the attack!"<<endl;}}
//while;
}
if(y <= 0){
cout<<"\n Enemy stamina = "<<y; return 1;}
if(x <= 0){
cout<<"\n Your Stamina = "<<x; return 2;}
}



int main()
{
while(true){
cout<< "\n Do you want to fight? (y or n)";
char decision;
cin>>decision;
if(decision == 'y' || decision == 'Y'){
cout<< "\n You decided to fight get ready!"<<endl;
system("PAUSE"wink;
int outcome = battle(me.health, enemy.health);
if(outcome == 1){cout<<"\n You win!";
cout<<" enemy health = "<< enemy.health<<endl;}
if(outcome == 2){cout<< " \n your stamina is finished , cpu wins!"<<endl;
cout<<"\n Thanks for playing.";}
char play;
cout<<"\n continue? (y or n): ";
cin>>play;
if( play == 'y' or play == 'Y'){
enemy.health = 100; me.health = 100;}
else{cout<<"\n Goodbye!"<<endl;
system("PAUSE"wink;
exit(0);}}
if(decision == 'n'){
cout<<"\n Goodbye!"<<endl;
system("PAUSE"wink;
exit(0);}
}
}
Re: What Do I Do? by joyblinks(f): 7:46am On Nov 02, 2009
@sweet_pawn

Please can i have your mail address? will need to share some words with you.
Re: What Do I Do? by sweetpawn2: 8:06am On Nov 02, 2009
info@chessmate.tk
Re: What Do I Do? by gameaddict(m): 12:18pm On Nov 03, 2009
Hey guys!

Anyone checked the codes yet? patiently waiting, grin

(1) (Reply)

Useless Thread: Don't Open / Pls I Need Career Guide / Newer

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 53
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.