Be a Supporter!
Response to: C++ Structs,arrays,fs tream Help Posted December 3rd, 2009 in Programming

At 11/25/09 11:40 AM, kiwi-kiwi wrote:
At 11/25/09 11:16 AM, liaaaam wrote:
At 11/25/09 08:13 AM, kiwi-kiwi wrote: This works, have fun
Have fun making games -this is here because I forgot about the first one while coding
I'm sure the guy didn't want someone to just give him the answer, he probably wants to learn how to do it for himself. Even if he did just want a copy & paste answer, it's not a good idea to give that to anyone :3
Meh, I got bored today and I wanted to do something quick
Also I chose to give a straight answer because OP seems to have an actual interest in programming and doesn't just want to copy code, so I thought it would be a good exercise for him to try to decipher my code without any documentation ( which is sort of the reason I told him to have fun )

I have a GREAT interest in programming. I want to work in the video game industry and I'm currently working on my BA in Computer Science. I usually hate copying and pasting code, no matter how desperate I am, and this helped me greatly. I did go back and try to understand it, and I must say I have a better grasp of the concepts involved in this function.

I hate to say that I failed the project due to time constraints (my fault entirely), but I plan on making a few text based games next semester and over the summer to keep up my skills. I'm thinking of learning Actionscript 3 as well. The Flixel Game Contest Tom just posted about seems like the perfect opportunity to attempt something challenging and learn from it.

Thanks to everyone in the thread that helped me out. You guys are life savers!!!

C++ Structs,arrays,fs tream Help

Response to: C++ Structs,arrays,fs tream Help Posted November 25th, 2009 in Programming

I realize I am probably not providing enough information for anyone to help me. Let me try again.

I have to take this data file

5
0 1 3 2 4 2 0
1 0 0 0 0 0 3
3 0 0 0 0 0 1
2 0 0 0 0 0 3
2 0 0 0 0 0 3
4 0 0 0 0 0 2
0 3 2 2 1 2 0

and put it into a game board that has been written for us. We were also given a struct defintion (posted below) which is used in many of the functions.

struct Cell
{
	int number;     
	bool permanent;  
};

After searching Google for many hours, looking at my Professor's lecture slides, and drinking another cup of coffee...I re-wrote the function to look a hell-of-a-lot cleaner and easier to pin-point the error.

void readIntFile(ifstream& ins, Cell board[BOARD_SIZE][BOARD_SIZE], int& numTowers){
	Cell val;
	string junk;
	ins.clear();
	ins >> val.number;
	numTowers = val.number;
	for(int i = 0;i < numTowers + 2;i++){
		for(int j = 0 ; j < numTowers + 2 ; j++){
			ins >> board[i][j].number;
		}
		getline(ins,junk);
	}
}

I have found the error, but still have no idea how to fix it. The file is not reading the 5 in the first line of the data file, so everything is getting screwed up.
When testing, I made numTowers = 5 and the board looked....well...horrible. The file was also not reading any integer values into the 2d Array. All values were set to the lowest negative number possible instead of the values in the table.

Again, any help would be appreciated. I hate double posting...

Thanks in advance

dirtshake
Response to: C++ Structs,arrays,fs tream Help Posted November 25th, 2009 in Programming

Well shit...I have new problem and I can't find the answer anywhere on Google. I really suck at file streams.

void readIntFile(ifstream& ins, Cell board[BOARD_SIZE][BOARD_SIZE], int& numTowers){
	Cell val;
	string line;
	val.number = 0;
	int rowNumber = 0;
	int colNumber = 0;
	ins.clear();
	while(!ins.bad()){
		ins >> numTowers;
		for(rowNumber; rowNumber < numTowers + 2; rowNumber++){
				for(colNumber; colNumber < numTowers + 2; colNumber++){
					ins >> val.number;
					board[rowNumber][colNumber] = val;
			}
				getline(ins,line);
		}
		break;
	}
}

Slightly different code than before. I've located the error, but I'm not sure how to fix it. The error occurs when the file reads into numTowers.

ins >> numTowers;

Then it stops running the function and never makes it to the loop.

