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

Author Topic: c# example for particle system?  (Read 34117 times)

0 Members and 1 Guest are viewing this topic.

Mad

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • Email
c# example for particle system?
« on: August 27, 2013, 01:57:31 pm »
Hello!

I've found a lot of c++ examples for particle systems, but c++ is really not my passion.  ???

So can someone give me an example class for a particle system in C# ?

Thanks!!!  :)
best regards,

Mad

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: c# example for particle system?
« Reply #1 on: August 27, 2013, 02:18:38 pm »
C++ and C# are not that far apart, if you have a good example of a C++ version, it should be relatively easy to port it to C#.
Otherwise, I'm convinced you'll find a lot of examples by googling for example "particle system c#"
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Mister

  • Newbie
  • *
  • Posts: 22
  • Zomg
    • View Profile
Re: c# example for particle system?
« Reply #2 on: August 27, 2013, 04:26:18 pm »
I'd have to agree with eXpl0it3r.

But you could also take a stab at porting Mercury from XNA to SFML  :D
http://mpe.codeplex.com/
Check out My Blog.

Mister

  • Newbie
  • *
  • Posts: 22
  • Zomg
    • View Profile
Re: c# example for particle system?
« Reply #3 on: August 27, 2013, 07:50:53 pm »
But you could also take a stab at porting Mercury from XNA to SFML  :D
http://mpe.codeplex.com/

Hell yeah, that's what I'm looking for.  :)
but a port to c# might be a little bit to much work  :P ..... but those effects look great.

Well its already in C#  ;)
It'd have to be ported to SFML.

I have a project that I am going to start working on as soon as I get my head wrapped around SFML more and I was actually thinking about porting a lot of different things over to C#/SFML; one of those being a Particle System. I had my eyes set on DPSF (I've used it before when I was using XNA)... But! DPSF isn't open source :(. So I will probably soon be looking into Mercury (since its already C#).

Anything and everything that I port over to C#/SFML will be open for all to use -- I just need to learn more about SFML and then I can start converting different things over.  8)

I know you need a solution now but I'm not sure what else to do.  :-\
Check out My Blog.

Mad

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • Email
Re: c# example for particle system?
« Reply #4 on: August 27, 2013, 07:57:38 pm »
Quote from: Mister

Well its already in C#  ;)
It'd have to be ported to SFML.

yes, I saw it and that's why I removed my post  ::)

Quote from: Mister
Anything and everything that I port over to C#/SFML will be open for all to use -- I just need to learn more about SFML and then I can start converting different things over.  8)

lerning SFML it's also my part at the moment.
but less time as usal  :P

Quote from: Mister
I know you need a solution now but I'm not sure what else to do.  :-\

Nooo! Not now, but in a few weeks it would be ok.  8)
best regards,

Mad

Mister

  • Newbie
  • *
  • Posts: 22
  • Zomg
    • View Profile
Re: c# example for particle system?
« Reply #5 on: August 27, 2013, 08:07:06 pm »
Quote from: Mad
yes, I saw it and that's why I removed my post  ::)
Haha, I thought it was weird that your post disappeared!

Quote from: Mad
lerning SFML it's also my part at the moment.
but less time as usal  :P
Yeah I'm a full time software engineer so I have little time to play too  :'(

Quote from: Mad
Nooo! Not now, but in a few weeks it would be ok.  8)
I can't/won't make any promises but I can see if getting a particle system working for SFML .Net could the first adventure I take.

I was just taking a look at Mercury and it seems pretty robust -- they even have a particle editor! That would definitely be a cool thing to carry over... This will be an interesting task...  ;D
« Last Edit: August 28, 2013, 03:36:42 pm by Mister »
Check out My Blog.

Mad

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • Email
Re: c# example for particle system?
« Reply #6 on: August 28, 2013, 10:53:52 am »
Quote from: Mad
lerning SFML it's also my part at the moment.
but less time as usal  :P
Yeah I'm a full time software engineer so I have little time to play too  :'(

Me too! You are wellcome!  ;D

Quote from: Mister
I was just taking a look at Mercury and it seems pretty robust -- they even have a particle editor! That would definitely be a cool thing to carry over... This will be an interesting task...  ;D

no need to convert the editor, because gui development is no fun at all in my opinion....  :o
But I agree, the mercury editor is still a little buggy....  :-\

Quote from: Mister
Edit:
Alright so while I wait for other things to transpire -- I decided to start a port of Mercury to SFML. You can check it out here:
https://sourceforge.net/projects/mpesfml/

Cool. But no download yet?  ;)

Quote from: Mister
It's going to be a pain because I want to strip out the 3D portion and just leave the 2D portion there.

I have a short look in the source code, seems there are only 4 classes for the main parts (particle.cs, ParticleEffect.cs, ParticleEffectManager.cs and SpriteBatchRenderer.cs)
all other stuff is only 'nice to have'  ;)
best regards,

