Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 255 256 [257] 258 259 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 907652 times)

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3840 on: February 09, 2013, 10:02:45 pm »

What about programs that only fit a very specific need for a very tiny community?
Because I have one of those, I'm thinking about putting up on github.
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #3841 on: February 09, 2013, 10:07:30 pm »

Though working on personal projects that AREN'T games is generally a lot more attractive to employers.
I wonder if colleges look at personal projects too. :c
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3842 on: February 09, 2013, 10:15:44 pm »

Though working on personal projects that AREN'T games is generally a lot more attractive to employers.
I wonder if colleges look at personal projects too. :c

Probably, I showed the college I wanted to go to the stuff I was working on, turns out I can't afford to go, but the guy that I showed it sends me cards at christmas and my birthday and emails me about how his classes are going (he's a teacher)
idk, I guess he really wanted me to go to that school.
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

alway

  • Bay Watcher
  • 🏳️‍⚧️
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3843 on: February 10, 2013, 02:33:25 am »

Do you guys put your personal projects on your resumes? I guess it couldn't hurt, but I'm not sure how professional it would be.
What employers care about, in this order:
1. Skills; what can you do for them; which languages can you do, what APIs do you have experience with, that sort of thing
2. Experience; what have you already done; this includes both work experience and programming projects, both group and solo. The order you list them in should be based on how impressive/relevant they are. Personal projects are a plus, since it shows initiative, saying things were class projects or required for something will subtract from the value of that item*. Unless you have experience in the industry, work experience goes after projects.
3. Education; where were you formally instructed, how well did/are you do/doing there, your major, and year level.

* As to the reasons behind the latter modifier, it's because required work implies very little about what you actually did. For example, RIT's Software Engineering major has a class in which the quarter long project is to create a pizza delivery management system. While the project might by impressive if it was a personal project, when an employer gets 20 resumes all talking about the pizza delivery management system, they kind of stop caring. Such projects also are less indicative of effort put into it. A class project with random group members will often have 1 or 2 people doing all the work for the group; employers know this.
Logged

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3844 on: February 10, 2013, 03:37:58 am »

so I'm working on something I haven't touched in a few months,
and it's crazy looking at how I used to code. Like seriously lulzworthy.

I have to look back at some of the code to figure out what is doing exactly what since I left no notes like a dumdum.  Made me smile / lol.
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3845 on: February 10, 2013, 09:10:50 am »

Code: [Select]
void Planet::VariableBlurHumidity(int Strength) {

    map_point                   TempMap[800][400];

    for (int y=0; y<400; y++) {
        for (int x=0; x<800; x++) {
            if (DataMap[x][y].humidity < 255) {

                int AreaHumidity = 0;

                for (int x2 = -Strength; x2<Strength+1; x2++) {
                    for (int y2 = -Strength; y2<Strength+1; y2++) {
                        int rX = x+x2;
                        int rY = y+y2;

                        if (rX<0) rX +=800;
                        if (rX>799) rX -=800;

                        if (rY < 0) rY = 0;
                        if (rY > 399) rY = 399;

                        AreaHumidity += DataMap[rX][rY].humidity;
                    }
                }
                TempMap[x][y].humidity = AreaHumidity/( (Strength*2+1)*(Strength*2+1) );
            }
            else TempMap[x][y].humidity = DataMap[x][y].humidity;
        }
    }

    for (int y=0; y<400; y++) {
        for (int x=0; x<800; x++) {
            DataMap[x][y].humidity = TempMap[x][y].humidity;
        }
    }
}
This is randomly broken. "Program received signal SIGSEGV, Segmentation fault." Through experimentation I found that "map_point TempMap[800][400];" causes the whole thing to fail. Even if its at the end of the function. Before it should be doing anything. And it worked perfectly before.

EDIT: Creating a 2d array in other functions causes the same problems, unless the 2nd dimension of the array is 251 or smaller. WTF? Again, this worked before, and I have an identical array sitting comfortably in the class without any worries.

EDIT2: Wut. map_point is a struct. Making the struct itself bigger broke the array. But again, the array of the planet class works perfectly. I can turn the array of structs into the relevant thing(I wasnt using anything besides humidity) to keep this from happening this time, but I'm afraid this problem might pop up again later.

EDIT3: Apparently even the class array cant handle a struct bigger than 6 bytes. Cant say I'm too happy about that. But 6 should be plenty.
« Last Edit: February 10, 2013, 10:08:11 am by cerapa »
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.

olemars

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3846 on: February 10, 2013, 10:19:10 am »

TempMap is a local variable, which means it gets created on the stack. The stack is of system/compiler dependent size, and can be very small as it's not intended for that kind of data.

You will have to create it on the heap to avoid problems, which means making map_point a pointer and newing and deleting the array. If you call the function a lot you should just keep the array around instead of newing and deleting it over and over, as that's a slow operation.
Logged

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3847 on: February 10, 2013, 10:57:44 am »

TempMap is a local variable, which means it gets created on the stack. The stack is of system/compiler dependent size, and can be very small as it's not intended for that kind of data.

You will have to create it on the heap to avoid problems, which means making map_point a pointer and newing and deleting the array. If you call the function a lot you should just keep the array around instead of newing and deleting it over and over, as that's a slow operation.
I had the class itself on the stack too. No wonder it ran out of memory.

Thanks for the help.
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.

Immortal

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3848 on: February 10, 2013, 05:27:54 pm »

Hello all,
Well recently I was pointed towards steering behaviours and the results are fantastic.
I have seeking, following, avoiding, and arrival facing forwards (reverse thrust is only 1/5 main engine).
If you are unfamiliar I am making an Asteroids like game.