The data file I am reading from has one integer value on the first line, which determines how many times the loop executes. The remaining lines have integer values arranged in a grid.

For example :

5
1 2 3 4 5
4 5 2 4 1
2 4 3 5 1

etc etc

Can anyone help me and explain to me why this is happening????

Thanks in advance.

Response to: Were can i learn c++? Posted November 24th, 2009 in Programming

Follow the advice everyone above has given. Google many tutorials and do them all. Make a goal of completing a tutorial until you understand the concepts being taught, not just the code. Then find another one and do the same. Then another one. And Another. Do it, even you if you end up repeating the same concepts five or more times. It may seem tedious and boring, but it will help your understanding of the language.

Eventually find some simply programming problems and do them, without any help from any tutorial. Try to design a solution and implement it. Work through your problems, bugs, whatever. When you can complete simple problems on your own, you will have succeeded in learning the basics.

A good book would help as well. Look around for a good one. I recommend reading the reviews on gamedev. I found a good book there.

Honeslty though, the best way would be to take an introduction course after you've made a small headway. That's what I did before taking my first class, and it helped a lot.

Basically, do as much as you can on your own, but if you get the chance to take a class than take it.

Good luck. It's a long, hard journey. But it's a rewarding one.

Response to: Treasure Hunt 2009 Results Part 10 Posted November 20th, 2009 in NG News

At 11/20/09 11:35 AM, TomFulp wrote: New in the store: Kenstar t-shirt! Ya know, from Girlchan.

We are no longer selling the Dad 'n Me hood & plush combo but we're selling the remaining plush kids for $35 each. These were hand-made by Nathan and the money funds his ongoing documentary!

OOoooooOOOO

More items to add to my list of Newgrounds stuff to buy. $35 dollars for the plush is more reasonable for me, since I bought the Alien Hominid plush (which is epic btw). Perhaps after Christmas I'll order one to support Nathan. When is that thing coming out anyways????

Response to: Computer Science Crew Posted November 20th, 2009 in Clubs & Crews

I am VERY glad I stumbled on this crew!

I havn't read through the entire thread yet but I plan on it in the next few days.

I guess I'll just post some information about myself.

I'm a freshman at the University of Michigan and I'm currently planning on declaring as a Computer Science major. I'm currently taking one programming class called EECS (Electrical Engineering & Computer Science) 183 : Introduction to C++ Programming. I love it.

The course is very fast paced and intense, but the support from our Professor and GSI's is amazing. On day 1 we started out with "What The Hell Is Programming?" and we just finished learning about structs and classes. We have also completed 5 projects and working on a 6ht, which is a knock-off/variation of sudoku and is a bitch to program, but still fun to attempt.

Though I'm currently earning an estimated C in the class, I have learned a large quantity of material and I am confident in m abilities, limited as they are, to make basic programs, or at least design them. Just as how I started to look at animations and analyze how the artist made it when I started animating, I now do the same with programming when someone asks, "How does this work?" and I do my best to explain how I would do it, even if I have no idea how to implement it. Basically what I'm saying is that I LOVE the subject matter and material, even though I hate the late-nights and dozens of Red Bulls in my recycling bin.

My plan is to get a Master's Degree in Computer Science or something related and try to pursue a goal in the Video Game industry as a programmer of some sorts.

My personal goal is to learn a new language over the Winter Semester or Summer. Perhaps Actionscript 3.0 or Java. Ionno, I just want to continue to learn as many languages as possible.

Again I'm extremely excited to have come across this group and I plan on staying.

Response to: C++ Structs,arrays,fs tream Help Posted November 20th, 2009 in Programming

At 11/20/09 04:15 AM, liaaaam wrote: a very helpful post

THANK YOU and yeah...I'm an idiot. Should have realized this sooner. >_<

I took your idea and started from scratch. The code works now and I've been able to move on to other functions.

Thanks again!

C++ Structs,arrays,fs tream Help Posted November 20th, 2009 in Programming

I have an issue that involves many concepts that I think I understand, but am having trouble with when combined together into one very large problem.

I am working on making a game for my EECS 183 class where you have to read in a file of integers in a grid form and put them into a game board that is basically a matrix.

