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.


Messages - Godsend72

Pages: [1] 2
1
SFML projects / Re: CUIT is now on Steam Greenlight!
« on: March 25, 2017, 10:15:29 pm »
Congrats on being greenlit :D

2
Network / Re: Network several connections TCP server
« on: February 15, 2017, 02:23:16 pm »
You can make a send disconnect function on your client side, where you send the disconnect code. When the server receives it, it deletes that client. You would call it in a destructor or when closing your game.

Other way would be to create a ping function, where you ping the server from the client. Then create a timeout variable for each client on your server side, where you track the how long has it been since last ping. If it was more that x time, you delete that client.

Or you could ping the client from the server, and if the status of the send ping function is sf::Socket::Disconnected, just delete the client.

There are probably more ways, I am using the first and the second one.
The second one is also useful if you want to display the ping on the client game.

3
SFML projects / Re: Pong
« on: September 15, 2016, 03:22:09 pm »
GitHub link is broken. Nice work anyway!

It is available again, I made it private because it was a mess :D

EDIT: It is still a mess.

4
SFML projects / Re: Temporarily Named MMORPG: The Adventure Game
« on: April 27, 2016, 07:25:57 am »
Hi Sean.

Why are you overhauling the entity system, what is wrong with the old one?

I love your updates. Keep 'em coming.

5
SFML game jam / Re: Wanna another? (early 2016 edition)
« on: April 26, 2016, 10:01:24 pm »
The results or the next jam — which comes first, we never know.

6
Network / Re: Easy example for client server in LAN
« on: April 19, 2016, 10:11:32 pm »
I will try to describe it more. Add more commenting.

Basically I followed this tutorial by TheCppGuy to get the idea how to do it.
https://youtu.be/iJfC4-yNnzY?list=PLA850388B1C9C62A6

He uses SDL, but the concept is the same.

7
Network / Re: Easy example for client server in LAN
« on: April 18, 2016, 04:50:34 pm »
I am not better than you but here is my example. https://github.com/Godsend72/networking_sfml

8
Network / Re: Issues with receiving
« on: April 18, 2016, 04:26:55 pm »
Even if that line would block the program until it receives something, you created another thread for it. So your program would still run on the first socket.

9
Network / Re: Issues with receiving
« on: April 18, 2016, 09:40:36 am »
I think the problem is that you are listening to incoming connections in client. Split the code in to server and client. In my opinion, in this case threads are overkill, put socket in non-blocking mode. Also in receive function, check if "socket1.receive(...) == sf::Socket::Done", because currently it is printing empty string all the time. I have modified your code a little. http://pastebin.com/DwqDjnE8 

10
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)

11
SFML projects / Re: 2D Puzzle game
« on: January 12, 2016, 10:10:21 pm »
Thank you all so much for the responses.

I will remove the casting, rework the classes, move the functions to the base class and make virtual.
I'll try to avoid RTTI, but I like to live a dangerous life and can't promise anything 8)

MORTAL, in your example, what happens when you need to trace multiple derived objects, would you need to create multiple trace pointers, or vector of trace pointers? Or can you point another existing object from baseClass vector to it?

Quote from: MORTAL
you may read more about it here C++ Programming/Classes/Abstract Classes.
The link is not working but I searched the term and read about it.


This is kinda how my code looks
(click to show/hide)

This topic looks more like it should belong in the help section, From now on I'll try to add more content instead of questions to it.

I know the game looks like rubbish right now, but i have a vision.

Feel free to comment something about the game too. :D

12
SFML projects / Re: 2D Puzzle game
« on: January 12, 2016, 10:23:14 am »
For example if I have two classes that derive from base, and in each derived class I add 2 new different functions, I need to make 4 virtual functions in base object?
Then I would need to implement that functions in classes that do not use them.

13
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
             }
        }
}
 


14
Network / Re: server-client, threads
« on: September 24, 2015, 10:38:39 pm »
Thank you all for the info.

For now I'll stick with TCP and one thread. It works fine, but i think i will rewrite the code to send packets.

For now the clients are handeling logic, i will try to test it other way around and see how will that go.

15
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.

Pages: [1] 2