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 - seyuup

Pages: [1]
General / Re: SFML+CLION +CMAKE (Windows10) configuration
« on: August 16, 2017, 09:04:56 pm »
I have Windows 8.1 and am currently using CLion with SFML. So, I'll see if I can help you with you problem.

Hey! Another CLion user!
I too used to have problems getting CLion to work with SFML. When I get a chance today I'll see if I can help you with your problem.

Edit: That's if you're still experiencing it, as your last post was in July.

General / Kinematics - Grid Jumping Problem
« on: July 06, 2017, 03:24:41 pm »
Hi, I hope that someone will be able to assist me with my problem.

  • I have an object that moves from grid to grid (left, right, up, or down) at a speed, s.
  • The grid is 32x32.
  • There are "holes" scattered around the grid map. These holes can only be passed by jumping over them.
  • Each hole is also, 32x32
  • I want the object to be able to jump over these holes, but I want the jump movement to last the time it takes for the object to move from grid to grid.

I'll let, d, represent the direction (either x or y) that the object is moving. Thus,
  • ddisplacement = 32 (since each grid is 32x32).
  • t = ddisplacement / dspeed * elapsed time (as seconds)

Here, t, should be time it'll take for the object to cover the displacement, ddisplacement (in pixels), at speed, dspeed.

I then proceed to finding gravity amount:
  • jumppower = 100.f.
  • V0z = jumppower (the initial velocity in the 'z' direction).
  • Zdisplacement = 0 (the displacement of the jump).
  • gravity = 2 * (V0z * t - Zdisplacement) / t2

Notice: I'm not sure if the elapsed time needed to be applied here when calculating gravity.

Finally, I attempt to calculate the height at time, tother.
  • Before jump:
  • tother = 0 (this is set once before the jump executes).
  • ...
  • height = Z0 + V0z * tother + 0.5 * gravity * tother2.
  • V0z += gravity * elapsed time (as seconds).
  • tother += elapsed time (as seconds).
  • ...
  • Height applied to the sprite
  • sprite.setPosition(x, y + height)

Once again, I'm not sure if I applied the elapsed time correctly here. After attempting this, however, it appears to keep the object in the air of the length of traversing grid space to grid space, but the jump movement isn't what I'm going for.

When I press the key to make the object jump, object gradually moves upward, but then drops like a rock. I would like for it to be a nice smooth movement (like Super Mario Bros.).

Sorry, if this entire post was confusing, please let me know where any confusions may lie so I can try to help you all understand my problem better.


Mario - Thank you very much, that did the trick. I think I'm going to make a video showing how to setup SFML with Clion, as it was quite a mess trying to figure it out with little knowledge of MinGW and Cmake.

Thanks again.

eXpl0it3r - Yes, I just recently updated my Nvidia GeForce driver to GeForce Game Ready.

Mario - Ok, I will remove it from the path. How exactly do I start from scratch? Remove any files created in SFML_2.4.0_BUILD and clear Cmake's cache?

Thanks for the speedy responses!

Hello, I've been trying to build SFML from source over the past few days (I'm used to just using Visual Studio, but I wanted to try using CLion with MinGW-w64.

While following the build tutorial on the main site, I unfortunately encountered an error that I have no idea how to solve. Here is Cmake and the error.

I hope someone will be able to share some insight on helping me solve the issue.

Is there a reason why when falling vertically past the maximum map height, the map will be recreated (tiles will be placed) except for the leftmost tiles?

I assume it has to do with the tile map variable within the Map class.

I'm sorry if the description did not make sense. I'll try to provide pictures when I can.

General / Re: Square grid path-finding approaches
« on: March 08, 2016, 05:34:42 am »
Is there a reason why you don't use state-of-the-art algorithms for pathfinding? Breadth-first search is highly inefficient for shortest paths, because it exhaustively checks all possible paths. The Dijkstra algorithm improves on this by taking into account the distance from the start, and A* achieves even better results through heuristics that estimate the distance to the target from any node.

