Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Scipi

Pages: 1 ... 5 6 [7] 8 9 ... 139
91
Computer Projects and Ideas / Re: Re: System Crash 2
« on: January 26, 2014, 03:40:57 pm »
No, it's certainly not. I could try implementing a more laptop friendly control scheme, though

92
6257: You create your own linguistic language and share it on Omni (1)

And how is that a sign?

Simple. It shows that any project of interest you have you share on Omni regardless of relevancy to calcs. (Omni is an excellent community for many topics, really)

93
Humour and Jokes / Re: Re: 9001 signs you're addicted to calcs and Omni
« on: January 25, 2014, 11:24:40 pm »
6257: You create your own linguistic language and share it on Omni (1)

94
Computer Projects and Ideas / System Crash 2
« on: January 25, 2014, 10:42:16 pm »
Hello everyone.

It's been a few years since I last actually released a project here on Omni. However, recent events have had me revisit one of my old projects.

This is System Crash 2, the second iteration of my 2D Shooter. The original can be found here.

In its current state, the game is still more of a tech demo than anything else. It plays the same as the original version, however there are some changes.

Primarily, there are now two kinds of enemies:
Dumb Bots, which merely move towards the player at a low rate, and
Smart Bots, which are controlled via a Recurrent Neural Network.

As the game progresses, Smart Bots become more adept at killing the player through the application of a genetic algorithm. After each round, smart bots will be chosen either for being able to survive the longest or for dealing more damage to the player than other bots. These bots will then be used to populate the next round, with each offspring being mutated to create potentially new behavior.

As previously stated, the game is still a work in progress. However it is playable. It just doesn't have all the niceties the original had, like a high score or menu.

Controls:
   WASD/Arrow Keys - move
   Space - Sprint
   P/O - Pause/Unpause
   Esc - Reset
   RMB + CTRL - Select Bot to render Brain
   RMB - CTRL - Clear Bot Selection

Here are some ingame screenshots:





The Game is attached to the post.

Known Issues:
    -Title says HuntingBots
    -Weapons not properly balanced
    -Selected Bot does not clear unless player moves

95
Humour and Jokes / Re: 9001 signs you're addicted to calcs and Omni
« on: January 25, 2014, 09:05:49 pm »
6255: A smilie of your own design is now part of Omni :'3 :3

96
Site Feedback and Questions / Re: "._."
« on: January 22, 2014, 08:09:48 pm »
:D

