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

Pages: [1]
1
SFML website / "Next »" goes to second page. Why not "Last"?
« on: April 27, 2012, 01:51:14 am »
Just noticed that while in the forum looking through threads (not in a thread yet), clicking "Next »" to access the thread instead of one of the other page numbers takes you to page 2. I can't personally see any reason for this, I clicked it hoping for it to take me to the last page of the thread. Which now seems useless anyway as longer threads seem to keep links to pages 1, 2 and 3 visible, then the last page number as well.

Simply put - Why have this:

    Thor 2.0
    Started by Nexus « 1 2 3 ... 5 Next » »

and not just:

    Thor 2.0
    Started by Nexus « 1 2 3 ... 5 »



The "Next »" is confusing! :-[

2
Graphics / Technique for drawing splines?
« on: September 04, 2011, 01:51:18 pm »
I've been playing with b-splines a bit lately - working on a small shmup. I was wondering if anyone has a particularly clean way to draw splines/curves.

Currently I am just drawing lines at an interval determined by how many control points are in the spline. This works relatively well while the spline is static, but when modifying the spline this interval changes and the result isn't the most pleasing.

It's not a huge issue, especially because you only see it in the editor, but I figured someone must have done this before, though I didn't find anything in my searching.

tl;dr - I'm bored. Let's talk about computer graphics and programming :)

3
General / Strange input behaviour (Checking two inputs at once)
« on: September 01, 2011, 01:11:45 pm »
I've come across a bit of an odd problem while working on a simple editor for a shmup. I have several controls which require holding down a keyboard key and using the mouse (although it appears to happen with any combination of two inputs).

Code: [Select]
int main()
{
sf::RenderWindow window(sf::VideoMode(1024, 768, 32), "Blah");

sf::Vector2f pos(0, 0);

bool running = true;
while (running)
{
sf::Event ev;
while (window.PollEvent(ev))
{
if (ev.Type == sf::Event::Closed)
{
running = false;
}
}

if (sf::Keyboard::IsKeyPressed(sf::Keyboard::LShift) && sf::Mouse::IsButtonPressed(sf::Mouse::Left))
{
//this code can be executed by pressing Left mouse, then shift
pos.x = sf::Mouse::GetPosition(window).x;
pos.y = sf::Mouse::GetPosition(window).y;
}

window.Clear();

sf::Shape shape = sf::Shape::Circle(pos, 10, sf::Color::Red);
window.Draw(shape);

window.Display();
}

return 0;
}


The if statement will be executed by pressing both Shift and Left mouse, or pressing the mouse button and then shift. If I swap the Mouse button check and the LShift check (Mouse::Left && Keyboard::LShift), it works in the opposite order, which makes me think I'm doing something stupid.

I'd usually do more experimentation/research before posting an issue here, but I have a deadline this time :wink:

I'm using an out of date SFML2 build (end of July) - After the new input system (as you can see) but before the sf::Image/sf::Texture split.

OS: Windows Server 2008 R2

Any help would be great!

4
Feature requests / A better sf::Randomizer
« on: April 29, 2011, 11:43:03 am »
Greetings! I just thought I'd put it out there that the Randomizer class could be improved. I'm not suggesting a more complex PRNG but suggesting to move away from the standard rand() and srand() functions and implement a similar (or the same) one.

The problem with the current system is that there is only one source for random numbers. Being able to create multiple objects of a Randomizer class suggests, to me, that each instance would be a unique source of numbers. Having a single source can also create logical errors as well as cause problems with threading. Finally, and I'm not sure what GLIBC or other libs/compilers use currently, but by implementing the algorithm in SFML, random number generation should be consistent across platforms.

An example:
A game where a system critical to your replay feature uses the PRNG. The game's audio system also accesses the PRNG to choose sound effects. The user tries to watch a replay but has sound disabled - even with the same seed, without the audio system active, the other system is going to get a different series of numbers than it did when the replay was recorded (with audio on).

Maybe not the best example, but I hope you see my point.

This is basically the implementation in VC9:
Code: [Select]
return( ((holdrand = holdrand * 214013L + 2531011L) >> 16) & 0x7fff );

Whether or not you use this specific one doesn't matter - similarly simple ones are readily available. It's a multiply with carry type PRNG, for reference.


One more thing!  :lol: I have to recommend moving away from using modulo to get random numbers in range - it hurts distribution. The exact "trick" escapes at the moment but it's better to start with math rand (0.0 - 1.0) and go up from there. EDIT: Just realised your float version of Random pretty much does this. I would adapt that for the integer version too.



Thanks for reading!

5
Network / Reusing sockets and non-blocking sockets
« on: January 29, 2011, 05:22:18 pm »
Hey, probably some pretty simple newbie network questions here. Using SFML 2 by the way.

