|
Count Uvula posted:Either way the cost is so small that it's like spending a penny instead of spending 5 pennies when you have 100 dollars to budget. I know this is the case but at the same time, it just seems like a slippery slope situation to me. I read all these horror stories about unoptimized code so I don't want to end up in some guy's cringe compilation or whatever. That said, I probably shouldn't worry this much about optimization this early, so I'll come up with something that definitely works now and rework it later if necessary. Mata posted:I think the ECS way to do it is to store all entities by ID, and each entity can optionally have a position component which are stored together in a way that makes them easy to look up by position (e.g. a quadtree). To clarify, do you mean keeping a table of entity IDs and their positions? Like entity ID - Position 0001 - 3, 2 0002 - 6, 4 and so on? Or did I misunderstand you? Minorkos fucked around with this message at 08:22 on Jun 27, 2018 |
# ? Jun 27, 2018 07:53 |
|
|
# ? Jun 3, 2024 12:57 |
|
Minorkos posted:I know this is the case but at the same time, it just seems like a slippery slope situation to me. I read all these horror stories about unoptimized code so I don't want to end up in some guy's cringe compilation or whatever. That said, I probably shouldn't worry this much about optimization this early, so I'll come up with something that definitely works now and rework it later if necessary. In Entity-Component-System architecture, you got entities which are just an ID and a collection of components. One of the components an entity may have would be Position (with the x,y coordinate above). The position components are stored in a positional collection that you can easily query for, say, "give me the 5 position components that are closest to x,y". Those 5 components have a reference to their owner entity. Im at my stop now so i cant explain the whole idea, but this pattern is to game engines what perlin noise is to procgen so its worth knowing about.
|
# ? Jun 27, 2018 09:09 |
|
Minorkos posted:I know this is the case but at the same time, it just seems like a slippery slope situation to me. I read all these horror stories about unoptimized code so I don't want to end up in some guy's cringe compilation or whatever. That said, I probably shouldn't worry this much about optimization this early, so I'll come up with something that definitely works now and rework it later if necessary. A commonality you'll notice amongst those horror stories is that almost all of them have to do with not garbage collecting unused poo poo or doing more draw or collision checks than necessary. Generally things like "a big ol' grid" only become a problem if they are never removed from memory. Unnecessary draw checks you don't have to worry about too much if you're using Unity, because modern engines usually have (mediocre but generally applicable) systems built in to keep them from doing draw calls for objects you can't see. Fallout 4's object occlusion bug is probably my favorite programming horror story because lmao, whatever goddamn idiot implemented it made it so that it doesn't draw objects if there's a big object between you and them AND they're within like 20 feet of you. It was supposed to be 'AND they're further than like 20 feet from you' because the implementation they ended up with made the dense city ruins in the game lag like a motherfucker because of one person's really stupid mistake that makes the game draw dozens of objects it doesn't need to and afaik they have never patched it out. Minorkos posted:To clarify, do you mean keeping a table of entity IDs and their positions? Like Quadtrees are a fractal data structure and a lot more complicated then a table, they sort things in to nodes based on their location (or other 2 dimensional variable) so that you can find a nearby object based on whether it's in the same node. The larger and more full of objects your map is the more using a quadtree benefits your performance. As an example I imagine games like Infested Planet and They Are Billions use quad trees really thoroughly because both of them will have hundreds or thousands of moving objects on a map at once and using a quadtree to determine nearby objects can save them literally millions of collisions checks.
|
# ? Jun 27, 2018 09:27 |
|
Does anyone know a quick and dirty way to call a destructor on a class in Unity? In XNA it was easy and you could just go <classname>.Dispose(); and then call the constructor again. But this doesn't seem to be so in Unity. e: I added extends MonoBehaviour to the classes I want to dispose, and I can call Destroy(<classname>) and it destroys the gently caress out of that instance, until the constructor is called again (tested: if called again before the constructor, null reference exception crash occurs). But I'm not seeing it free up any of the ram that was used by the class. Is there a step I'm missing? Fur20 fucked around with this message at 11:08 on Jun 27, 2018 |
# ? Jun 27, 2018 10:47 |
|
What are you trying to do? If you don't have anything referencing the object, it will be garbage collected.
|
# ? Jun 27, 2018 11:24 |
|
It's worth noting that Dispose() you've been calling in XNA isn't a destructor at all. It's just, well, Dispose(). There are no destructors in c#, for that matter, closest thing is finalizers and they can't be called explicitly, only the garbage collector can call them. But yeah, remove all outstanding references and your object will be collected, eventually.
Chev fucked around with this message at 11:49 on Jun 27, 2018 |
# ? Jun 27, 2018 11:44 |
|
KillHour posted:What are you trying to do? If you don't have anything referencing the object, it will be garbage collected. well i'm basically trying to destroy my current instance of the class to clear any resources it's referencing, then re-construct it from scratch if it's needed again later, like switching from the title screen to the game, then back to the title. i have all my resource references in a title draw class, so i want to completely wipe it so it'll be garbage collected without having to worry about "such-and-such asset is still being referenced" because the only thing that uses it has been nullified. i assume garbage collection should be instantaneous once it's no longer being referenced. but clearly it must still be, because the ram doesn't get cleared up at all.
|
# ? Jun 27, 2018 12:01 |
|
The White Dragon posted:well i'm basically trying to destroy my current instance of the class to clear any resources it's referencing, then re-construct it from scratch if it's needed again later, like switching from the title screen to the game, then back to the title. i have all my resource references in a title draw class, so i want to completely wipe it so it'll be garbage collected without having to worry about "such-and-such asset is still being referenced" because the only thing that uses it has been nullified. Just assign all your references to null. GC will see that the objects aren't being referenced anywhere and clean them up automatically. It doesn't happen immediately - it happens in batches to avoid performance issues (since GC has some overhead), but don't try to micro it. Just set things to null when you don't need them any more and let the system take care of itself. A good question might be why are you trying to optimize this? Are you running out of memory?
|
# ? Jun 27, 2018 12:23 |
|
The White Dragon posted:well i'm basically trying to destroy my current instance of the class to clear any resources it's referencing, then re-construct it from scratch if it's needed again later, like switching from the title screen to the game, then back to the title. i have all my resource references in a title draw class, so i want to completely wipe it so it'll be garbage collected without having to worry about "such-and-such asset is still being referenced" because the only thing that uses it has been nullified. System.GC.Collect should "work" but you need to be aware of two things: 1) It might not. 2) Unity's Editor has an incredible amount of memory leak even if the compiled game does not. I recommend that you store a static reference to it somewhere. The only way I feel comfortable with Unity is by making sure I have as much control over what's being created/discarded as possible, pool everything, and so on. This way you know in advance how much memory you'll be needing and know as you build the game where any leak is coming from if they appear.
|
# ? Jun 27, 2018 12:35 |
|
Minorkos posted:I know this is the case but at the same time, it just seems like a slippery slope situation to me. I read all these horror stories about unoptimized code so I don't want to end up in some guy's cringe compilation or whatever. That said, I probably shouldn't worry this much about optimization this early, so I'll come up with something that definitely works now and rework it later if necessary. Don't worry too much about optimization until you have a demonstrable need for optimizing. Be reasonable with your implementation and be ready for the future, but don't go chasing percentage points until you actually have a problem.
|
# ? Jun 27, 2018 14:08 |
|
There are lots of folks who make cool things that are the programming equivalent of those roommates who leave everything a mess but somehow know how to find anything they need.
|
# ? Jun 27, 2018 14:16 |
|
I have a couple of friends who are also doing the same computer bullshit and I'm thinking I could rope them into this project at some point. So it helps to have stuff make sense for people other than myself In other news I think I just figured out how to do this stuff in a way that doesn't annoy me. I was trying to figure out how to draw all possible paths emanating from an unit, so I made an algorithm that takes a movement range value and recursively attempts to carry it to nearby tiles while deducting the cost of the movement from it. I don't know if this kind of algorithm has a name besides just indiscriminate pathfinding or something. Anyway I used that and started adding walls to it to test it out, and I realized I could just call to find the objects once and mark them onto the grid before initiating the algorithm, thus eliminating the need to check all the objects multiple times during the process. And there are no real sync issues issues either, considering the temporary grid the objects are marked on is constructed specifically for the algorithm. Minorkos fucked around with this message at 14:58 on Jun 27, 2018 |
# ? Jun 27, 2018 14:22 |
|
Its worth noting that C# does have destructors.. they are called finalizers. They can only exist on classes and it is impossible to call them manually but you can implement them for your class. As for Dispose there is only a few reasons you would ever need to use them 1. If your class has members that need to be disposed the parent class also needs to have dispose (any members that implement IDisposable). 2. If your class has native memory or pointers to native objects that should be cleaned up If your class doesn't have the above.. then implementing IDisposable and calling .Dispose() is a pointless waist of time. xgalaxy fucked around with this message at 16:09 on Jun 27, 2018 |
# ? Jun 27, 2018 16:04 |
|
Minorkos posted:I have a couple of friends who are also doing the same computer bullshit and I'm thinking I could rope them into this project at some point. So it helps to have stuff make sense for people other than myself You reinvented Dijkstra.
|
# ? Jun 27, 2018 16:12 |
|
KillHour posted:A good question might be why are you trying to optimize this? Are you running out of memory? I know I will eventually, so I'm nipping the problem in the bud right now that I have testable, on-demand scene transitions implemented. With dragon game, I ran out of memory after loading in just four stages if I didn't do gc correctly the specific way XNA expected me to, and even though my assets are appreciably smaller, I anticipate similar problems here if I can't clean out my ram usage every time I transition out of a level and its unique assets aren't being used. I load a lot of 1024^2 and 2048^2 spritesheets. I've tried setting everything to null, but unity just throws null reference exceptions when I do. I want to manage this RIGHT NOW because, once bitten.
|
# ? Jun 27, 2018 20:42 |
|
The White Dragon posted:I know I will eventually, so I'm nipping the problem in the bud right now that I have testable, on-demand scene transitions implemented. With dragon game, I ran out of memory after loading in just four stages if I didn't do gc correctly the specific way XNA expected me to, and even though my assets are appreciably smaller, I anticipate similar problems here if I can't clean out my ram usage every time I transition out of a level and its unique assets aren't being used. I load a lot of 1024^2 and 2048^2 spritesheets. That means you're trying to use the data after you null it out. Are you sure you are done with it? Edit: I mean this in the most constructive way possible, but I think you should take a break from development spend a little time reading up on good programming practices and patterns. Things like "these sprites aren't used in this level but are still in memory" aren't a problem if you lay the groundwork correctly and trying to play whack-a-mole with memory leaks as they come up is never a good option. KillHour fucked around with this message at 21:06 on Jun 27, 2018 |
# ? Jun 27, 2018 21:02 |
|
KillHour posted:That means you're trying to use the data after you null it out. Are you sure you are done with it? I'm not playing whack a mole, I know exactly where this is coming from and I'm trying to lay the groundwork now to permanently prevent something I know can cause memory problems in the future. I don't really know where you get the impression that I'm trying to put out some kind of mysterious, unknown trash fire when I'm literally asking for help to future-proof my code before I do any more work on it.
|
# ? Jun 27, 2018 22:28 |
|
I'm not trying to be a dick. C# has very good garbage collection and all you need to do to trigger it is not have any references to the object. Unity automatically garbage collects game objects between scenes unless you mark them with the don't destroy tag. If you're getting null reference errors after removing your reference it means you're calling that reference after you removed it, so you obviously still need it and it can't be GC'd unless you're going to reconstruct it before you try to use it again. My point was it's important that you know how Unity does GC if you're going to write code that doesn't leak. That's more than just writing a piece of code to force an object to be released - you have to research the subject thoroughly and really understand how the engine handles it under the hood. https://unity3d.com/learn/tutorials/topics/performance-optimization/optimizing-garbage-collection-unity-games KillHour fucked around with this message at 22:42 on Jun 27, 2018 |
# ? Jun 27, 2018 22:35 |
Design question: Are there any good (preferably free) resources for guides/tips on map/level design? Particularly with like, top-down jrpg style games in mind?
|
|
# ? Jun 27, 2018 23:40 |
|
garbage collecting properly suck that chili out of that hole hole hole As it turns out, my code was a victim of Futile's awful documentation, and its lackluster dummied/deprecated calls (cyclically, returning back to Futile's crappy documentation, because you never know what anything does). You need to unload each FSprite individually, calling spritename.RemoveFromContainer for every sprite. You cannot, as you might expect, call spritecontainer.RemoveAllChildren, which does gently caress all. Ultimately the best advice I got was when it was suggested that setting the sprite to null crashing the application meant that it was still being referenced, so thanks for that It's because I assumed that RemoveAllChildren would be a nice, clean, intelligently-pre-implemented answer to my problems. I would call spritename = null after calling that, but because it does absolutely nothing, you're right: the sprites were still being referenced. Thanks to you guys, no thanks to the Futile dev, who seems to have finally abandoned his subreddit anyway.
|
# ? Jun 28, 2018 00:22 |
|
Ugh that sucks. Thank God Unity is finally starting to get decent native 2D tools.
|
# ? Jun 28, 2018 05:07 |
|
Unity 2D stuff got polished up a year or two ago. I wouldn't think dealing with some sort of wonky non-official solution would be worth it anymore. Not since whenever in 5.x they got it all sorted out. The only thing I don't use are animations because I found the pipeline a bit laborious for simple animations but I'd probably suck up and deal with it if I had a major 2D project. Finally I have a drat playable build up. It is full of bugs and unpolished but it's playable! Go download at itch! Lots of bugs/missing features but hoping to get some feedback on combat at least. Sound is particularly patchy because I kinda forgot about it mostly. I always code with music going and test with the sound off and forgot I barely have any sounds. I am talking to someone about improving it. I had mega build bugs but I'll try to get a web build up eventually too. It's also not balanced like at all. I have a stupid amount of content (hundreds of items, spells, abilities. dozens of classes and monsters, etc) and I get dizzy just trying to think about getting it under control. FuzzySlippers fucked around with this message at 10:09 on Jun 28, 2018 |
# ? Jun 28, 2018 10:06 |
|
I still use Futile for my UI stuff. Hundreds and hundreds of FSprites and FLabels. I hope nothing ever breaks because I'm pretty sure nobody alive knows how any of that poo poo works.
|
# ? Jun 29, 2018 07:49 |
|
futile is great because i can force the z sorting to any layer i want, whenever i want futile is not so great when it has calls that basically do nothing but they self-describe as doing the thing
|
# ? Jun 29, 2018 08:15 |
|
I'm making a Portrait widget in UE4 that has an Image that I'll fill with a texture I'm pulling from a render target. That should all work. My problem is when I place an instance of this Portrait widget in another widget, I'd like to be able to set the size, but there's no option for that in the details pane. If I look in the Portrait widget itself, there's options to set the Image Size on the Image itself, but it isn't exposed on an instance of the Portrait. I can put the instance in a Size Box and that should work for my immediate purposes, but it's a little janky. Since I'm considering throwing this thing up on the marketplace for some pocket change, I don't think that would really fly. Is there some way to expose the Image's appearance stuff on an instance?
|
# ? Jun 29, 2018 08:17 |
|
The White Dragon posted:futile is great because i can force the z sorting to any layer i want, whenever i want You don't need Futile to do that. There are loads of built in ways to do that. Futile seems to be solving problems that no longer exist (makes the name appropriate) which is probably why it isn't being updated. I have an entirely code-centric workflow without any extra libraries.
|
# ? Jun 29, 2018 21:18 |
|
FuzzySlippers posted:You don't need Futile to do that. There are loads of built in ways to do that. Futile seems to be solving problems that no longer exist (makes the name appropriate) which is probably why it isn't being updated. I have an entirely code-centric workflow without any extra libraries. ok but how much will i have to adapt my existing code because the entire thing is written in it and major overhauling or restructuring is the easiest way to instantaneously kill any project dead. unless i can keep 99.9999% of my existing code, this is never gonna happen with my current project.
|
# ? Jun 29, 2018 21:36 |
|
Every time I use an asset, I realize I need to work around a bunch of assumptions the developer made and stop using it.
|
# ? Jun 29, 2018 21:37 |
|
We're running our annual summer game jam starting in one week (July 6th) called Awful Summer Jam. It's a themed jam that runs until July 31st. You can head over to the thread for more info. Also plugging the Awful Jams community as a whole, we have a large Discord full of helpful devs and artists that you can join HERE . Come say hello!
|
# ? Jun 29, 2018 21:39 |
|
KillHour posted:Every time I use an asset, I realize I need to work around a bunch of assumptions the developer made and stop using it. Aim lower, like a tween library or a spline interface or whatever. Basically if an asset promises to give you a game with three clicks, it's probably a bad asset you'll regret choosing. But if you get stuff that makes repetitive tasks faster life gets much better.
|
# ? Jun 29, 2018 22:04 |
|
I usually get an asset to solve one specific problem but then realize it's better to just write my own.
|
# ? Jun 29, 2018 22:05 |
|
Yeah an asset needs to be laser focused on solving one problem to not end up a headache. Though even then I tend to look at the clever bits and rewrite it to better suit my project.
|
# ? Jun 29, 2018 22:24 |
|
FuzzySlippers posted:Unity 2D stuff got polished up a year or two ago. I wouldn't think dealing with some sort of wonky non-official solution would be worth it anymore. Not since whenever in 5.x they got it all sorted out. The only thing I don't use are animations because I found the pipeline a bit laborious for simple animations but I'd probably suck up and deal with it if I had a major 2D project. This is pretty cool. I only gave it a very brief try, but some feedback: - There should be a clearer indicator when and who of your guys is ready to attack. At least I tend to rest my eyes at the middle of the screen so I'm not really seeing when the party members are ready since the portraits are at the bottom - One battle just kind of froze. The cooldowns stopped aand the monster stopped acting as well but kept animating. Pausing/unpausing didn't work. - :hmm: (this was also the battle where everything just stopped)
|
# ? Jun 29, 2018 23:13 |
|
netcat posted:This is pretty cool. I only gave it a very brief try, but some feedback: Thanks for playing! The intention with the interface was definitely to try to keep focus on the center screen (radial menus and such) so I should solve that. You think a quick notification center screen with a floating portrait + "ready!" would work? That bug is gonna be a pain in the rear end to figure out. It looks like the ArenaController hit a bug which is why it didn't position the monsters at their places and left them at the initial pool spawn position. Though the Turn and Time managers are independent and should have kept combat going regardless since anything spawning registers itself. Especially since they kept animating. I have a debug console accessible by the J key but I need to code up something to help get me error data. Also that terrain looks weird I think the game is defaulting to lowest quality. The game is low spec enough I don't think many need to run it that low. edit: whoops debug console is completely disabled in build. Next version will enable that at least. FuzzySlippers fucked around with this message at 00:14 on Jun 30, 2018 |
# ? Jun 30, 2018 00:06 |
|
The only assets I have ever not regretted buying were NGUI (before Unity revamped its UI) and Rewired- both of them provided low-level features with an extremely refined scope, and did a much better job than my own solution would've. Anything higher level than that has proven to either not do what I need it to, had so many bugs that I end up throwing it out and rolling my own solution, or make sweeping assumptions about my design and workflow that are really annoying to work around.
|
# ? Jun 30, 2018 00:51 |
|
netcat posted:This is pretty cool. I only gave it a very brief try, but some feedback: This felt a little too much so pushed it to the left seem better? There's a config option for it now Ready Notice in gameplay options. edit: new build posted FuzzySlippers fucked around with this message at 11:03 on Jun 30, 2018 |
# ? Jun 30, 2018 07:09 |
|
you have tons of screen real estate in the top right corner (alternatively, the top left if you move your combat log to the bottom left or bottom right, which is more natural to look at at least in western countries)... would you consider putting in like a portrait of your mans and having speech bubble prompts pop up when their atb is full? post apoc wizard all "awaiting your orders" like a starcraft unit e: to better illustrate my point Fur20 fucked around with this message at 11:52 on Jun 30, 2018 |
# ? Jun 30, 2018 08:04 |
|
FuzzySlippers posted:This felt a little too much Yeah I think the main thing is to have something that catches your eye, having it be right in the center together with the monsters I feel would make it a bit busy maybe? I'm no interface designer though. Also, more funny bugs: The lizard got stuck breathing fire and it remained after it died. edit: Another thing is that I feel like the text log doesn't really add anything right now since it's a bit too small to read. Compare with say Elminage which have a huge text. Not sure what is preferable though. netcat fucked around with this message at 12:02 on Jun 30, 2018 |
# ? Jun 30, 2018 12:00 |
|
Working on our trailer. poo poo is harder than you'd think. Went for a bunch of approaches, mostly worrying a lot about the gameplay / cutscene ratio, and ultimately deciding to just show off cool stuff to badass music. poo poo, I hope it works.
|
# ? Jun 30, 2018 14:12 |
|
|
# ? Jun 3, 2024 12:57 |
|
Oi that stupid particle effect has a timeout value it should have hit if nothing else. Was it stuck in the fire breathing animation too or just the particle effect? I did fix that earlier bug where the mobs got stuck outside their spawning positions. netcat posted:edit: Another thing is that I feel like the text log doesn't really add anything right now since it's a bit too small to read. Compare with say Elminage which have a huge text. Not sure what is preferable though. The White Dragon posted:e: to better illustrate my point I like that mockup. If I had the time/energy to make something more like Wizardry 8 where the party members have personality that would be a way to do it without voice acting. I do currently have a trello card of 'Relocate message display to lower right and have toggle?' as I was thinking it was too messy up there. I'm currently using it to help debug combat system stuff, but in the final release I was thinking it's more just a way for someone to pause and check what happened. So if I put it behind a toggle in the lower right I don't think that would be bad. If I do that I don't want to have any UI stuff north of the panels beyond floating text.
|
# ? Jun 30, 2018 17:37 |