As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/
Options

Game Dev - Unreal 4.13 Out Now!

19091939596100

Posts

  • Options
    KashaarKashaar Low OrbitRegistered User regular
    Hey guys! I just published part two of my three-part tutorial series on how to math things for super-sexy movement using UE4 blueprints. As before, the tutorial is aimed at beginners, so I go pretty in-depth on all the concepts and thoughts behind things. Still, it might be interesting for you!

    http://www.broad-strokes.com/2016-05/make-floating-rocks-with-the-power-of-math-part-2/

    Indie Dev Blog | Twitter | Steam
    Unreal Engine 4 Developers Community.

    I'm working on a cute little video game! Here's a link for you.
  • Options
    RoyceSraphimRoyceSraphim Registered User regular
    With an older (7 years) pc, once I finish this personal project in gamemaker, what is another good system to push my coding skills out of skilled beginner to intermediate?

    C++ (knowing what you people have said these past few pages)
    UDK
    Unity?

    Remember that I have a 7 year old rig and U4 is probably a big no no.

  • Options
    templewulftemplewulf The Team Chump USARegistered User regular
    With an older (7 years) pc, once I finish this personal project in gamemaker, what is another good system to push my coding skills out of skilled beginner to intermediate?

    C++ (knowing what you people have said these past few pages)
    UDK
    Unity?

    Remember that I have a 7 year old rig and U4 is probably a big no no.

    I've heard UE4 is actually pretty scalable, but I'd recommend doing a 2D project in Unity anyway. It has better support for 2D than UE (AFAIK, feel free to correct me), and I always love C# and Visual Studio.

    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • Options
    HandkorHandkor Registered User regular
    I have a 7 year old rig, an i7 920. I've upgraded my videocard to a 750Ti from a GTX260 and UE4 runs great. Same thing on my wife's older pc which had a gtx9800. UE4 scales really well and can target DX9 machines. You can also target mobile which are even more limited.

  • Options
    MelksterMelkster Registered User regular
    edited May 2016
    edit: Derp, accidentally hit Post way too early on this one. Finishing the whole thing now...

    Melkster on
  • Options
    RoyceSraphimRoyceSraphim Registered User regular
    Athlon 4800+
    Radeon 4850 512mb
    4 gig ram

    Keeps me safe from the gifting in the steam thread, except for scratchy.

  • Options
    UselesswarriorUselesswarrior Registered User regular
    That amount of ram is going to be kind of rough for dev work. But I could be just spoiled by 16gig.

    The Unity social API has a shocking lack of documentation around it, which really sucks because there is no really way to test leaderboard stuff until you have live players. Anyone have any experience with using it to power gamecenter stuff?

    Hey I made a game, check it out @ http://ifallingrobot.com/. (Or don't, your call)
  • Options
    HandkorHandkor Registered User regular
    Yeah your limiting factor is the 4GB of ram. You can probably bump that up very cheaply.

  • Options
    KupiKupi Registered User regular
    Kupi's Friday Status Report

    This was a poor week for me in terms of motivation; sleepless and malaise combined with some teething pains regarding the use of the Unreal Engine to put me off wanting to make progress, much less actually managing to do so.

    Let's start with one of the problems with C++ that I forgot to mention in my last rant on the subject: compile times. They're by no means unbearable with the standard workflow in C++, but there's a definite lag time between hitting "build" and getting a verdict that's just long enough to tempt one to drift off into a browser. And I'm confident that this can be blamed on the language itself; I'm not the only one I've ever heard remark that C++'s method of forward declaration and division of labor in its pipeline leads to protracted compile times relative to other languages, and C# (in the context of Unity and otherwise) assembles your stuff more or less before you're done standing up to go get coffee. For recompiling individual component classes, this is tolerable, but in aggregate I suspect this is going to produce a lot of frustration.

    As for why I'm still talking about C++, it's because I've already abandoned the idea of implementing the Hamsterball's behavior in Blueprint. It's not impossible, certainly, but the pseudocode I wrote out that handles all the necessary logic after taking Unreal's idiosyncrasies into account, was around 80 lines long (most of which could not be further compressed to sub-routines) just for Tick. As many of these lines entailed += operations and in-line multiplications that would expand into four to six Blueprint nodes apiece, the resulting graph would be... voluminous.

    And attempting to write classes in code led me into a pretty bewildering situation. It is inordinately difficult to delete a class in Unreal! If you've added a class through the "Add a new C++ class..." option, you can't actually delete it in the editor. In fact, you can't delete it in the solution explorer in Visual Studio, either. That merely removes the files from being listed in the solution explorer; they still exist on the disk and get built by the separate Unreal build process. Per the instructions here (and the number of similar questions on the Unreal Q&A system is kind of damning), you have to shut down Unreal entirely, delete the files in Windows Explorer, delete the intermediate files produced by the build process, then re-run the build process to it notices that they're gone, and only then reload the editor. Incidentally, I screwed up those steps on my own, and wound up in a state where a zombie build executable was locked on some Windows resource and refused to shut down even with the "End Process" button in Windows Explorer. Since only one of those is allowed to exist at once, I was locked out of Unreal Engine until I did a full reboot of my computer.

    Even Blueprint Classes aren't exempt from this frustation; though you are allowed to delete them, they'll leave a "redirect" file behind that serves to keep other classes that referred to it from exploding. Which means that if you delete a Blueprint Class, it won't appear in your browser, at all, anywhere, but when you try to create a new class with that same name, it says "I can't create that! It already exists!"

    I hate it when computers tell you things that aren't true.

    And one final nuisance that I only just now remembered, before hitting post: the coordinate axes. Unreal is defined with X as left-to-right, Z as bottom-to-top, and Y as into-the-screen. When you're trying to build a 2D game, this is kind of annoying to deal with because when you only have two axes, "up" is naturally Y. That's not to say that I couldn't put everything on the X-Y axis, but the in-editor navigation locks the camera angle on the z-axis, and the built-in skybox tool also assumes the Z axis is up. So all the calculations for this 2D movement logic have to take place in 3D-aware math.

    Hopefully this coming week will see some actual progress on Hamsterball (Unreal Version).

    My favorite musical instrument is the air-raid siren.
  • Options
    PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    So I believe that the blueprint file only gets left behind if there are any references to it (which the editor at least used to tell you about)

  • Options
    LaCabraLaCabra MelbourneRegistered User regular
    Right click a folder -> fix up redirectors in folder

  • Options
    RoyceSraphimRoyceSraphim Registered User regular
    edited May 2016
    Well, took a few days off from the forums to really work and earn a paycheck, and really hammer this home.

    Realized that I put too much up on the parent enemy type for scripting damage and not enough in general terms.

    Still, at a good point to move forward, and finally got over my animation hangup.
    if sprite_index != (boss_attack_anim)
        {
        sprite_index = boss_attack_anim;
        image_index = 0;
        }
    


    For some reason, nesting it inside an If statement to check if the animating was the attack animation worked. I'm not questioning why, I'm just moving forward. Still need to figure out how to make the generic enemies stop flying in the air when they spawn on top of one another.

    RoyceSraphim on
  • Options
    KupiKupi Registered User regular
    I have a feeling that this is much easier to do than my searching is making it sound like.

    In UE4, I want to visualize my custom components in the editor using the Debug Draw functions (I have a ball and some surfaces in 2D, so Draw Circle and Draw Line suffice). Event Tick is wrong because it only takes place during the actual gameplay. The Construction Script is the wrong place for it, because that only runs each time you tweak the object. I'd like to be able to render them persistently (and I'm not using models yet because I need to be able to see what the actual underlying data is). And looking through whatever comes up for "Event" doesn't turn up anything that sounds like it's what I'm looking for.

    In short, I'm looking for Unity's OnDrawGizmos(), where they said "Okay, we're doing an editor-only draw. Call your favorite draw functions now." It seems trivial enough that it can't possibly be missing.

    Which event or function am I missing?

    My favorite musical instrument is the air-raid siren.
  • Options
    KashaarKashaar Low OrbitRegistered User regular
    Kupi wrote: »
    I have a feeling that this is much easier to do than my searching is making it sound like.

    In UE4, I want to visualize my custom components in the editor using the Debug Draw functions (I have a ball and some surfaces in 2D, so Draw Circle and Draw Line suffice). Event Tick is wrong because it only takes place during the actual gameplay. The Construction Script is the wrong place for it, because that only runs each time you tweak the object. I'd like to be able to render them persistently (and I'm not using models yet because I need to be able to see what the actual underlying data is). And looking through whatever comes up for "Event" doesn't turn up anything that sounds like it's what I'm looking for.

    In short, I'm looking for Unity's OnDrawGizmos(), where they said "Okay, we're doing an editor-only draw. Call your favorite draw functions now." It seems trivial enough that it can't possibly be missing.

    Which event or function am I missing?

    You're looking for the "Hidden in game" flag that every component has. Then you can use meshes, arrows or whatever to illustrate your stuff, and they will not be rendered in game. Toggle display of all things hidden in game with the G key!

    Indie Dev Blog | Twitter | Steam
    Unreal Engine 4 Developers Community.

    I'm working on a cute little video game! Here's a link for you.
  • Options
    RoyceSraphimRoyceSraphim Registered User regular
    edited May 2016
    I've hit the same point in Gamemaker that I hit when I learned ArcGIS and python, everything I'm doing now makes everything I did before look like hot garbage that's poorly organized.

    Now to decide if I want to work on my old spawners to choose from two types of enemies and spit them out based on probablity (again, modeled after the original kung fu) or create a new spawner for the second type of enemy.

    edit: I also figured out how to stop my secretaries from piggybacking on one another and bouncing into oblivion. I just set their horizontal speed to 0 until there was no one beneath them.

    RoyceSraphim on
  • Options
    KashaarKashaar Low OrbitRegistered User regular
    Well, that was an interesting few days. Apparently my website was hacked, or fell prey to a malicious WordPress plugin. So instead of working on tutorial part 3 like I'd planned over the weekend, I spent all of it removing php injection bullshit, and then decided to nuke the whole site from orbit. Screw WordPress and its php crap, I said! So I went and learned all I could about Jekyll. If you don't know it, it's a static site generator... Traditional CMS like Wordpress keep your content stored in a database, so that when someone wants to load a page some server-side php code is executed to retrieve the data from the db, and then parse it using theme templates before that's delivered to the user in their browser. Every time a page is accessed.
    Static site generators offload all of that into a compilation step, meaning the data, which is usually stored in text files, is converted into a folder structure of static .html pages, which can then be put on a server.
    This has a number of advantages. One, the server doesn't have as much to do, and page payloads are much smaller. More importantly in my case, no code is executed on the server at runtime, which means that malicious code can't get executed either.
    It's faster, and more secure! For the price of working with text files instead of a CMS.

    The point of all this: I have a fancy new website, and maybe you'll find some of the content useful! http://www.broad-strokes.com

    Beware the malware warning - everything has been thoroughly cleaned, but of course blacklist removal review processes take their sweet time... So the site is still indexed until that goes through in a few days. (If anyone here has any experience with that, do let me know?)

    In other gamedev news, crunch time is the worst even for freelancers, because sometimes three separate clients decide that they need something next weekend all at the same time... /me stocks up on coffee

    Indie Dev Blog | Twitter | Steam
    Unreal Engine 4 Developers Community.

    I'm working on a cute little video game! Here's a link for you.
  • Options
    templewulftemplewulf The Team Chump USARegistered User regular
    Kashaar wrote: »
    Well, that was an interesting few days. Apparently my website was hacked, or fell prey to a malicious WordPress plugin. So instead of working on tutorial part 3 like I'd planned over the weekend, I spent all of it removing php injection bullshit, and then decided to nuke the whole site from orbit. Screw WordPress and its php crap, I said! So I went and learned all I could about Jekyll. If you don't know it, it's a static site generator... Traditional CMS like Wordpress keep your content stored in a database, so that when someone wants to load a page some server-side php code is executed to retrieve the data from the db, and then parse it using theme templates before that's delivered to the user in their browser. Every time a page is accessed.
    Static site generators offload all of that into a compilation step, meaning the data, which is usually stored in text files, is converted into a folder structure of static .html pages, which can then be put on a server.
    This has a number of advantages. One, the server doesn't have as much to do, and page payloads are much smaller. More importantly in my case, no code is executed on the server at runtime, which means that malicious code can't get executed either.
    It's faster, and more secure! For the price of working with text files instead of a CMS.

    The point of all this: I have a fancy new website, and maybe you'll find some of the content useful! http://www.broad-strokes.com

    Beware the malware warning - everything has been thoroughly cleaned, but of course blacklist removal review processes take their sweet time... So the site is still indexed until that goes through in a few days. (If anyone here has any experience with that, do let me know?)

    In other gamedev news, crunch time is the worst even for freelancers, because sometimes three separate clients decide that they need something next weekend all at the same time... /me stocks up on coffee
    I prefer Middleman, myself, but I was also focusing on Rails for my day job for a while. Did you ever figure out the WordPress attack vector? I know a few small business clients who are on it, and I should probably stay on top of these things.

    Twitch.tv/FiercePunchStudios | PSN | Steam | Discord | SFV CFN: templewulf
  • Options
    MelksterMelkster Registered User regular
    edited May 2016
    Wierd question, but has anyone here been playing with Vulkan at all?

    I'm getting started with a rewrite of a project, and I've started with SDL2 for creating a window and handing input, and OpenGL for rendering. But I've started to look longingly at Vulkan... Rumor has it that they've fixed a bunch of wierd things that make OpenGL annoying to work with, which would seem to make it a more desirable option for a brand new project. But at the same time, it's a lot lower level and more verbose than OpenGL.

    Hmm.

    Edit: Just to say a bit more about this--I'm toying with the idea of building a 2d game that's designed for a pixely look -- probably something like half the resolution of the user's display. But with every possible procedurally-generated bell and whistle. I'd like for sprites not to just ALWAYS be fully lit, which makes the artist responsible for basically baking lighting information into a sprite (which is hard). I'd like for the artist to define a number of maps for a sprite -- diffuse, specular, emissive, normal, etc -- and then combine them all in the engine. I'm also considering having the artist create various LOD textures, so a sprite looks pixel perfect even if it's placed at different distances from the camera (probably with the distance generated with a simple step function, so as to avoid not-pixel perfect LODs). I'm also toying with the idea of integrating Spline as well.

    Melkster on
  • Options
    KashaarKashaar Low OrbitRegistered User regular
    templewulf wrote: »
    Kashaar wrote: »
    Well, that was an interesting few days. Apparently my website was hacked, or fell prey to a malicious WordPress plugin. So instead of working on tutorial part 3 like I'd planned over the weekend, I spent all of it removing php injection bullshit, and then decided to nuke the whole site from orbit. Screw WordPress and its php crap, I said! So I went and learned all I could about Jekyll. If you don't know it, it's a static site generator... Traditional CMS like Wordpress keep your content stored in a database, so that when someone wants to load a page some server-side php code is executed to retrieve the data from the db, and then parse it using theme templates before that's delivered to the user in their browser. Every time a page is accessed.
    Static site generators offload all of that into a compilation step, meaning the data, which is usually stored in text files, is converted into a folder structure of static .html pages, which can then be put on a server.
    This has a number of advantages. One, the server doesn't have as much to do, and page payloads are much smaller. More importantly in my case, no code is executed on the server at runtime, which means that malicious code can't get executed either.
    It's faster, and more secure! For the price of working with text files instead of a CMS.

    The point of all this: I have a fancy new website, and maybe you'll find some of the content useful! http://www.broad-strokes.com

    Beware the malware warning - everything has been thoroughly cleaned, but of course blacklist removal review processes take their sweet time... So the site is still indexed until that goes through in a few days. (If anyone here has any experience with that, do let me know?)

    In other gamedev news, crunch time is the worst even for freelancers, because sometimes three separate clients decide that they need something next weekend all at the same time... /me stocks up on coffee
    I prefer Middleman, myself, but I was also focusing on Rails for my day job for a while. Did you ever figure out the WordPress attack vector? I know a few small business clients who are on it, and I should probably stay on top of these things.

    Sadly not. The malware was this little bugger (link is to an article about it), and I assume that the vector was either a malicious plugin, or a vulnerability in a plugin. I'd just installed a bunch of small plugins for things like table of contents and spoiler tags a little before it happened, so it was probably one of those. My bad for thinking that plugins in the official WordPress listings would receive any kind of auditing... ;-)

    Indie Dev Blog | Twitter | Steam
    Unreal Engine 4 Developers Community.

    I'm working on a cute little video game! Here's a link for you.
  • Options
    ThendashThendash Registered User regular
    @Kashaar Except for the first screenshot on each game page, opening the high res screenshots brings me to a page not found.

  • Options
    KashaarKashaar Low OrbitRegistered User regular
    Thendash wrote: »
    @Kashaar Except for the first screenshot on each game page, opening the high res screenshots brings me to a page not found.

    D'oh. Thanks for catching that! Those are mostly direct exports from the old site, as evidenced by the poor screenshot gallery layouts... Will fix!

    Indie Dev Blog | Twitter | Steam
    Unreal Engine 4 Developers Community.

    I'm working on a cute little video game! Here's a link for you.
  • Options
    KupiKupi Registered User regular
    Okay, I have tried UE_LOG(), I have tried GEngine->AddOnScreenDebugMessage(), I have opened the output window, I have toggled my build configurations, I have checked my .inis, why the fuck won't Unreal print anything to the goddamned console jdflaksjdflkjalsdkjflhomerowkeyboardsmash

    My favorite musical instrument is the air-raid siren.
  • Options
    KashaarKashaar Low OrbitRegistered User regular
    Kupi wrote: »
    Okay, I have tried UE_LOG(), I have tried GEngine->AddOnScreenDebugMessage(), I have opened the output window, I have toggled my build configurations, I have checked my .inis, why the fuck won't Unreal print anything to the goddamned console jdflaksjdflkjalsdkjflhomerowkeyboardsmash

    Are you using a packaged shipping build? Because debug log messages are disabled in those.

    Indie Dev Blog | Twitter | Steam
    Unreal Engine 4 Developers Community.

    I'm working on a cute little video game! Here's a link for you.
  • Options
    KupiKupi Registered User regular
    edited May 2016
    I have been using whatever you get from choosing a New Blank C++ Project, and generally going out of my way to avoid changing any settings to keep from getting into a situation I can't adequately describe.

    EDIT: I have resolved the issue. The line I thought was unavoidable was, in fact, not being reached, and the character movement I observed was due to a test line further down. To summarize: I am an idiot.

    Kupi on
    My favorite musical instrument is the air-raid siren.
  • Options
    PierceNeckPierceNeck Registered User regular
    Is RPG Maker worthwhile at all? I already have it from some bundle I picked up at some point. I wanted to just mess around and make a 2d RPG (I probably wont get very far into it at all) and was just wondering if that's decent for someone who's never done anything like this before. Or will it just lead to bad habits, etc?

    steam_sig.png
  • Options
    RoyceSraphimRoyceSraphim Registered User regular
    Final level of Dark Forces is certainly a thing. Currently got stuck in conveyor belt leading to swarm of fucking mines.

  • Options
    ThendashThendash Registered User regular
    @PierceNeck Go for it man. If you want to make a game then make it, engine doesn't matter. I got my start programming using RPGToolkit with its own proprietary language, and then moved on to Gamemaker with its own proprietary language, now I'm fluent in Java and C#. I wouldn't really say they taught me any bad habits. Instead I'd say they taught me a lot of basic concepts that don't always come natural to people(variable scope, method calls, etc) and that helped out a lot when I went on to take comp sci in college.

  • Options
    PierceNeckPierceNeck Registered User regular
    Thanks! I was just worried it might be one of those things that gets you so used to shortcuts you'll get stuck if you move to anything else and have to reteach yourself from the ground up.

    steam_sig.png
  • Options
    KashaarKashaar Low OrbitRegistered User regular
    PierceNeck wrote: »
    Thanks! I was just worried it might be one of those things that gets you so used to shortcuts you'll get stuck if you move to anything else and have to reteach yourself from the ground up.

    As with all things: Only if you let it! :)

    Indie Dev Blog | Twitter | Steam
    Unreal Engine 4 Developers Community.

    I'm working on a cute little video game! Here's a link for you.
  • Options
    KoopahTroopahKoopahTroopah The koopas, the troopas. Philadelphia, PARegistered User regular
    PierceNeck wrote: »
    Thanks! I was just worried it might be one of those things that gets you so used to shortcuts you'll get stuck if you move to anything else and have to reteach yourself from the ground up.

    Also worth noting that our resident hint maker mentioned something about Game Maker getting a big buff sometime soon. I also like Game Maker as it's really simple to prototype something with very little to no coding knowledge. A great tool to use.

  • Options
    KupiKupi Registered User regular
    Honestly, the only thing I would worry about with RPG Maker is that if you're making something you intend to publish to a broad audience, the fact that you made the game in RPG Maker will be immediately obvious, and the engine carries something of a stigma of being used to make awful, samey JRPGs or visual novels. (I distinctly recall having gone through a swath of RPG Maker games that hadn't bothered to give the main character a different skill than the demonstration "Cross Slash - The Hero's special skill, effective against Undead!".) But if you are just starting out, mass publication is probably the last thing you need to be thinking about, and no skill you gain by learning about tracking variables and scripting event interactions in an unfamiliar interface will be wasted effort.

    ***

    On an unrelated note, it's time for the

    Kupi's Weekly Friday Status Report

    The week started out well (save for Danganronpa 2 eating the entire weekend), with decent time investments into Unreal and Blender on Monday, and then things tapered off sharply over the rest of the week as I encountered various frustrations.

    As expected, I wound up commiting an index-out-of-range error within the first five minutes of starting to write C++ code, and to Unreal's credit, the TArray type actually has rigorous bounds-checking. But what surprised me was that the exception it threw brought down the editor with it. We're not talking about code that was running within the editor, like a GUI plugin I'd rigged up or something, we're talking about the game code that was running in Play In Editor took the editor down with it and kicked me back to my last auto-save. It's fortunate that I have been rigorously re-compiling after every three to five lines of code and making sure that the behavior is as expected, because I was not given any other indication of what exactly had failed. Unity, by contrast, automatically catches exceptions in client code and writes them to the console (with a full stack trace) so you can figure out what happened.

    Though I had some trouble getting logging to work (and the UE_LOG macro still sends my text off into a hollow void), the problem was ultimate that an if-statement I'd thought was guaranteed to pass through on most calls to TickComponent() was actually utterly impossible to clear, so on that matter all the frustration I experienced was my own goddamned fault.

    As it stands, visualizing an object immediately in the editor still eludes me. However, I do know that a BoxComponent will do it, which means there must be something going on behind the scenes that I can mimic. This whole "when it doesn't work, you can read the source code!" ethos is starting to wear on me, though. I would prefer it actually worked.

    Turning aside from my incessant bitching for a moment, the good news is that I've found the way to mimic the querying behavior I was using in Unity to quickly find "Surface" objects (which are the walkable bits of land in the Hamsterball system) that are near the Hamsterball. The BoxOverlapComponents() function in the kismet library (and its older brother, BoxOverlapActors()) did actually turn out to be a query into the physics system. So, I decided to make my SurfaceComponent class inherit from BoxComponent, set it to "Query Only", and gave it its own private Object Type that nothing else can collide with. While I still haven't gotten the overlap function to return anything, I think that's because I'm still passing the wrong Object Type into the query, which makes sense-- the Object Type enum in code is just a series of values called "Object Type ##". I suspect I'm putting the system to some off-label usage.

    Fortunately, the BoxOverlapComponents() problem is the last point at which the Unreal Engine can make a nuisance of itself; the remainder of any problems with getting a Hamsterball prototype rolling are projected to be the result of my own stupidity. See you next week.

    My favorite musical instrument is the air-raid siren.
  • Options
    RoyceSraphimRoyceSraphim Registered User regular
    edited May 2016
    PierceNeck wrote: »
    Thanks! I was just worried it might be one of those things that gets you so used to shortcuts you'll get stuck if you move to anything else and have to reteach yourself from the ground up.

    At a panel at pax from City of Heroes, one panelist stated it was easier to find someone with passion and teach them the tools than to find someone who knew how to use the tools and teach them passion.

    Code is code in the end and what you really will learn that will translate better to other engines and systems is to how to properly map out your ideas/problems/obstacles into things that can be created/solved/reshaped in those engines.

    RE:Angry Office Lady
    I have started on the second level, and now want another type of enemy drop from my spawners rather than create an entirely new spawner for that one specific enemy. The idea issue would have the code drop from a pool of [G, G, G, G, G, G, G, G, S, S] with S being new and G being old.

    But what I'm really thinking is that I'll just take my old random spawntimer number and
    if (spawntimer >= 4) instance_create(x, y, S)
    else instance_create(x, y, G)
    


    edit:
    I used this video to teach me about randomize() to get proper random numbers and forgot to actually code the new enemy into the spawner. She worked fine except for the attack animation code still have a line that was basically "else (look like another enemy)"

    Current issues:
    Enemies furthest or last in line don't animate until they switch to the arms up position
    Boss' attack frame still lingers after death for about a frame. Adding
    if (instance_exists(obj_enemy_boss_attackframe instance_destroy();
    
    to the boss' death code didn't solve the issue.

    RoyceSraphim on
  • Options
    MelksterMelkster Registered User regular
    So, in case anyone ever has an interest in learning OpenGL... I have an answer. You should absolutely use http://www.learnopengl.com/

    I've been scouring the web this past week, looking for good tutorials, getting a bit into them, then realizing that they've recommended terrible things, or explained things poorly. But that website is pretty much perfect, at least so far. The articles are very well written, first of all. Explanations are crystal clear, and appear to be accurate from what I've gathered from other material. They also do NOT focus on some older, non-modern ways of writing OpenGL (fixed function calls, or anything outside of 3.3 Core).

    Which, by the way, if you're getting started with Open GL... I'm 99% sure that you're safe coding for OpenGL 3.3 Core. It's fully compatible with OpenGL ES 2, which means your codebase should work out of the box on iOS and Android (minus some extensions, I think?). And it is fully compatible with the version of Mac OS X that 95+% of steam users use, based on what I can gather from the Steam hardware survey (Mavericks and higher). On PC, it's been supported for a very long time. I did not look into Linux support.

    Also... About what I said about Vulkan above... I looked into it and promptly realized that it's way, way, way too low level. It's the new hotness, but ... not ready for Indie schlubs like me.

  • Options
    KhavallKhavall British ColumbiaRegistered User regular
    So I saw a tweet about how great Unity Events and Delegates are for dealing with Callbacks.

    And after looking them up and re-doing some stuff, holy shit you guys Events and Delegates are so great for dealing with callbacks.

    Like I had a Manager that was sending out a virtual void for objects, had to store the objects, contain a reference for them when they were created, check to make sure they were active, and be updated when there were changes.

    Turns out I can do it just by creating a single event and then having those objects subscribe to them.

  • Options
    MahnmutMahnmut Registered User regular
    Event systems are super good for reducing coupling and improving flexibility

    Steam/LoL: Jericho89
  • Options
    MelksterMelkster Registered User regular
    I grew really frustrated with events in Unity.

    A much cleaner design, IMO, is to just link user actions directly with method calls. There's no need for setting up event handlers, really. Events make way more sense in an environment that was built from the ground up to work with them -- Node.js for example -- and lose much of their value in C#.

    I dunno. My project ended up being littered with events and callbacks, and it became a really confusing mess. Events by their very nature are hard to follow. It's difficult to exactly follow the path of execution around your code base.

    Also remembering to unbind events is super annoying.

  • Options
    GnomeTankGnomeTank What the what? Portland, OregonRegistered User regular
    edited May 2016
    If you want to reduce coupling for real use a pub-sub event system, which is very easy to write in Unity/C#. In fact, here, I wrote one and you can just use it. This is meant to be used in place of the ridiculously slow SendMessage in Unity, and in place of the tight coupling caused by ICustomMessageTarget. It supports both immediate execution and delayed execution using coroutines.
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    
    namespace Assets.Engine.Core {
        public class EventManager : Singleton<EventManager>, IEventPublisher {
            private readonly Dictionary<Type, PubSubEventBase> _events = new Dictionary<Type, PubSubEventBase> ();
    
            protected EventManager () {
            }
    
            void IEventPublisher.Publish<TMessage> (PubSubEventBase evt, TMessage message, IEnumerable<Action<TMessage>> subscribers) {
                if (evt.IsImmediate) {
                    foreach (var subscriber in subscribers) {
                        PublishImpl (evt, message, subscriber);
                    }
                }
                else {
                    StartCoroutine (PublishCoroutine (evt, message, subscribers));
                }
            }
    
            public TEvent GetEvent<TEvent> ()
                where TEvent : PubSubEventBase, new () {
                if (!_events.ContainsKey (typeof (TEvent))) {
                    _events[typeof (TEvent)] = PubSubEventBase.Create<TEvent> (this);
                }
    
                return (TEvent) _events[typeof (TEvent)];
            }
    
            private IEnumerator PublishCoroutine<TMessage> (PubSubEventBase evt, TMessage message, IEnumerable<Action<TMessage>> subscribers) {
                foreach (var subscriber in subscribers) {
                    PublishImpl (evt, message, subscriber);
                    yield return null;
                }
            }
    
            private void PublishImpl<TMessage> (PubSubEventBase evt, TMessage message, Action<TMessage> subscriber) {
                try {
                    subscriber (message);
                }
                catch (Exception ex) {
                    Debug.LogWarningFormat ("Error processing handler for {0}: {1}", evt.GetType ().Name, ex);
                }
            }
        }
    }
    
    using System;
    using System.Collections.Generic;
    
    namespace Assets.Engine.Core {
        public interface IEventPublisher {
            void Publish<TMessage> (PubSubEventBase evt, TMessage msg, IEnumerable<Action<TMessage>> subscribers);
        }
    
        public abstract class PubSubEventBase {
            protected IEventPublisher Publisher;
    
            protected PubSubEventBase () {
                IsImmediate = false;
            }
    
            public bool IsImmediate { get; protected set; }
    
            internal static TEvent Create<TEvent> (IEventPublisher publisher)
                where TEvent : PubSubEventBase, new () {
                return new TEvent { Publisher = publisher };
            }
        }
    
        public abstract class PubSubEvent<TMessage> : PubSubEventBase {
            private readonly List<Action<TMessage>> _subscribers = new List<Action<TMessage>> ();
            private readonly object _subscribersLock = new object ();
    
            public void Publish (TMessage msg) {
                Publisher.Publish (this, msg, _subscribers);
            }
    
            public void Subscribe (Action<TMessage> subscriber) {
                lock (_subscribersLock) {
                    _subscribers.Add (subscriber);
                }
            }
        }
    }
    

    The EventManager uses the Singleton class from here http://wiki.unity3d.com/index.php/Singleton.

    Example usage:
        // Define an event
        public class PlayerHealthChanged : PubSubEvent<int> {
        }
    
        // Publish event
        EventManager.Instance.GetEvent<PlayerHealthChanged>().Publish(10);
    
        // Subscribe to event
        EventManager.Instance.GetEvent<PlayerHealthChanged>.Subscribe(h => Debug.LogFormat("Player health changed: {0}", h)); 
    

    Things like this are actually one of the best things about Unity using a "real" programming language. You have complete control to write and use systems like this.

    e: Also, I haven't needed it yet, but extending this to have an Unsubscribe would be relatively easy. Again, I just haven't needed it yet since most of the events I use this for are relatively persistent.

    GnomeTank on
    Sagroth wrote: »
    Oh c'mon FyreWulff, no one's gonna pay to visit Uranus.
    Steam: Brainling, XBL / PSN: GnomeTank, NintendoID: Brainling, FF14: Zillius Rosh SFV: Brainling
  • Options
    KashaarKashaar Low OrbitRegistered User regular
    After spending all weekend doing contract stuff in UE4, I had to do something to relax a bit. So I opened UE4 right back up again and started a thing:

    https://www.youtube.com/watch?v=dTy-q2frB0U

    Indie Dev Blog | Twitter | Steam
    Unreal Engine 4 Developers Community.

    I'm working on a cute little video game! Here's a link for you.
  • Options
    HandkorHandkor Registered User regular
    That looks neat. I like how the paths have a bit of randomness to them.

  • Options
    KashaarKashaar Low OrbitRegistered User regular
    Handkor wrote: »
    That looks neat. I like how the paths have a bit of randomness to them.

    Yeah, that was the fun part :) This is perhaps way too expensive to use in an actual game, but I wanted to write a bit about how it's done, but then the all-nighter got to me...

    Anyway... essentially, the missile has two states: 'Tracking', and 'Drifting'.

    It starts out with a randomized angular and linear velocity (randomized within parameters, that is), in the 'Drifting' state. In this state, it continually boosts (locally) forward, while the physics engine's angular dampening is gradually slowing the spin. This creates that chaotic spiraling movement.

    After a randomized (within parameters) time, it switches to the 'Tracking' state, in which rotation is continually interpolated towards the target, and velocity is interpolated towards a target final velocity - both with continually increasing interpolation factors (in order to make sure there isn't too much overshooting).

    The last thing I added is intermittent tracking loss. Every [randomized period of time], the missile switches back into the 'Drifting' state and a random spin is added. Cue more movement chaos!

    As I said, it's probably too expensive to use as anything but a hero effect, but it was good fun to make :)

    Indie Dev Blog | Twitter | Steam
    Unreal Engine 4 Developers Community.

    I'm working on a cute little video game! Here's a link for you.
Sign In or Register to comment.