Welcome, Guest. Please login or register. Did you miss your activation email?

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.


Topics - Godsend72

Pages: [1]
1
SFML projects / Pong
« on: January 13, 2016, 04:57:33 pm »
This is my try on a pong.

It was finished a while ago.

I started small and simple but things got pretty ugly pretty fast.
I had a few months break from programing because of some obligations... and to get back into shape I decided to make a pong clone, I got carried away and before I knew the source got big and I didn't want to break it into separate files. :/

Video: https://youtu.be/MtfxawsoY2g
Source: https://github.com/Godsend72/GitFolder







My AI code looks like this:
I have a prediction ball that travels 1.3 times faster than the real ball.
AI paddle moves only when the ball is on his side of the screen.
When the ball collides with the player paddle I set it to the same position as the real ball.

AI prediction example: https://youtu.be/oRq4iqfq33Y

AI logic:
(click to show/hide)

2
SFML projects / 2D Puzzle game
« on: January 12, 2016, 03:10:52 am »
Greetings,

I am creating a 2d puzzle game inspired by Talos Principle, I don't have much to show but still here it is...

-Doors are working perfectly
-Jammer needs fixing
-The box has no purpose
-The sphere(enemy) is half done, it detects the player and reacts to it. In the future it will start to warm up for 2 seconds and if the player is still in the range it will shoot him. The range is currently drawn around it for testing purposes.

Currently I am working on the jammer ray collision with walls, I was planing on asking for an advice but I just got an idea.

Here is the video https://www.youtube.com/watch?v=iKMoJ_W-C40



All placeholders are drawn by me, except the jammer, and if you want to use them just ask, I'll upload them  ;)
The jammer is a mushroom from Super Mario, on which I redraw that ugly thing.


I don't have much experience with inheritance, and if anybody can give me some tips on this, it would be great.

I have a base class  BaseObject and all object derive from it.
I have a vector of unique_ptr to BaseObject containing all objects except the player and walls.
When i try to access a function from derived class I get an error, to solve this I cast it to desired type.

The question is: how would look the correct usage of std::vector<unique_ptr<BaseObject> > so that I can access the derived class functions without casting them? Or is this acceptable design?

My code looks like this:
std::vector<std::unique_ptr<BaseObject>> m_objects;
m_objectContainer.emplace_back(new Jammer("jammer.png", sf::Vector2f(0, 0)));


for(int i=0; i<m_objects[i];++i)
{

       m_object[i]->derivedClassFunction();
       //Error base class doesn't have derivedClassFunction()

       if(m_objects[i]->type() == objectType::Jammer)
       {
             Jammer* tempJammer = dynamic_cast<Jammer*>(m_object[i].get());
             if(tempJammer != nullptr)
             {
                    tempJammer->derivedClassFunction();
                    //OK
             }
        }
}
 


3
Network / server-client, threads
« on: September 24, 2015, 06:40:31 pm »
Hello, i have a few questions.

I have created a TCP server with socket selector and it supports multiple clients.
The game would be multiplayer only, 10 clients max.

-The question is should i make that the server runs the simulation and checks collision and then it
    sends positions/moving direction to clients, and the clients sends moving directions and when they preform some action like shoot jump?

-One more thing, what part should be in another thread on server and on a client?
    I tought about creating one thread for sending and one for receiving, both for server and client.

-PS. is there any difference between sending packets and char array?
    Currently i am sending a char[] and it works ok, but i think packets would be a lot simpler.

4
General / problem with running
« on: March 03, 2014, 05:20:03 pm »
Hello.
I'm trying to make something like a "pick a stick" game. I have tried to implement running, i have a little bar above players head witch indicates how much can i run, the more i run the shorter it gets and it works, but when i change the direction it doesn't decrease right away, more like 1 second later.


here is a link to download, source is included: https://mega.co.nz/#F!9o9VDTxD!iTX9sxrfU7vEl_J9cxBSsQ
here is a download link in rar: https://mega.co.nz/#!F40BBZxJ!8nSfhafyxNyMbAFybxCrAdIKXSdKPMOguiiIL4zvCiE

image: http://oi62.tinypic.com/55gjyo.jpg


you walk with: WASD
you run with: Left Shift


the numbers above your head are the number of woods collected, 1 wood fill's your running bar 25%



What i wanted to ask is can some one look at it and point me to the problem, just this one time :D

Pages: [1]