The program has already been designed for us by our professor so the only thing we have to do is implement them, so I can't change the design.

Already defined for us in the header file is a struct. I'll post it below.

struct Cell
{
	int number;      // If number is 0, the square is not occupied.
	bool permanent;  // the border values
};

The function I am having trouble with involves reading the ints from the file into the game board, which is basically a sudoku board (but the game isn't sudoku).

The function takes in the ifstream variable called ins, and array called board that is of type Cell, and another int variable.

To handle the task at hand I have the file read the first int of the file (which determines the size of the board) into a variable, then use that variable in two for loops which controls how the remaining integers are read into the matrix.

void readIntFile(ifstream& ins, Cell board[BOARD_SIZE][BOARD_SIZE], int& numTowers){
	string junk;
	int boardSize;
	ins >> boardSize;
	for (int i = 0;i < boardSize + 2;i++){
		for(int j = 0; j < boardSize + 2;j++){
			ins >> board.number;
			board[i][j] = board.number;
		}
		getline(ins,junk);
	}
}

I think my problem has to do with how it is assigning the integers into the array, but I havn't been able to find a solution to my problem on google, or on here.

Any help would be greatly appreciated.

I hope this formats correctly.
Response to: I don't care about college. Posted November 18th, 2009 in General

College is worth it depending on what you want to do in life. Many of the adults I have known growing up went to college and graduate school (law/medical) and they all say it was worth it due to the better jobs, more freedom in choosing when and how to work, and for the personal development they received from the experience, even if 25% of the classes they took had nothing to do with what their current careers.

I also know many adults who never went to college, and are extremely smart when it comes to life and have great lives. It all depends on your life plan I guess, but that is where the choice is made.

Having a life plan, even a rough one, is essential in deciding where, if, and when one is going to college. The thing is, many don't know, or even can't know, about their so-called plan without getting their foot in the door. Someone above stated going to a community college for a year or two to see what the big deal is, and I think that is the best choice for someone who isn't quite sure of themselves yet.

On a personal note, I'm currently in my first semester of college and I have VERY mixed feelings on it. The workload is intense and am getting the worse grades I have ever received in my life. I wake up depressed some days knowing that I have 20 hours of work to do in only one day, and that even if I somehow complete it all I will still be behind somehow, someway.
But at the same time, some of the things I'm learning about greatly interest me. I am probably getting a C in my Intro to C++ class, which provides me with the bulk of my stress, but I love it because it is what I want to do as a career.
I also have opportunities that I never would have gotten if I had never come to college, and probably will never get again. I get to work in a very prestigious museum working with some of the brightest minds in paleontology studying mammoth and mastodon fossils, including TOUCHING actual fossils. It's a nerdy orgasm for me.
Plus the social experiences and personal development are worth the depression and hard work.

So really...it's a trade-off. The key is having an idea of what you want to do in life before you make any rash or important decisions.

Though it does suck when the most winningnest college football teams has another shitty season....and you bought season tickets.... >:(
Response to: Modern Warfare 2 "No Russian"? Posted November 15th, 2009 in Video Games

The first time I even saw that mission was when I was playing with my brother. We took turns during each level, and I got stuck with that one. Our first thoughts were...

"ARE YOU FUCKING SERIOUS!!!!"

We kept yelling that the entire level. I just walked behind the terrorists, never shooting or killing anyone until the cops came (because at that point you don't have much of a choice).

The realism was scary as shit. The most chilling part was when I came across a bloody teddy bear next to some man's body. I got sick to my stomach. Thank god no children were present at that level, but the implication that there were was bad enough. Children present would have been....too bad to handle.

I've only played that mission twice, the second time I did shoot people. The first time was for the shock value, and the message that terrorism is real and fucking scary. InifinityWard definitely took a risk with this level to tell a story and a message, and I applaud them for it. Putting yourself in the gunman's shoes tells the story in a better way than if you had been a civilian.

The second time I was over the shock, and had to go back to saying that this is just a video game. I had received the message and understood it. Now I could just go about killing.

In a way...it only enforced the message. With every kill I felt more guilty.

Response to: "Prayer" by Disturbed - Collab! Posted November 12th, 2009 in Game Development

At 11/9/09 07:46 PM, ShortMonkey wrote: I'm thinking of doing Iris by Goo Goo Dolls. What do you guys think?

I think if you start it up send me a PM. I'd gladly take a few parts in it.

At 11/9/09 11:55 PM, RazorHawk wrote: If I did a song collab, I would do Fort Minor - Right Now and have people stick to the lyrics while giving it a very urban/inner city kind of theme. Only thing is I'm not sure if I meet the requirements to host a collab.

Send me a PM as well if you do this. I'd love to work on this one as well.

My inbox is always open. :D

Response to: "Prayer" by Disturbed - Collab! Posted November 8th, 2009 in Game Development

Sweet. Glad it's finally in the portal!!!!

Just voted on it.

Voted 5 with my 5.69 voting power.
3.85 / 5.00 (+ 0.0087)

I think we'll get Daily Feature, at least I hope so. It would be nice, but even if it doesn't make it I'm glad we finally got it in the portal.

And yah, the reviews about the story don't make sense to me either. They're things to keep in mind though for future collabs. I guess what people wanted was something with a common theme, but hey, I like how we did it.

I'm glad I was able to work with everyone involved in this collab, and I would gladly work with all of you again in the future. If any of you ever start a collab just let me know. I would love to join. Especially you ShortMonkey. You did a fantastic job organizing this.

Response to: "Prayer" by Disturbed - Collab! Posted November 7th, 2009 in Game Development

At 11/7/09 09:48 AM, YoinK wrote: I can submit up to 15 MB to the portal... but shit... I hope somebody responds...

Why can you do this???

What about the images on the blurbs pages? Is there any way to compress them further or make them a different format, such as a .png???
Same goes if anyone used any images in their parts.

Response to: "Prayer" by Disturbed - Collab! Posted November 6th, 2009 in Game Development

At 11/5/09 09:20 PM, ShortMonkey wrote: http://www.megaupload.com/?d=A9XJD0EL

SEXY!!! I love it. I seriously do. I did notice that my name isn't on some of my parts, but I can live with it. The rest of the collab looks AWESOME!!! save for some black bars that randomly pop up. I can't tell if those are intentional or not...so if they are great. It not...ruh-row.

The credits are done great as well. It fits in with the music and is very stylish compared to other movies and collabs. Excellent choice with that decision. Perhaps it will set a trend for future music based collabs.

At 11/6/09 11:17 AM, OnyxCross wrote: If you have any other collabs coming up, ring meh ;)

Same here.

Response to: "Prayer" by Disturbed - Collab! Posted November 2nd, 2009 in Game Development

At 11/2/09 01:30 AM, ShortMonkey wrote: I was able to compress it to 21.5 meg.

The Street Fighter Collab was roughly 28 megs, so Tom should allow it, especially since you compressed it from 30 megs to 21.

I really hope your internet gets better. I feel as if the fates are conspiring to keep this thing off Newgrounds. It'll get on eventually though, I have high hopes.

Response to: Happy Halloween! and Poster Pack Posted November 1st, 2009 in NG News

YES!!! I love all those images by Utah and will gladly hang them on my wall sometime this month.

Great deal too.

Response to: "Prayer" by Disturbed - Collab! Posted November 1st, 2009 in Game Development

At 11/1/09 10:17 PM, ShortMonkey wrote: So, here's the deal. The final file... it's over 30 meg!

Holy shit!!! O_O

When the preview is posted I'll go through and capture some images for the sigs. Or to help me out, if anyone wants to email me they're favorite images from they're parts just PM me and I'll give you my email address.

I'll try to get those done this week.

Response to: "Prayer" by Disturbed - Collab! Posted October 30th, 2009 in Game Development

Yoink's post made me think of ways we can help advertise the collab once it's out. The most obvious way is in our sigs, both in text and the picture. How does everyone feel about changing their sig pics to some type of image that represents the collab the day (maybe the moment) it is submitted? Just for a week or two. I feel it will get a lot of exposure that way.

And if we do that, venture into some forums and post on some topics (NOT SPAM). Find a topic, contribute a meaningful post, and if we're lucky someone will look at your flashy sig and think, "Hey, I like Disturbed" or "Wonder what that is?" or "Oh shit I didn't mean to click that...but cool anyways".

ShortMonkey : If you like this idea I could make some type of image to represent the collab. Possibly a still image of the best parts with the Disturbed logo, or the pre-loader logo, or something similar mixed in and send it to anyone who wants it.

For an example, see my sig below. Something like that, but more eye-catching.

eh EH???
Response to: How far are you in Pre-Calc/Trig? Posted October 30th, 2009 in General

At 10/29/09 11:19 PM, liaaaam wrote: If you're that bothered by it, I strongly suggest reading up on it yourself.. self-learning is much more beneficial than learning through a teacher

I agree with liaaaam on this completely. This problem does not go away once you're out of highschool. In college, even in the top universities, math classes are harder and finding a good professor, GSI (Graduate Student Instructor), TA (Teaching Assistant) or other staff is difficult.

For example, I'm in Calc II (MATH 116 for you University of Michigan folks) and my GSI teaches by reading straight out of the textbook and solving the examples wrong. When he writes a quiz he has no idea how difficult it is and more times than not can not solve the problem he wrote. On the rare occasion he can solve it, it takes him an hour...for a ten minute quiz problem.

My advice to the OP and anyone else in a hard class (especially the mathematics and sciences), learn how to learn independently. One good step is to learn good Googling skills. It is a lifesaver in tough binds. If you are able to learn this early than you will be better prepared to succeed in horrible situations.

Response to: "Prayer" by Disturbed - Collab! Posted October 29th, 2009 in Game Development

At 10/28/09 11:13 PM, ShortMonkey wrote: If anyone knows a short word that means "comments" or something similar, please post it here!

What about "blurbs"?

Response to: "Prayer" by Disturbed - Collab! Posted October 27th, 2009 in Game Development

Damn...some epicness occurred in the past few days. Glad to hear everything worked out after it all broke. Any guess when it will be in the portal ( and when we can all log on at the same time and vote 5 ) lol

If it's a question of bios, how many are needed? Maybe you should send out PM's to everyone and say "Have you're bios in in a week" or some deadline, otherwise you can just write something nice about everyone. :)

Response to: "Prayer" by Disturbed - Collab! Posted October 26th, 2009 in Game Development

At 10/25/09 05:21 PM, PinkSkull wrote: There shouldnt be a play button in the preloader, once it loads it should automatically go to the menu, there is already a play button there...

I agree with this. However to show off the sexy background of the pre-loader a bit longer it should fade to black before the opening menu animation starts up. Maybe a 3 - 5 second fade out.

The collab is stylish, the menu is VERY stylish, so we should make everything as stylish as we can.

My girlfriend thinks the menu is one of the best she's seen on Newgrounds and LOVES the collab already. We can't disappoint her now can we???
:)