The problem I have is arrival with the shortest trip possible. To arrive the fastest way, it has to accelerate forwards then spin around and full thrust in the opposite direction. I can't get my AI to account for the time it takes to spin the ship around, and when it does spin around at the correct time, it decides it's now going to slow and spins all the way back (it just ends up spinning in circles till impact).

If anyone has an idea/tutorial/pseudocode on how to solve this it would be helpful. I have tried splitting it into pre//post spin but that doesn't work (or at least hasn't for me)
Logged

olemars

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3849 on: February 10, 2013, 05:47:51 pm »

Would be helpful to know what your current attempt looks like.
Logged

GalenEvil

  • Bay Watcher
    • View Profile
    • Mac-Man Games
Re: if self.isCoder(): post() #Programming Thread
« Reply #3850 on: February 10, 2013, 07:19:19 pm »

Immortal: the issue sounds like it is in your "seek" behaviour. What you need to do is make a separate "Arrive" behaviour which will start slowing down at some distance from the target location that will allow it to stop at the location using a desired time to target variable to control how fast it attempts to slow down.


And a demonstration of what it looks like in 3D: Arrive Demo
Logged
Fun is Fun......Done is Done... or is that Done is !!FUN!!?
Quote from: Mr Frog
Digging's a lot like surgery, see -- you grab the sharp thing and then drive the sharp end of the sharp thing in as hard as you can and then stuff goes flying and then stuff falls out and then there's a big hole and you're done. I kinda wish there was more screaming, but rocks don't hurt so I guess it can't be helped.

HavingPhun

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3851 on: February 10, 2013, 09:47:03 pm »

I have been in and out of learning c++ and now i'm finally starting to understand it. But I'm having a problem with this code:

Code: [Select]

#include <stdio.h>
#include <iostream>
#include "human.h"
#include "World.h"


int main(int argc, char **argv)
{
enum STATE{INITIALIZE, ON, OFF, PAUSED, RUNNING, MENU, COMMAND};
int Response;
char Command;
char * PCommand;
PCommand = &Command;
int Counter;
int LastStop;
int NumberOfPeople;
int MoneyInCirculation;
char Name;
STATE state;

state = INITIALIZE;

printf("Economy Simulation Program. \n");
printf("Type one to Continue, Any other number to exit:\n");
std::cin >> Response;

if(Response == 1)
{
state = ON;
}
else
{
state = OFF;
}

while(state != OFF)
{
int Counter = 0;
int LastStop = 0;
int NumberOfPeople = 0;
int MoneyInCirculation = 0;

printf("Enter a command. Type help for a list of commands:\n");
std::cin >> *PCommand;

if(Command == "help")
{
printf("New Person \nClose \nStop \nContinue");
}
printf("Enter a command:\n");


Human bob;



bob.Age = 27;
bob.Clothing = 80;
bob.Hunger = 20;
bob.Thirst = 15;
bob.Blood = 100;
}


return 0;
}

I get this error: C:/Users/HavingPhun/Desktop/Economy Simulations/Simulation 1/main.cpp:46:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]

On this line:
Code: [Select]
std::cin >> *PCommand;I was trying to do that earlier with:
Code: [Select]
std::cin >> Command;and it still gave me the same error above, and also said I cannot change a const char(Or something along the lines of that). So I tried to change it indirectly with a pointer. Right now I'm just screwing around with some simulations until I can redownload mingw on the 17th and get libtcod working. Sorry if its hard to read I am still working with wordpad until the 17th also. I also did not include the header files since the error and variables involved are all in the main file.Thanks.
Logged

fergus

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3852 on: February 10, 2013, 09:58:50 pm »

Code: [Select]
std::cin >> *PCommand;
Try replacing
Code: [Select]
char Command;with
Code: [Select]
char Command[10];and
Code: [Select]
std::cin >> *PCommand;with
Code: [Select]
std::cin >> Command;
Logged
BY THE GODS! THIS QUOTE MADE MY SIG BOX HAVE A SCROLL BAR! HAPPY DAYS INDEED!
BY THE GODS! YOU HAVE TOO MANY SIGS!

Immortal

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #3853 on: February 10, 2013, 10:53:52 pm »

Immortal: the issue sounds like it is in your "seek" behaviour. What you need to do is make a separate "Arrive" behaviour which will start slowing down at some distance from the target location that will allow it to stop at the location using a desired time to target variable to control how fast it attempts to slow down.

Thanks, but that is exaclty what I have for arriving facing forward. The problem is when I want to arrive facing away it always overshoots the target (the ship takes time to change direction). How would I be able to post a java for you to see if you're interested?
Logged

GalenEvil

  • Bay Watcher
    • View Profile
    • Mac-Man Games
Re: if self.isCoder(): post() #Programming Thread
« Reply #3854 on: February 11, 2013, 12:10:53 am »

Immortal: I suggest posting it to pastebin since it has decent permanence and is useful for moving code snippets around. If you have a way to do rotations without translating at all then I'd suggest have it cut forward thrust once it is on a collision course, spin around to face directly away, and then use forward thrust to slow down. You'd have to take into account the rotational acceleration of the ship to figure out a minimum safe distance for the start of the maneuver. Back to the code: Upload it to pastebin and send me a link to it via PM, or onto this thread since I'm sure others here would also be able to help you if I am slow getting back to you :D
Logged
Fun is Fun......Done is Done... or is that Done is !!FUN!!?
Quote from: Mr Frog
Digging's a lot like surgery, see -- you grab the sharp thing and then drive the sharp end of the sharp thing in as hard as you can and then stuff goes flying and then stuff falls out and then there's a big hole and you're done. I kinda wish there was more screaming, but rocks don't hurt so I guess it can't be helped.
Pages: 1 ... 255 256 [257] 258 259 ... 796