I'm wondering if sockets are intended to be reused - should I create my socket/listener and use it to receive data throughtout the running of my program or should I create a socket everytime I receive data? Does it matter?

Also, what exactly changes when you SetBlocking(false)? Does it return instantly and you have to keep calling Receive() until there is some incoming packets?

Bear in mind this is for a small real time multiplayer game.

Any pointers would be appreciated.

Cheers :)

6
SFML projects / 'Tiled' Tile-map Loader
« on: August 16, 2010, 09:23:55 am »
Hi guys, I've been using the Tiled (http://www.mapeditor.org/) map format in a game I've been working on and thought I would share the love around.

I've basically rewritten it, as I was using it with Box2D. This new version is more general purpose.

It should work with any size level you throw at it. You can have as many tile layers as you want (and transparency works).

Any objects you place in the editor will be picked up and stored and can be accessed.

You should be able to get going just from looking at the header file and reading the README.txt.

Download: https://sourceforge.net/projects/tiledsfmlloader/files/TiledMapLoader0.1.zip/download

Note that I'm not affiliated with Tiled or it's author.

Suggestions, bug reports etc are more than welcome!

Don't forget to read the README.txt!!!

7
SFML projects / Shameless self promotion: "PerfectWord"
« on: July 02, 2010, 05:45:53 am »
So Game Jolt is holding a 'demake' contest.

This was my entry, using SFML.

It's a demake of Kloonigames 'SM Word'.

More info and download here: PerfectWord

8
SFML projects / BreakOut Invaders! a.k.a. "Copyright infringment!"
« on: March 02, 2010, 11:48:16 am »
Hey! Listen! Look!

Just thought I would share my most recent project with everyone.

It is called 'BreakOut Invaders', and as you can probably guess it's a game somewhere between breakout and space invaders.

Features:
    36 unique human screams*
    Innovative "gameplay"
    "Unique" control system
    A "storyline"



The welcome screen.


Game over. I lost.

Please, download it and have a turn. It's only a 1.5MB download.
Download: http://www.mediafire.com/?2oezzeiekyn

If anyone is /really/ interested, I can probably send you some source code, though I don't know how educational my mess will be.

Cheers!

*Derived from three recordings

EDIT: Should probably mention that this was made entirely using SFML in C++ with Code::Blocks. All sounds/music/artwork is/are made by me except the screams, I had a friend record them for me.

EDIT EDIT: I know people have downloaded it. Stop hiding, lol.
Small updates: Can now use S and D (should be AZERTY-friendly?) to control the ship, as well as the arrows.
Also the the credits don't roll anymore when you choose to replay (If anyone WANTS to play it more than once  :lol: )
Link updated.

9
Audio / Alternative audio libraries - suggestions?
« on: March 01, 2010, 09:21:33 am »
Hey guys. I am working on a game right now with levels being generated infinitely.

Anyway, I wanted to have a simple looping melody for "music" and I was going to shift the tempo up each level. As far as I know, OpenAL and SFML can't do this - it is quite a difficult operation (if it can even be done realtime on my hardware, while there is other stuff using my CPU). So I am looking for a different audio library to use. Either one that can change tempo of an mp3/ogg/whatever without shifting the pitch too, or perhaps a library to play MIDI or popular tracker formats, or even a SID emulator or SPC700.

Has anyone here got any experience with anything like this or any suggestions?

By the way, I have thought about having a different loop for each level, but when 15+ levels is a reasonable amount to get through on your first play, this seems a little excessive.

Cheers guys.

PS Sorry for asking for <not SFML> in the SFML forum, Laurent. It handles everything else beautifully :)

10
General / The 'new' keyword, factory patterns
« on: January 23, 2010, 05:07:28 pm »
I am trying to learn about object creation and factory patterns. I understand that you have a class that contains functions to create new objects and I would hope it tracks the individual objects somehow.

Does the factory pattern take care of keeping track of the objects? Do you use the new keyword to do the actual creation? I have never used this keyword before. I would like to see an example in C++ and any other tips you may have would be greatly apprectiated.

Cheers

11
Graphics / Drawing to window from a seperate function/tile engine help
« on: January 16, 2010, 05:52:24 am »
Hey there,

I am working on a simple tile based strategy game. The problem I am having comes from needing to create my window in the main function, but I want to draw sprites/tiles from a seperate function. Is it possible to do this?

Should I just draw every sprite in the main function, and just move them in my other function?

Additionally, the map is only 15x10 tiles, they are all on screen at once. Should I loop through and draw every tile each frame, or should I perhaps parse the map at setup and draw it to a background image/sprite and just draw that each frame?

Cheers

Pages: [1]