Today, I optimized my space shooter/dungeon game to hell and back. Get ready for a huge wall of text:
My dungeon manager (actually a GridManager, but I'll call it a dungeon manager for now) used to consist of Grid entities which all contained a physical body: a simple rectangle. I thought to myself: that wouldn't slow down the physics engine too much, would it? Well, I was wrong. If I wanted to have my dungeon look actually large, it'd need to be at least 80x80 blocks. In the worst case scenario, that's [b]6400 bodies[/b]. Of course, no body is created if there's a hole in the grid somewhere, but still, my CPU didn't like that at all :v:
My first thought was: make one huge body, that contains all the rects in the dungeon manager merged together into one big concave polygon. That didn't work either, because the polygon became so big that it started to become corrupt: edges crossing each other, infinite lengths, etc. I fixed it by looping through the block list and creating a new body + concave polygon for every x value, so the dungeon consisted of large vertical slices. This was pretty much perfect, because the polygons didn't become large enough to get corrupt, but they were still large enough to make the whole simulation run a lot faster: now there were only [b]80 bodies[/b], instead of 6400!
The only disadvantage is that the initial process of merging all the rects on every column is very slow, so the loading times per-dungeon will be pretty long. But I think everyone prefers loading bars over slow in-game performance!
(I should probably get a blog)
[QUOTE=Dlaor-guy;31160154]But I think everyone prefers loading bars over slow in-game performance!
(I should probably get a blog)[/QUOTE]
Make it so that only the area you start in gets loaded before gameplay starts and the rest is done on the fly?
Also, yes.
[QUOTE=Dlaor-guy;31160154]Today, I optimized my space shooter/dungeon game to hell and back. Get ready for a huge wall of text:
My dungeon manager (actually a GridManager, but I'll call it a dungeon manager for now) used to consist of Grid entities which all contained a physical body: a simple rectangle. I thought to myself: that wouldn't slow down the physics engine too much, would it? Well, I was wrong. If I wanted to have my dungeon look actually large, it'd need to be at least 80x80 blocks. In the worst case scenario, that's [b]6400 bodies[/b]. Of course, no body is created if there's a hole in the grid somewhere, but still, my CPU didn't like that at all :v:
My first thought was: make one huge body, that contains all the rects in the dungeon manager merged together into one big concave polygon. That didn't work either, because the polygon became so big that it started to become corrupt: edges crossing each other, infinite lengths, etc. I fixed it by looping through the block list and creating a new body + concave polygon for every x value, so the dungeon consisted of large vertical slices. This was pretty much perfect, because the polygons didn't become large enough to get corrupt, but they were still large enough to make the whole simulation run a lot faster: now there were only [b]80 bodies[/b], instead of 6400!
The only disadvantage is that the initial process of merging all the rects on every column is very slow, so the loading times per-dungeon will be pretty long. But I think everyone prefers loading bars over slow in-game performance!
(I should probably get a blog)[/QUOTE]
Why not pre-compute? Or is it randomly generated? If it's randomly generated (or even pre-computed), a more complex solution might be appropriate. See L4D's nav-mesh, which floods the area with rectangles as large as possible, stepping down to smaller and smaller squares to fill everything.
[QUOTE=Lord Ned;31160505]Why not pre-compute? Or is it randomly generated? If it's randomly generated (or even pre-computed), a more complex solution might be appropriate. See L4D's nav-mesh, which floods the area with rectangles as large as possible, stepping down to smaller and smaller squares to fill everything.[/QUOTE]
If most of the map is walls coulnd you check for collisions with the floor?
So if the player is on/in the floor he isnt on/in the walls.
Or check the tiles around the player
[QUOTE=Lord Ned;31160505]Why not pre-compute? Or is it randomly generated? If it's randomly generated (or even pre-computed), a more complex solution might be appropriate. See L4D's nav-mesh, which floods the area with rectangles as large as possible, stepping down to smaller and smaller squares to fill everything.[/QUOTE]
It's randomly generated, and I'd like to use a more advanced algorithm like the one you described but I don't know if it's worth the performance increase... (and I wouldn't have a clue how to implement it)
[QUOTE=Downsider;31159770][img]http://filesmelt.com/dl/runloopactual.gif[/img]
There we go.. Looks rather odd in GIF format for some reason.. I think it's missing some frames.[/QUOTE]
I can't help but picture this is Vin Diesel on a jog.
Very nice art though!
Sounds like a quadtree will solve the guy with the collision problems.
That gif makes me wish I had a walk cycle that didn't look like ass.
[QUOTE=Parakon;31161966]That gif makes me wish I had a walk cycle that didn't look like ass.[/QUOTE]
Don't we all. [img]http://i.somethingawful.com/forumsystem/emoticons/emot-unsmith.gif[/img]
I practiced walk cycles for a while in flash and now my walk cycles aren't terrible :downs:
[IMG]http://i869.photobucket.com/albums/ab255/Yournameisinvalid21/hhhhhh.gif[/IMG]
Wtf flash gifs
also, 800th post.
[QUOTE=bobthe2lol;31158737]Not in the current state. I said I'd buy the game. And I would. But its not a game yet. And CarlBooth I know they are bannable, but I have seen that specific image macro used in waywo 18 or 17 or both, and the poster didn't get banned. But whatever. It was only 12 hrs.[/QUOTE]
Speaking of image macros, why are they bannable? Yes, they say what you need in an image, but, if we get banned for that why dont we get banned for ratings?
</offtopic>
Gave up on that UDP library, I have no real use for it and if I actually need to use udp ill just stick to doing it the [del]hard[/del]manly way.
[editline]16th July 2011[/editline]
[QUOTE=Dj-J3;31162053]Don't we all. [img]http://i.somethingawful.com/forumsystem/emoticons/emot-unsmith.gif[/img][/QUOTE]
Does that site have all the emotes? :userscripttime:
[editline]neverland[/editline]
too lazy nvm
[IMG]http://localhostr.com/files/NF0X11X/Level%20Editor.png[/IMG]
Working on a level editor for a game, it's going to load tools/plugins at runtime allowing the editor to be extended. C# and XNA.
So i have been lurking here for a while and posted a bit of content but it isn't as good as some of the stuff here so i try not to. I'm not sure if this is where i ask this if not sorry.
Anyway i know a bit about java and have developed a basic 2d game engine which handles stuff like mouse, keyboard, graphics, sound and networking but it is extremely limited. I have decided to move on and i would like to try to use c# and XNA because i heard xna is good and that c# is very similiar to java.
So my question is. What compiler/ide do you recommend for c# and what is a good tutorial to start using xna?
[QUOTE=DevBug;31164386][IMG]http://localhostr.com/files/NF0X11X/Level%20Editor.png[/IMG]
Working on a level editor for a game, it's going to load tools/plugins at runtime allowing the editor to be extended. C# and XNA.[/QUOTE]
Am I the only one who's not building a separate editor? I'm just building mine into the game.
Admittedly, my editor isn't very far. :v:
[QUOTE=stinkfire;31164701]So i have been lurking here for a while and posted a bit of content but it isn't as good as some of the stuff here so i try not to. I'm not sure if this is where i ask this if not sorry.
Anyway i know a bit about java and have developed a basic 2d game engine which handles stuff like mouse, keyboard, graphics, sound and networking but it is extremely limited. I have decided to move on and i would like to try to use c# and XNA because i heard xna is good and that c# is very similiar to java.
So my question is. What compiler/ide do you recommend for c# and what is a good tutorial to start using xna?[/QUOTE]I use Visual Studio for C#
[QUOTE=Lord Ned;31164951]Am I the only one who's not building a separate editor? I'm just building mine into the game.
Admittedly, my editor isn't very far. :v:[/QUOTE]
[img]http://img705.imageshack.us/img705/7229/unledxhm.png[/img]
Looks like it. :V
Also think with a business mind, if you make it seperatelly you can then sell it as DLC mwahahaha
[QUOTE=Richy19;31165166]Also think with a business mind, if you make it seperatelly you can then sell it as DLC mwahahaha[/QUOTE]
:/
[b]Edit:[/b] I know you're not serious.
[QUOTE=Lord Ned;31164951]Am I the only one who's not building a separate editor? I'm just building mine into the game.
Admittedly, my editor isn't very far. :v:[/QUOTE]
Let's be ingame editor pals.
[img]http://filesmelt.com/dl/sometimesipoop.png[/img]
(Nothing new though)
Still moving the game to the new physics stuff, which is way easier to add stuff to.
After I was done moving everything to the new system, I decided that the new system sucks (structure wise) and changed it again!
Anyone up for giving mario a portal gun?
[img]http://i.imgur.com/x6ahV.png[/img]
Hi! I think this is my first ever post showing something I'm working on, anyways, I downloaded Löve2D a few hours ago and have been messing with it.
[img]http://gyazo.com/12c30ac9624ee86548d64972f9543313.png[/img]
I'm working on my first ever game :-)
[QUOTE=Richy19;31165166][img]http://img705.imageshack.us/img705/7229/unledxhm.png[/img]
Looks like it. :V
Also think with a business mind, if you make it seperatelly you can then sell it as DLC mwahahaha[/QUOTE]
You best not be using GDI+.
I had a root canal the other day and it hurts so bad I'm unable to program for more than half an hour. So I probably won't be posting much content until it gets better. Sorry. :c
Started on my In-Game Level Editor.
[img]http://i.imgur.com/T6XRJ.png[/img]
Only tile selection and placement thus far, but still nice.
After a year of indecision of trying to learn C#, and Lua to make mods, I just thought to myself "Fuck it, I have to learn C++ if i wanna go in the games industry". I'm learning C++ through my Accelerated C++ book, doing some exercises.
[img]http://gyazo.com/827ca979b6dfdf0c94a91572d7022a48.png[/img]
[IMG]http://localhostr.com/files/HcNPZqj/Tile%20Editor.png[/IMG]
Now with %100 more dynamically loaded tools.
[QUOTE=DevBug;31168355][IMG]http://localhostr.com/files/HcNPZqj/Tile%20Editor.png[/IMG]
Now with %100 more dynamically loaded tools.[/QUOTE]
Reminds me of the tiled editor
looks like pokemans
[QUOTE=Quark:;31166565]I had a root canal the other day and it hurts so bad I'm unable to program for more than half an hour. So I probably won't be posting much content until it gets better. Sorry. :c[/QUOTE]
How did you get the need for a root canal?
[QUOTE=mmavipc;31169847]How did you get the need for a root canal?[/QUOTE]
Too much candy, not enough brushing teeth
[img]http://i.imgur.com/hShuE.png[/img]
Dynamically sized panel elements that aren't shown off in the least bit in this picture. But the level editor is almost done.
Sorry, you need to Log In to post a reply to this thread.