Response to: Ben Spurgin, 1977-2009 Posted October 23rd, 2009 in NG News

Damn...that's sad. My respects go out to him and his family. Pimps Quest was one of the first games that I played on Newgrounds, probably one of the things that kept me coming back since I beat that game over a dozen times. Rest in peace Ben. We'll miss you.

I agree with a memorial page as well.

Response to: "Prayer" by Disturbed - Collab! Posted October 23rd, 2009 in Game Development

At 10/22/09 11:42 PM, ShortMonkey wrote: OMG! SEND ME THE .FLA!!!!

I was going to, but I deleted it after you said no shit animation. I r sad....

At 10/23/09 01:57 AM, LongLongCat wrote: http://spamtheweb.com/ul/upload/3309/501 74_test.php

Wow. That's awesome. The first few seconds are the best. I feel the energy of the song and him getting...charged...or something. Nice job.

At 10/23/09 10:19 AM, ShortMonkey wrote: Still needs a few fixes, but getting there.

WOAH WOAH WOAH!!! That kicks ass! Seeing everything together is awesome after over a year of work. I can't wait to see the final product. One thing though....I don't think you added my name to my parts like you said you would. No big deal. Just noticed it.

At 10/23/09 10:22 AM, ShortMonkey wrote: Also, can everyone on this list add me as a flash buddy?