Mad

Mister

  • Newbie
  • *
  • Posts: 22
  • Zomg
    • View Profile
Re: c# example for particle system?
« Reply #7 on: August 28, 2013, 01:06:54 pm »
Alright so it turns out the idea of porting Mercury over to SFML is completely out-of-scope. I am going to be looking into alternatives.
« Last Edit: August 28, 2013, 03:37:55 pm by Mister »
Check out My Blog.

Mad

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • Email
Re: c# example for particle system?
« Reply #8 on: August 28, 2013, 04:29:16 pm »
Alright so it turns out the idea of porting Mercury over to SFML is completely out-of-scope. I am going to be looking into alternatives.

 :-\ bad luck.
But maybe only some good explosion, smoke and fire effects in c#? Heeelp  :)
best regards,

Mad

Mister

  • Newbie
  • *
  • Posts: 22
  • Zomg
    • View Profile
Re: c# example for particle system?
« Reply #9 on: August 28, 2013, 04:44:40 pm »
Alright so it turns out the idea of porting Mercury over to SFML is completely out-of-scope. I am going to be looking into alternatives.

 :-\ bad luck.
But maybe only some good explosion, smoke and fire effects in c#? Heeelp  :)

Yeah when going through it I realized that it was tightly coupled to XNA -- I just don't have time to sift through it. I am actually working on my own particle system right now; strictly 2D.
Check out My Blog.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: c# example for particle system?
« Reply #10 on: August 28, 2013, 05:14:32 pm »
You can also have a look at my C++ implementation of Thor.Particles (API documentation, tutorial, code). Even though the current status allows a lot of customization and flexibility, the basic principle is rather simple:

  • The class thor::Particle represents a particle with attributes like position, color, etc.
  • Emitters and affectors are represented with std::function, you could take delegates for C#. Or you take the classical approach of interfaces that are implemented by the user.
  • The class thor::ParticleSystem stores particles, affectors and emitters. It uses sf::VertexArray for rendering, the emitters and affectors are invoked in every update() call.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

SymegPL

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: c# example for particle system?
« Reply #11 on: August 28, 2013, 09:16:21 pm »
You can look at my implementation at: https://github.com/Symeg/Smart2DGameFramework/tree/master/Smart2DGameFramework/Graphics/Particles
Demo on youtube (fire particles, old video, now is better performance)

You can also find other useful tools :)
« Last Edit: August 28, 2013, 09:18:34 pm by SymegPL »

Mister

  • Newbie
  • *
  • Posts: 22
  • Zomg
    • View Profile
Re: c# example for particle system?
« Reply #12 on: August 29, 2013, 03:15:18 am »


Looking good so far -- I'd say. Theres a few things that I need to work out but so far so good.  ;D

EDIT:
Heres another shot of it:
« Last Edit: August 29, 2013, 03:44:10 am by Mister »
Check out My Blog.

Mad

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • Email
Re: c# example for particle system?
« Reply #13 on: August 29, 2013, 10:15:38 am »
@Nexus
Thanks for your information. I had a look at Thor early. It's a pitty there is no C# clone  :-\
But it seems to be a very useful library!!

@SymegPL
Hey, thanks for sharing. I will have a look at your lib. Is the client/server part stabil?

Mister
Nice one!  :D
Can you tell me, what are you using? Sprites or only Vertex?
As I can see from your blog,you have plans to make a Top Down Shooter shooter? Maybe we can stick together?
I have plans to make also a shooter...but Left Right  ;D my first idea was an uridium clone with much more features.
http://en.wikipedia.org/wiki/Uridium
Maybe we can combine Top Down Shooter with Top Down and double knowledge?  8)
best regards,

Mad

Mister

  • Newbie
  • *
  • Posts: 22
  • Zomg
    • View Profile
Re: c# example for particle system?
« Reply #14 on: August 29, 2013, 02:32:29 pm »
As I can see from your blog,you have plans to make a Top Down Shooter shooter? Maybe we can stick together?
I have plans to make also a shooter...but Left Right  ;D my first idea was an uridium clone with much more features.
http://en.wikipedia.org/wiki/Uridium
Maybe we can combine Top Down Shooter with Top Down and double knowledge?  8)
I can't really agree to start this new project as a team effort.. not at this time at least. That isnt to say that we can't help each other out with our individual games though.  :)

The game that originally inspired me was a game made by one of my friend's brother back in high school.


Mister
Nice one!  :D
Can you tell me, what are you using? Sprites or only Vertex?
The way it sits right now -- its renderer agnostic. The only thing it currently focuses on is the underlying numbers that all particles deal with. You can then tell your images to draw accordingly.

I will have the source code up as soon as I get a decent example running.  :D
Check out My Blog.

 

anything