Funny, yesterday I had wondered why the image for my emoticon suddenly broke (since it's just a link to an attachment somewhere).

Yay :3

97
Computer Programming / Re: Finding if a point falls within an angle
« on: January 20, 2014, 10:38:56 pm »
Code: (java) [Select]
double buffer = Math.toDegrees(Math.asin(b.radius/dist));
If I'm correct, the dist you calculated is the distance from the centers... radius/distance is, by your picture, opposite/adjacent, not opposite/hypotenuse, so I think you should be using atan there. That might be your problem. This results in a smaller buffer, which would explain why some objects inside don't work, but not why some objects outside work. Have you tried doing it without accounting for a buffer?

Edit: Ninja'd, nvm.

The distance between bots is actually the hypotenuse, although it doesn't show well in the picture. It's because the line running from the center of the home bot to the other bot's perimeter is a tangent.

98
Computer Programming / Re: Finding if a point falls within an angle
« on: January 20, 2014, 10:11:53 pm »
Code: (java) [Select]
double dist = Math.sqrt((xPos - b.xPos)*(xPos - b.xPos) + (yPos - b.yPos)*(yPos - b.yPos));

if(dist < 0){
   dist = .001;
}
Erm, distance from a sqrt shouldn't give you a negative... I don't believe that if conditional will ever be fulfilled.

Good catch, that was supposed to be ==.

You can use the dot product of the viewing direction vector and the vector between the two bots. The direction vector should be <cos(viewangle), sin(viewangle)> and the vector between the bots should be <b.xPos - xPos, b.yPos - yPos>. The dot product of these two vectors, (b.xPos - xPos)*cos(viewangle) + (b.yPos - yPos)*sin(viewangle), is equal to the magnitude of the two vectors times the cosine of the angle between them. The magnitude of the first is 1, and the magnitude of the second is the distance between the bots. So you can divide the aforementioned dot product by the distance between the bots and get the cosine of the angle between the view direction and the other bot. Then, you can just compare it to the cosine of half the field of view. Hopefully this all makes sense.

I was given a similar solution a few days ago by a colleague. I have an attempt to implement what he said under this code:

Code: [Select]
private boolean inFOV(Bot b, double uAngle, double lAngle){
double x1 = Math.cos(Math.toRadians(uAngle));
double y1 = Math.sin(Math.toRadians(uAngle));
double x2 = Math.cos(Math.toRadians(lAngle));
double y2 = Math.sin(Math.toRadians(lAngle));

double uDist = y1 * b.xPos + -x1 * b.yPos;
double lDist = -y2 * b.xPos + x2 * b.yPos;

return (uDist > b.radius && lDist < b.radius);
    }

I'll recode it to try and implement what you suggested. Seems like what I need.

Edit:

Calc84's method solved my issue. Damn, I really need to take a look into vectors >_<

Here's the working code:

Code: [Select]
private boolean inFOV3(Bot b, double angle, double FOV){
double x1 = Math.cos(Math.toRadians(angle));
double y1 = Math.sin(Math.toRadians(angle));
double dist = Math.sqrt((xPos - b.xPos)*(xPos - b.xPos) + (yPos - b.yPos)*(yPos - b.yPos));
double dx = b.xPos - xPos;
double dy = b.yPos - yPos;

if(dist == 0){
    dist = .001;
}

//(b.xPos - xPos)*cos(viewangle) + (b.yPos - yPos)*sin(viewangle)


double dotP = (b.xPos - xPos)*x1 + (b.yPos - yPos)*y1;
double dAngle = dotP / dist;
double halfField = Math.cos(FOV);

return (dAngle >= halfField);
    }

99
Computer Programming / Re: Finding if a point falls within an angle
« on: January 20, 2014, 09:44:31 pm »
Coordinates are given in floating point values in an (x,y) plane. (0, 0) is the top left hand corner y increases as you go down the screen.

The code provided is supposed to determine if the angle of a given bot relative to the bot doing the testing, falls within two angles which represent the limits of the bot's sight.

Code: [Select]
double angle = Math.toDegrees(Math.atan2(b.yPos - yPos, b.xPos - xPos));
This gets the angle between the bot doing the test, and the bot being tested on.

After that, we add the buffer to account for if part of the bot falls within sight, but not the origin. This part works as intended.

We then see if the upper angle is greater than the angle between the two bots, and if the lower one is less than. This is the part I believe is not working correctly.

100
Computer Programming / Re: Finding if a point falls within an angle
« on: January 20, 2014, 08:34:31 pm »
There are some cases where only part of a circle is "visible," so the buffer is the angle to increase/decrease the view by to cover any circle overlaying the view at a given distance.

Here:


101
Computer Programming / Finding if a point falls within an angle
« on: January 20, 2014, 06:19:26 pm »
Hello everyone.

I've been working on a project and I am running into a bug with implementing sight for bots within the program. Basically, for each eye on an bot I have an angle for direction and a field of view, both represented in degrees. I want to find if a bot falls within sight of another, adding a buffer should only part of a bot be visible.

Here's the code I have:

Code: (java) [Select]
private boolean inFOV2(Bot b, double uAngle, double lAngle){

double dist = Math.sqrt((xPos - b.xPos)*(xPos - b.xPos) + (yPos - b.yPos)*(yPos - b.yPos));

if(dist < 0){
    dist = .001;
}

double buffer = Math.toDegrees(Math.asin(b.radius/dist));

double angle = Math.toDegrees(Math.atan2(b.yPos - yPos, b.xPos - xPos));

uAngle += buffer;
lAngle -= buffer;

return (uAngle - angle >= 0 && lAngle - angle <= 0);
    }

//Called via

inFOV2(b, angle + FOV, angle - FOV)

This doesn't seem to be working properly. Sometimes it detects it sees another bot when it doesn't, or vice versa. I have no idea where I am going wrong here, so any insight would be greatly appreciated. ^_^

Thanks

102
Humour and Jokes / Re: Re: If there was tech support in botswana...
« on: January 19, 2014, 02:11:07 pm »
Build a smaller one

I lost my subatomic ball machine somewhere

103
Miscellaneous / Re: Random YouTube Videos
« on: January 16, 2014, 03:51:15 pm »
https://www.destroyallsoftware.com/talks/wat
(Video on page does not work. Click the download link at the bottom of the page and watch it in your favorite media player)

This is the result of all of those developers trying to reach the [xkcd=323]Ballmer Peak[/xkcd].

Video worked for me, and all I can say is... Wat?

104
Miscellaneous / Re: Random YouTube Videos
« on: January 15, 2014, 11:35:09 pm »
Guess what time it is


105
Miscellaneous / Re: Christmas 2013 - What did you get?
« on: December 27, 2013, 04:51:08 am »
I really want to start learning the saber. However, there aren't a lot synthetic items for sabers on Amazon, strangely.

Pages: 1 ... 5 6 [7] 8 9 ... 139