There are existing implementations of graph algorithms in the LEMON library. A* is currently not in the main branch, but available as an external contribution. But already Dijkstra's algorithm (which is a part of LEMON) is better than BFS.

I used it as a placeholder just to try and get things working first. I will definitely implement a better algorithm later. I have seen that redblob site also, it's very helpful.

General / Square grid path-finding approaches
« on: March 05, 2016, 10:19:34 pm »
Hi, I'm currently trying to implement game play where a player and an enemy are snapped to the grid and the enemy will constantly find a path to the player (even while the player is moving). The entities can only move in the directions left, right, up, and down.

1.) My first approach was to implement path finding using Breadth-first search (no thread).

The game lags (of course) because the computer is having to do too much work.

2.) My second approach was to implement path finding still using Breadth-first search except this time using a thread.

Using a non-detached thread, the game doesn't lag anymore, however, the enemy freezes at times (I assume from trying to calculate the constant movement).

I choose to find a new path only when the enemy is snapped to the grid and when the last found unused path is retrieved by the enemy controller.

Any ideas on another approach to this problem? I'm only going to have one enemy which constantly calculates a path to the player. I'll try to post some code later today.

I hope someone will be able to assist me!

Update (3/5/2016 8:12 PM):

I was able to fix the problem. It was a logic error, fortunately. I was checking for a path based on the player's (x,y) position (which can be a float value) instead of integer values divisible by the grid's (width, height).

General discussions / Re: SFML Game Development by Example - 4th SFML book
« on: February 11, 2016, 01:51:20 am »
The "fixed time step" that people are (I hope) referring to is the one seen in the part of that article labelled "Free The Physics" (not "Fixed Delta Time"). This creates a time-step that is fixed and regular which effectively means that you always use the same time-step and the results are the same on all machines (and is identically repeatable).
Would this (fixed time step) not be the preferred method of choice for all applications? For a simple platformer game like Super Mario Bros. would this method be the ideal? I may be misunderstanding, as I am new to certain aspects of game development.

General discussions / Re: SFML Game Development by Example - 4th SFML book
« on: February 09, 2016, 07:35:25 pm »
The first project (snake) uses a fixed timestep, unlike the last two that rely on a variable timestep. The first bouncing mushroom example actually wasn't capped or adjusted in any way, and was later used to underline the issue of different execution times between varying systems. It was then adjusted to use delta time in order to run at a constant speed near the end of Chapter 2, so if you noticed that behavior before, you were absolutely correct. :)
So, the platformer game and the RPG-styled game both run in variable timestep, correct? I ask because I'm currently trying to make a platformer game following your example. Could you explain your reason for using a variable timestep method for your platformer example over the other methods (fixed timestep, minimum timestep)?

Question: What would you say is the method you are using for frame rate? It seems like the game is running with variable time step, is this correct? If it is, I'm curious if a different method is used later in the book. It might just be my computer, but the bouncing mushroom seems to be moving quite variably.

That's really odd. I just tested it myself, and it seems to be working fine. Please feel free to send me your code through either the PM function on these forums, or directly to my email address: order.nexus.dev@gmail.com. I would be happy to help you out!

Edit: One thing you should check is the order in which data members of the classes are declared. Since they're allocated on the stack, the destruction of these objects will follow in the reverse order of declaration. Make sure to consult the code that came with the book, and if that doesn't work, please feel free to contact me! :)

Ahh! You beat me to it! I just figured it out and was about to post it! Hahah! You are correct, it was the order the members were created, such a simple mistake.


Loving the book so far, however, I've hit a snag.

I'm at the beginning of Chapter 7 and just finished testing the Tile/Mapping classes. The background texture loads, but when I hit the close button or click the "exit" button on the main menu, I receive an exception. I believe the error is occurring because the Game object's deconstructor is called when the window closes, causing my SharedContext object to lose scope.

Thus, other objects that depend on the SharedContext for releasing resources cause an error. Also, the ResourceManager's deconstructor is being called first, so it purges all of the resources before the map can do so itself.

I hope someone will be able to assist me!

Pages: [1]