You've been added. HOORAY!!!!

At 10/23/09 10:25 AM, SupraAddict wrote: Sonofabitch! I can't compete with such talent! Did you see how well he gave such an intense
expression!? I bet Adam Phillips would have shit a brick.

Adam Phillips did shit bricks. I showed him a while ago and he now worships me.

SO KIDDING SO KIDDING!!!!! O_O
Response to: "Prayer" by Disturbed - Collab! Posted October 22nd, 2009 in Game Development

At 10/22/09 09:11 PM, ShortMonkey wrote: Because this is a collab, all animation styles are welcome (obviously)... except shit ones. So just do what you want as long as it looks good.

Damn...and I was about to replace my part with this.

Response to: "Prayer" by Disturbed - Collab! Posted October 20th, 2009 in Game Development

At 10/20/09 02:10 AM, RazorHawk wrote: Alright, since we're waiting anyway, I decided to give doing the preloader a shot. Let me know what you think of this and if there should be anything else done with it.

Preloader

Wow. That kicks ass! Beautiful and scary in a way. I love it!

Response to: Newgrounds Contest - Free Wings Posted October 20th, 2009 in General

When did you first learn about Newgrounds?

I first learned about Newgrounds in 7th or 8th grade by my friend Joel, so that was roughly in 2003 or 2004.

