Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Flash Pool Game (converting to Unity)

Discussion in 'General Discussion' started by stratician, Feb 18, 2019.

  1. stratician

    stratician

    Joined:
    Feb 18, 2019
    Posts:
    1
    I was wondering if anyone has experience in porting a Flash Game (as3) to Unity. How does Unity compare to Flash in terms of performance.

    [mod edit: removed off topic advertising]
     
    Last edited by a moderator: Feb 18, 2019
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,584
    Flash generally is vector based. Which has several performance implications. This was one of the reason for nail in own coffin.

    Not sure. if there is direct converter of flash to Unity asset. These are completely different methods of making games. Because Unity natively operates on 2D sprites rather vector graphics, this is already by default light weight.

    Also, you would need have conversion from flash Action Script, to F# (where that F came from?:rolleyes:) C#. While logic itself lf can be moved/copied, used methods is another beast, on either side.

    Hence unless someone has indeed knows some converter tools, you may be better rewrite it in Unity from scratch.
     
    Last edited: Feb 19, 2019
  3. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    You're likely going to have to recreate the game in Unity, as the languages aren't the same, some of your assets will need to be remade, etc. Performance is hard to answer, as the same game in Unity can have wildly different performance depending on how you want it optimized.
     
  4. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,764
    Polygons are vector based too. Flash's performance issues came primarily from the fact that Flash was nightmarishly poorly optimized and also doing everything on the CPU back when there was a severe performance limitation there.
     
    Joe-Censored likes this.
  5. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,584
    While optimization in general was rather terrible, despite general lack of GPU support, there is significant difference between sprite with texture and vector graphics.

    Where sprite with texture is typically 4 vertices, and x*y resolution of texture plus UV; in flash with vector graphics you have n number of vertices (depending on details), to render colorful, or just simple image. Math had to calculate not only vertices positions, but as well curves, color shades and transitions. Of course, flash advantage was with scaling.

    But true, flash ads / games, were able kill any device performance, turning it in to snail speed. :rolleyes:

    However, this not meant to be topic about flash performance. It become a dinosaur anyway. :cool:
     
  6. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,764
    You are dramatically overestimating how expensive vector operations are and also misunderstanding how they're handled from an implementation standpoint.
     
  7. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,584
    Please stay on topic, instead bringing unnecessary vague thoughts.
    If you think you got anything valid to add, please post with details.
     
  8. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,150
    You are aware that the sole question from the OP has to do with performance, right? You can't compare the performance of two programs without understanding them both. Regardless vector graphics haven't been challenging on performance for decades now.

    Unity 2018 brought us vector graphics support (SVG file format) and a quick search resulted in at least one program that can convert Flash files to SVG files.

    https://forum.unity.com/threads/vector-graphics-preview-package.529845/
    https://www.google.com/search?q=flash2svg

    Everything else should already exist in a format capable of being read by Unity. Except scripts. While we're on the topic of scripts though here is a series of C# tutorials for people coming from AS3.

    https://jacksondunstan.com/articles/2634
     
  9. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,764
     
  10. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,584
    That is fine. As long responses are not personalized. Don't get me wrong, however, I really have trouble read response intentions, of dear colleague @Murgilod.

    The thing is, Adobe Flash along with lack of its optimization, which has been highlighted already, was before HTML5.
    And probably even before SVG tech (late 90's)? Hence possibly using "worse" algorithms. I got impression, there wasn't much of performance evolution over past 2 decades in AF, other than maintaining compatibility with older devices and adding new features. This however, may be hard to judge, as CPU capabilities sky rocketed. Sure Adobe tried implement later GPU support. But failed on compatibility issues, with multiple platforms.

    I could even go as far, as attempt to speculate, that older Unity Web Player, was much more performant than AF.
    If not for HTML5, I wouldn't be surprised, if Unity Web Player would take over in such case.

    But anyway,

    Looks so far, best option to import graphics, even by parts.
    But to me, seams still, most of things need to be done from scratch in Unity anyway.
     
    Last edited: Feb 19, 2019
  11. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,150
    Are you referring to SVG in the sense of the files? Or vector graphics in general? Because vector graphics as a technology has been in existence for almost as long as computers themselves with some of the earliest examples coming from the 1950s. Many of the techniques we use today came out not too long after that. Bézier curves, for example, are 1960s.

    Just imagine what would have happened had Unity been able to stick with the Web Player for longer than the browser manufacturers gave them. Unity's WebGL was not ready by the time the plugin was forced to stop functioning.

    Fortunately for the OP this isn't a problem now, but if they had showed up a few years ago it would have been.
     
    Last edited: Feb 19, 2019
  12. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,764
    You might want to factor in things like CPU performance gains over the past decade.
     
  13. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,584
    Sure, that what I meant by,
    Unless, I have not expressed my thought well, or I miss understood you, which could be the case, please feel free to comment.

    Valid point.
    Perhaps I should be more specific.
    What I am referring to, is how vector graphic is implemented by relevant technologies. Specifically, there could be significant differences, how algorithms are written and executed, now and back then, between FA, HTML5 and recently Unity.

    I don't want to go particular in details, as I have never had opportunity to look into source code of either. But if anyone got something interesting, sure you can share.

    I mean, yes it wasn't perfect, but it worked. None tech is perfect.
    But good thing is, we can show exist door to outdated techs :)

    And until HTML5 get old (?) ... and something else take over :cool:
     
  14. _Ric_

    _Ric_

    Joined:
    Apr 3, 2014
    Posts:
    6
    Yes, I have experience of having done this, several years ago. You might be surprised to learn that the performance wasn't that much different. Flash was actually rather good at pushing 2D graphics around a screen. With the greatest of respect to the comments above, you generally wouldn't use vector graphics in Flash games for anything other than menu screens - all game graphics would be converted to bitmap sprites, which the Flash Player could handle just fine. The other most intensive part of a pool game is the physics. Unity's great strength in 3D processing doesn't really help here either as the physics is done on the cpu, and AS3, once compiled was already pretty quick.

    Converting from AS3 to C#, by the way, is relatively easy - they are actually very similar languages. Apart from a few differences in the syntax, the structure of my code remained largely unchanged.

    Also as a long time maker of Flash pool games, I'd be interested to know which ones you made - I know I wasn't the only one making them, but there weren't that many of us!
     
    MikeFish likes this.
  15. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,764
    It was good at pushing sprites.

    No? Loads of Flash games were all vector based. Scalable vector graphics are part of why Flash was such a big deal. So much Flash content was pure vector that it's not even funny.

    Not really. Physics operations in 2D are pretty damn inexpensive, especially now.
     
  16. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,584
    I agree with @Murgilod .
    Myself I played tons of flash games in past, and I don't recall specifically any of them using raster graphics.
    I have been often experimenting with them, for example zooming in. And it worked well, since vectors.

    While this is most likely true, but the only physics were calculated, when balls were bouncing. Or at most, if there was trajectory prediction. So in case of 2D pool, physics probably really needed worry about, were circle - circle, circle - AABB, ray - circle, ray - AABB + extra ball pockets collision calc. And these most basics, are rather "cheap".
     
  17. _Ric_

    _Ric_

    Joined:
    Apr 3, 2014
    Posts:
    6
    If the performance wasn't important then it didn't matter so much. But for a graphically intensive game, raterizing vectors to bitmaps off screen (at runtime, but pre-game) and then 'blitting' them to the screen in-game was a very common technique. What's more, you'd still have the advantages of the vectors being scalable, because they could be scaled pre-rasterization. Even games that looked like they were purely vector based, would often use this to see massive speed increases.

    Frankly, if you weren't doing this, you weren't really optimising your game to it's full potential. I'm not saying that there weren't games which were purely vector based, but keep in mind my response was in the context of converting a Flash game to Unity, and whether there would be an improvement in performance. I could easily have said yes, there would be a massive increase in performance if the Flash game was poorly optimised to start with, but I don't think that would have been particularly useful to the OP. In my experience, based on porting my own game which was highly optimised, the improvement wasn't significant.

    I think that's what I said. After rendering, the physics is the next most intensive aspect of the game. My point was simply that Unity doesn't necessarily have an advantage over Flash in this respect, and in my tests there was no significant improvement.
     
    zombiegorilla likes this.
  18. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,764
    Yes, and there would be improvements. Dramatic ones. Because Unity is able to do things like "perform operations on the GPU without crashing" and "make use of modern game development techniques." What you're doing right here is saying "no, that doesn't matter, as I am a Flash expert and all games are incredibly well optimized" for some reason. But you know what?

    Even one of the most poorly optimized Unity projects will outperform the vast majority of Flash projects at this point. Because they're not all super well optimized. Most aren't even remotely well optimized.
     
  19. _Ric_

    _Ric_

    Joined:
    Apr 3, 2014
    Posts:
    6
    That's a reasonably accurate summary of what's going on, yes. Collision response calculations are only required when there is contact. Collision prediction is done by line-on-line and line-on-circle intersection tests, which have to be performed for each ball on each other ball, every frame. That's a slightly simplistic overview and there are many optimisations that can be made there but that's essentially it. As to whether those calculations are 'cheap' or not is I guess purely relative. It's cheap enough that Flash could handle it, but as I said previously, it was the second most intensive load on the processor after rendering.
     
  20. _Ric_

    _Ric_

    Joined:
    Apr 3, 2014
    Posts:
    6
    Actually I'm not saying either of those things, but nice attempt at trying to put words into my mouth. I'm talking specifically about my experience of a well optimised 2d billiards game made in Flash, which is certainly not 'purely vector based', and whether porting it to unity would see significant improvements in Flash, which is I believe what the OP asked about.

    I don't doubt it - even if it seems like an obvious point to make. But feel free to keep on trying to strawman me if you like, it's rather amusing.
     
  21. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,764
    My dude, you literally made a whole bunch of assumptions about what performance benefits the OP would see (the answers to this are, if you have to ask at all, numerous) and made a statement where you claimed that vector graphics typically only saw use in menus.
     
  22. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,000
  23. _Ric_

    _Ric_

    Joined:
    Apr 3, 2014
    Posts:
    6
    Of course I made assumptions, due to not knowing the precise game the OP was talking about and being not generally telepathic. In my defence I did ask him or her for more information about the game in my original response. And my assumptions were based on my experience of having done exactly what the OP was enquiring about, which I think is a reasonable starting point.

    I actually came here to offer my advice to the OP as someone with some experience in the field of his/her enquiry - I didn't actually come here to talk to you, but I get the impression that maybe you're a bit lonely so feel free to go ahead and demonstrate your expertise in this area and please by all menas continue to dissect every sentence I write and try to discredit me if that's what floats your boat.
     
  24. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,764
    If I did any meaningful dissection of the nonsense you've jumped in here with I'd be the only goddamn survivor.
     
  25. _Ric_

    _Ric_

    Joined:
    Apr 3, 2014
    Posts:
    6
    Well that's certainly an interesting response. I'm not going to go as far as saying it's a good one, but it's definitely interesting. Although perhaps, judging by the vitriolic and narcissistic undertone, every so slightly worrying. I mean, talking about being 'the only goddam survivor' in a simple discussion about porting a flash game to unity, seems like you're about to implode into a frenzied rage or something. And I'd hate to be the one who tips you over the edge.
     
    ScaniX and MikeFish like this.
  26. MikeFish

    MikeFish

    Joined:
    Oct 24, 2015
    Posts:
    12
    @Murgilod why are you so hostile? There is no reason for it at all.

    ah never mind, i checked your profile and saw that you are in rage in a lot of threads. Get help "my dude", it's not healthy living like that. seriously. I'm worried.
     
    AndersMalmgren likes this.
  27. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Dont mind him
     
  28. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,764
    lmao imagine thinking you know anything about me