What do you most enjoy about the site?

The huge community of extremely creative and talented people who make this site amazing. Over the past year I've become more involved in collaborations and projects and the results are more often than not positive. Newgrounds does a fantastic job of making one feel a part of something larger and valued, especially if they come with a positive attitude. This is truly the greatest communities on the web for artistic expression.

Given one day at the reins of the site, what would you change, what would you fix?

First I would change the reviews to include whether or not the artist felt the review was helpful or not. Too many reviews are judged on popularity right now, so it would be good for the author of a review to receive some honest feedback.

Next I would make badges for front page submissions, whether they be audio,flash, or art. Right now the art portal has front page badges, but nothing else.

Then I would allow the the authors of submissions to create a custom collaboration title. Sometimes you just want something special. Obviously this could be abused, so a system would have to be put in place to make sure things such as "cock sucker" aren't thrown in. One option might be a page where the community can create their own titles and those would be added to the permanent list.

I would update the Lit sections, especially the "About Newgrounds", to reflect on the most recent activity of the site. Sometimes it is fun to read about the site we love, but it is frustrating when it doesn't include the past couple years. I would also create an interactive office tour. Many of us wonder what it looks like and only a detailed tour would do it justice.

Finally I would add a Black Button skin option. They are just sexy.

Obviously this would be a 24 hour work day with no distractions. :)

Is there anything you miss, that you'd like to see back? (I.E. Old Blam/Save Animations)

Not really. I love everything Newgrounds has done and I just hope it keeps moving forward and moves in the same direction it always has.

Response to: "Prayer" by Disturbed - Collab! Posted October 19th, 2009 in Game Development

At 10/19/09 05:20 AM, MrRandomist wrote: Pre-Loader

I like everything but the guy headbanging. The simplicity of it makes it feel like a tack-on to a greater product. Also, it should probably say "Disturbed" somewhere near the title.

Other than that I like it. Nice job.

Response to: "Prayer" by Disturbed - Collab! Posted October 15th, 2009 in Game Development

At 10/15/09 01:35 AM, YoinK wrote: ehhh... I hate spam.. spam can be annoying. I left a comment on his newest blog post though... I hope he sends his part. That part looked badass with the fire hands.

I left one as well. Hopefully he sees it. :)

Anyway.. we're 98% complete now!!!! :)

That is sexy. However, it could be more sexy if a certain part turns green.

Response to: "Prayer" by Disturbed - Collab! Posted October 12th, 2009 in Game Development

At 10/12/09 12:26 AM, ShortMonkey wrote: Actually, I like this one of SupraAddicts better.

I agree. That one has more of an edge to it.

And like many have already said (and what I might be repeating myself) I would love to participate in another collab. Disturbed song or not, this was an awesome collab. I think everyone involved got to meet many more people here on Newgrounds.