Re: Representing 3d Staircases? (Python)

2020-04-25 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

No, I use strings because I can basically draw the map with a Braille display, and edit easily. For a different format, I'd either need to do everything by hand with loops and code and math, or I'd need a dedicated editor.

URL: https://forum.audiogames.net/post/522692/#p522692




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-25 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

This whole ordeal makes me want to open source the Halloween thing I was working on in 2018 that will probably never get done. The map system might or might not be difficult to learn, as it uses a 2d array of tiles, and each type of tile has the necessary information to define the stack of voxels at that 2d position. It's more complex than the JFIMA, but without the width limitation.The catch is complexity limitations. I've only tested with a single map, though it theoretically supports linking to adjacent maps and referencing those for out-of-bounds collision checks. Limitations include being extremely difficult to move things (I made furniture part of the map, rather than objects, then decided it should be possible to move chairs around, and that is going to be a nightmare if I ever try to finish that aspect ).Navigation-wise, the game uses a Swamp-style radar and zone system. I have no idea how well this would work in practice; odds are, even though it is extremely similar, with just a couple extra sounds, no one will understand it, because that's how it usually goes when I do that sort of thing. But that doesn't mean the principal wouldn't work, since Swamp demonstrates that it can.Whether, in practice, this would turn out more like Swamp, or more like the JFIMA, I have no idea.So far as data compression goes, I have a two-story building and the area immediately in front of and behind it, including a road, in something like 50×60 tiles, except that the road and part of the front are much smaller, because they cover entire rows, and the map class auto-completes rows that aren't as wide as the map with the last entry. It should do the same with the last row z-wise, but I don't think I implemented that. So in practice, there are well under 3000 tiles. The only bits that gave me any trouble on the design front were occasionally messing up the upper floor for a certain tile, usually furniture or bathroom tiles. It's also necessary !be careful with is doors (it'd be a bit odd if opening a door upstairs affected a door or wall downstairs, after all).As regards the first question that started the topic, bugs with slopes were the worst. I think there might still be a spot where it's possible to glitch into the garden through the basement. Other than the bugs I mentioned earlier, there was something related to weird behavior on the edge of individual stairs, and I think there were others I don't remember so well atm. But other than that glitch which may or may not still be there, stairs worked smoothly enough the last time I tested.However, the tile properties are managed by dictionaries. A pointer to objects, or a list of objects with int indeces, are probably more efficient, but doing it this way is much easier to work with when using a string array to edit the map. If you have a way of editing that plays better with indeces or pointers, one of those would probably be better.[edit]Oh, I forgot to clerify that the stacks are defined as integers, like a collision bitmap. This makes the maximum height of a stack the size of an int (so 32, since I didn't bother with int64 support)). The idea is that a single map probably won't ever need more than 30 blocks vertically at the same time, and if it does, stacking maps on top of each other should work as well. The map I was testing with is sort of inconsistent with whether tiles are 1ft or 1m or something else, but I mostly treated them as feet to make the map feel less cramped. IIRC, it's not even 15 high, including the roof. If you scaled it so that 1 voxel is 1m^3, it'd require even less. As for how well any of this would play with a server or something much grander in scope, eh ... [/edit]

URL: https://forum.audiogames.net/post/522682/#p522682




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-25 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

@31I suspect that needing to use string maps is liable to be a BGT limitation?You can pretty easily do dynamic serialization/deserialization in Python if you get into getattr and storing classes in dicts.

URL: https://forum.audiogames.net/post/522686/#p522686




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-25 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

This whole ordeal makes me want to open source the Halloween thing I was working on in 2018 that will probably never get done. The map system might or might not be difficult to learn, as it uses a 2d array of tiles, and each type of tile has the necessary information to define the stack of voxels at that 2d position. It's more complex than the JFIMA, but without the width limitation.The catch is complexity limitations. I've only tested with a single map, though it theoretically supports linking to adjacent maps and referencing those for out-of-bounds collision checks. Limitations include being extremely difficult to move things (I made furniture part of the map, rather than objects, then decided it should be possible to move chairs around, and that is going to be a nightmare if I ever try to finish that aspect ).Navigation-wise, the game uses a Swamp-style radar and zone system. I have no idea how well this would work in practice; odds are, even though it is extremely similar, with just a couple extra sounds, no one will understand it, because that's how it usually goes when I do that sort of thing. But that doesn't mean the principal wouldn't work, since Swamp demonstrates that it can.Whether, in practice, this would turn out more like Swamp, or more like the JFIMA, I have no idea.So far as data compression goes, I have a two-story building and the area immediately in front of and behind it, including a road, in something like 50×60 tiles, except that the road and part of the front are much smaller, because they cover entire rows, and the map class auto-completes rows that aren't as wide as the map with the last entry. It should do the same with the last row z-wise, but I don't think I implemented that. So in practice, there are well under 3000 tiles. The only bits that gave me any trouble on the design front were occasionally messing up the upper floor for a certain tile, usually furniture or bathroom tiles. It's also necessary !be careful with is doors (it'd be a bit odd if opening a door upstairs affected a door or wall downstairs, after all).As regards the first question that started the topic, bugs with slopes were the worst. I think there might still be a spot where it's possible to glitch into the garden through the basement. Other than the bugs I mentioned earlier, there was something related to weird behavior on the edge of individual stairs, and I think there were others I don't remember so well atm. But other than that glitch which may or may not still be there, stairs worked smoothly enough the last time I tested.However, the tile properties are managed by dictionaries. A pointer to objects, or a list of objects with int indeces, are probably more efficient, but doing it this way is much easier to work with when using a string array to edit the map. If you have a way of editing that plays better with indeces or pointers, one of those would probably be better.

URL: https://forum.audiogames.net/post/522682/#p522682




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-25 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

Wayfar 1444 was only 2d.But to be honest it is a case study of what happens if you try to build this stuff without understanding data structures or algorithmic complexity at any level, because the endgame of it was "I can no longer afford to run the server, it's too big, so I've taken it down and I'm going to just try to make the graphical version I always wanted" whereupon he dropped off the face of the earth.  The ideas were cool, the gameplay was cool, but it made lots of mistakes like simulating your 500 planks of wood or whatever as literally 500 individual game objects and not sorting, etc.  So around the time I stopped playing it you would type get whatever and it'd just lag out for a while.Moo wasn't really the problem, I don't think, and the game had a lot of really interesting ideas and fun gameplay.  But in my opinion the minimum viable level of knowledge to write it is "understands binary search" and you will need a map compression strategy if you want to both have lots of players and run it cheaply.  Either the above, or something more suited to that sort of simulation.  You can get away with the slowest programming language imaginable, kind of, since for most game objects you only really need to tick them every couple seconds anyway, and all the parts of the world without players actively in them right now can just be slowed down or stopped.I think Wayfar generated the entire world ahead of time as individual moo rooms, and I am 99% sure that Moo doesn't have string internment, which means that just having the rooms alone means thousands of copies of the "This is a forest like all the other forests" paragraphs.Fortunately for networking, you can generate the world ahead of time, the client can download the world only once, and then you just have to figure out how to stream changes around.  Or you make the clients only download a 100x100 square at a time.  Or any of several other strategies I can think of off the top of my head, and a whole bunch that I can't.  You don't even need UDP because most of the world is really slow, and you can get fun combat the way lots of MMOs do, where you explicitly target enemies with tab or whatever instead of manually aiming.  The entire thing becomes barely more complicated than a mud command parser except that you don't even have to write the parser, because you can just use JSON.I am considering writing a compressed tilemap library for the 2d case under the Unlicense after Synthizer is finished, with the goal of being able to handle a map of any size and being able to hand you a list of changes since 5 minutes ago or something so that you can just send them out to the clients.  It's not overly hard to write this--indeed it's even not overly hard to make it possible to have the array be bigger than memory--but that's my definition of not overly hard.  For the curious, all you have to do is represent these as 128x128 squares or somesuch, then maintain a write-ahead log with periodic compaction.  Mind you, actually connecting clients to a world that's larger than memory is another beast entirely because you will eat all the memory on their laptop too easily and also they probably don't have the network bandwidth, so in practice you'd still probably want to keep it pretty small unless you feel like taking on some trickier aspects of this.  But you could still load lots of big maps in parallel into the same server with it.Either that or find and bind a library.Unfortunately the easiest way is Rust with Serde which means BSD components which means needing to distribute credit--I wish people would figure out that that hurts small devs.  But alas.  Either way this thread has taught me that most people don't know how to do this.

URL: https://forum.audiogames.net/post/522589/#p522589




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-25 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

Mm, Wayfar 1444 sounds like an interesting case study. Anyhoo, theres a simple minecraft demo written in python by [Michael Fogleman] that uses voxels that could be of use. I used it as the basis for my [Audiocraft] prototype to test out depthmap sonifying and navigation systems in 3D space, source code included. The collision detection doesn't seem to handle slopes however, buyer beware.

URL: https://forum.audiogames.net/post/522456/#p522456




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-24 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

Bleh, sorry, fuse SoundRTS with Shadow Rine.  SoundRTS plus BK3 makes no sense.

URL: https://forum.audiogames.net/post/522370/#p522370




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-24 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

You aren't the one calling me pessimistic.  I have a habit of calling out unrealistic stuff like "hey wouldn't it be great if Unity were accessible, let's make that happen" or the "let's make Fortnite accessible, sign my petition" and am developing a reputation for it these days, it seems.But, hey, what you're proposing is something that's both possible and something I've given thought to prototyping myself, so who am I to tell you no?  But I think you've maybe just bitten off more than you can chew, for now.If you want to apply the above compression technique to something feasible, you could go make Wayfar 1444 the audiogame.  2D maps are just compressing y instead of z.  The networking for it isn't overly terrible, and all you have to do or the map is take the above idea and add serialization and the ability to have a second sort of array on top to record all the player-modified tiles (since, presumably, you'd end up with more than 65k of them, as their health changes and all that).If you weren't around in the incredibly brief window that Wayfar 1444 existed, it was a moo that had very detailed space base/space colony building, with melee combat and stuff.  It fell over because it was his first programming project and he didn't know how to do things like code efficient get for 10k items per room, so in the end it would literally lag for seconds at a time for no reason.Basically fuse Bk3 with SoundRTS and you have a game that a good subset of the community would love.  Plus if the networking proves too hard you can make it single player with Ai-controlled disasters and stuff and you have accessible sci-fi sims with combat elements.  Etc.  I think you already know the pathfinding parts from your other thread on that and you just learned how to make giant maps that wouldn't normally fit in ram actually fit in ram so you don't even have to divide it up into rooms or anything.Just a thought, take it as you like.  But for a project that's close to what you've been learning here and something that I'd do myself if I had the time for such things, there's something you could probably do.

URL: https://forum.audiogames.net/post/522369/#p522369




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-24 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

No, I respect the honesty.  I’ll certainly consider it. Either way, it wasn’t a waste. I have learned something new, and that was my goal.

URL: https://forum.audiogames.net/post/522352/#p522352




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-24 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

No, I respect the honesty.  I’ll certainly consider it.

URL: https://forum.audiogames.net/post/522352/#p522352




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-24 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

A binary search before every write is indeed the solution.  You lose out on the write performance in exchange for the read performance.  That said, it is actually bounded.  You have the following cases:1. The tile isn't set, so you just insert the new entry.2. The tile lands on an entry that's 1 tile high, so you just replace it.3. Or the tile lands inside an entry that's "too big", so you split the entry before and after the tile, to make 3 new entries.But in all cases there's a finite amount of work to do, not an infinite loop.Have you Googled on these topics?  You should be able to find most of this info without me.If your immediate thought is "but moving objects will be slow" the answer is objects shouldn't ever live in the tilemap even in a 2D game, let alone a 3D one, and should be separate entities with a position.If you decide to proceed further with this, it's possibly worth looking at py.test and learning to write test cases.  I would go one step further and get something called Hypothesis to help out here, but it's probably nowhere near newbie friendly to someone who probably hasn't done a bunch of test suites yet (but then I've never tried to teach hypothesis to someone, and only learned about it a few months ago myself).But, here's the thing.  I have tried to ignore the elephant in the room but you're having enough trouble that I'm just going to bring it up anyway.  While I think it might be barely this side of possible to make a 3D audiogame, the algorithms to build a workable UI around it make this look like nothing by comparison.  The algorithms to do efficient collision detection are roughly of this complexity or worse.  Likewise for pathfinding.  Likewise for a bunch of other things.  No one even knows how to make level editors for this kind of thing either.  My best idea for it is an entire custom domain specific language to describe maps as semantic pieces that you stitch together.  People have tried this before and either they halfway sorta succeed (CAE for instance) and their game is playable by almost no one but the author, or they discover that all of the problems you're going to face with respect to converting a 3D environment to audio haven't been solved and are even arguably unsolvable.I would suggest stepping back and doing something 2D.  I would have said something along these lines sooner, except that I've watched you learn incredibly quickly and I have ideas on how this could be done myself.  But fair warning.  If you keep going you're going to keep hitting your head against walls indefinitely--algorithmic walls, we don't know how to expose this to blind people walls, we don't know how to even let me build the levels walls.I would rather say this, get called pessimistic again, and see you succeed at a not-quite-as-ambitious project, than not say something and see you quit in frustration in 3 months.

URL: https://forum.audiogames.net/post/522350/#p522350




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-24 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

So I have an entirely different problem now.My binary search works, as long as the tiles don't overlap each other. For example, it would work correctly on the following arrays:start = [0, 2]
end = [1, 3]As you can see, there are no overlapping tiles, and thus the binary search can do it's magic. Consider these arrays, however.values = [7, 8, 9]
start = [1, 2, 3]
end = [3, 4, 5]See the issue here? The binary search I came up with only returns the tile type of the entry if the given coordinate is greater or equal to the start and less than or equal to the endpoint. If I was to run my binary search using the value 4, it will return 8 when in fact it should return 9 because 9 is the latest override to the list which covers 4What I would like is for the array to realize that I'm overriding one of it's values. However, the in operator wouldn't work, seeing as the value I'm overriding could be between two values, like so.values = [3, 4]
start = [0, 1]
end = [6, 2]If you try and run a binary search using the value 1, you wouldn't get 4, the expected and correct output. You would get 0 instead, which, though being correct, is not the latest information in regards to the said coordinate.I thought that my binary search was implemented incorrectly, but googling only brought me code similar to mine. The search also works when the tiles don't overlap, which makes me suspect that the problem is in the tiles being overwritten.So, I considered how to fix the problem, and the only clean solution I came up with was to run a binary search testing if the said coordinate was already covered every time a new value was added to the list. If it is, I would split the old tile into two pieces and stick the new tile between them. Problem is, that insertion could override another tile, and the split of that tile could override another tile, and the split of that tile could... you get the picture.I'm asking here just in case I'm missing something obvious. I could certainly deal with the tiles being the way they are right now, but it would be nice if I could take out the problem of overlapping out of the picture. Is there a better way to handle overrides than what I proposed?

URL: https://forum.audiogames.net/post/522340/#p522340




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-22 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

Yes it does. We would have one CompressArray object per an increase in y. So we would have a list of lists of compressed lists, but the compressed list would actually be the class  holding those three arrays. Thank you.  I’m sorry for the necessity to repeat yourself all this time.

URL: https://forum.audiogames.net/post/521805/#p521805




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-22 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

Ah. I see.  The question you're trying to ask is about abstraction, but you're phrasing it as about data.The three arrays go in a CompressedArray class with a .get and a .set method and whatever else you want on it, then you use it wherever you want a compressed list of things.You can also test and work on that separately from everything else, if you do it that way.  It's an entirely separate module if you want it to be.  Break problems down into their smallest component (in this case making a compressed list), then put the resulting pieces together.  You can use it for 2d maps too this way, as well.Does this help?

URL: https://forum.audiogames.net/post/521798/#p521798




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-22 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

I understand that. Like I said, I got the vertical lists, the ones that have tuples inside them stating the tile ranges. What I'm failing to grasp here are the three arrays.I understand how they work. I got that the tiles are alined by their indexes. What I fail to grasp is how does the tuple of map[0][0][(ground, 0, 15)] gets replaced with three arrays which hold the information like so:values = [ground]
start = [0]
end = [15]Where does this get stored, in the x - y list?The tuples made sense because they were ultimately placed inside the x - y list. I have no clue where the three arrays would be located at. You said that this is invalid:grid = [[[array("h", (ground,)), array("h", (0,)), array("h", (0,15))]]]Which rules out the possibility of storing the array within the list. So, the list of lists of compressed lists wouldn't really work here, as far as you told me.I think we just have miscommunication here. We're restating the same question and answer over and over with neither party really understanding what the other is asking.I will ask once again and then take a break for a couple of weeks if I still don't get it. Sometimes it just helps to have the information sitting at the back of one's brain for a bit, stew it all over.In your three array example, do the three arrays contain the information for all the tiles present on the map, or does a new set of arrays get created for representing either another tile or column? If so, which one?Again, I understand the idea of compression. I understand how to build an algorithm achieving the task. I don't understand the idea of three arrays and how they are related to the list.Can you type up a 2d list using the 3 array method? A 2 column should be fine, take liberties in writing sudo code if necessary, I just need to understand how the three arrays get stored and their interaction with the list.

URL: https://forum.audiogames.net/post/521797/#p521797




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-22 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

I understand that. Like I said, I got the vertical lists, the ones that have tuples inside them stating the tile ranges. What I'm failing to grasp here are the three arrays.I understand how they work. I got that the tiles are alined by their indexes. What I fail to grasp is how does the tuple of map[0][0][(ground, 0, 15)] gets replaced with three arrays which hold the information like so:values = [ground]
start = [0]
end = [15]Where does this get stored, in the x - y list?The tuples made sense because they were ultimately placed inside the x - y list. I have no clue where the three arrays would be located at. You said that this is invalid:grid = [[[array("h", (ground,)), array("h", (0,)), array("h", (0,15))]]]Which rules out the possibility of storing the array within the list. So, the list of lists of compressed lists wouldn't really work here, as far as you told me.I think we just have miscommunication here. We're restating the same question and answer over and over with neither party really understanding what the other is asking.I will ask once again and then take a break for a couple of weeks if I still don't get it. Sometimes it just helps to have the information sitting at the back of one's brain for a bit, stew it all over.In your three array example, do the three arrays contain the information for all the tiles present on the map, or does a new set of arrays get created for representing either another tile or column? If so, which one?Again, I understand the idea of compression. I understand how to build it. I don't understand the idea of three arrays and how they are related to the list.Can you type up a 2d list using the 3 array method? A 2 column should be fine, take liberties in writing sudo code if necessary, I just need to understand how the three arrays get stored and their interaction with the list.

URL: https://forum.audiogames.net/post/521797/#p521797




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-22 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

I understand that. Like I said, I got the vertical lists, the ones that have tuples inside them stating the tile ranges. What I'm failing to grasp here are the three arrays.I understand how they work. I got that the tiles are alined by their indexes. What I fail to grasp is how does the tuple of map[0][0][(ground, 0, 15)] gets replaced with three arrays which hold the information like so:values = [ground]
start = [0]
end = [15]Where does this get stored, in the x - y list?The tuples made sense because they were ultimately placed inside the x - y list. I have no clue where the three arrays would be located at. You said that this is invalid:grid = [[[array("h", (ground,)), array("h", (0,)), array("h", (0,15))]]]Which rules out the possibility of storing the array within the list. So, the list of lists of compressed lists wouldn't really work here, as far as you told me.I think we just have miscommunication here. We're restating the same question and answer over and over with neither party really understanding what the other is asking.I will ask once again and then take a break for a couple of weeks if I still don't get it. Sometimes it just helps to have the information sitting at the back of one's brain for a bit, stew it all over.In your three array example, do the three arrays contain the information for all the tiles present on the map, or does a new set of arrays get created for representing either another tile or column? If so, which one?

URL: https://forum.audiogames.net/post/521797/#p521797




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-22 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

@19I honestly don't know.  You've taken what is a very simple encoding of a list of values and overcomplicated it.All the technique I've given you does is take a list like [1, 1, 1, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5] and make it really really small by using the fact that it has lots of repeated values.  This isn't even related to maps.  All I've described is a thing that takes a list like that and makes it small.You go map[x][y][z].  There's an outer list that holds all the y lists.  Then each of the y lists has some z lists inside it.  You are just replacing the z lists with compressed lists.  Absolutely nothing more happens here.You know which x-y pair your compressed z axis goes with.  When you decompress it, you just use the fact that you did map[2][3] to get to that array and fill the 2 and the 3 in as you go.Let me walk through this.Map is a list of lists of lists.map[x] is a list of lists.map[x][y] is a list.map[x][y][z] is a tile.Now, with the compressed version:map is a list of lists of compressed lists.map[x] is a list of compressed listsmap[x][y] is a compressed list.map[x][y][z] is a tile.If you still don't get it, there is literally no better way I can explain this other than to tell you to google voxels and run length encoding and stuff like that to find examples or something.  If this is still confusing, I suggest either doing small maps or getting a library if you can find one.

URL: https://forum.audiogames.net/post/521791/#p521791




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-22 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

@camlorn, we must then have an array holding more indexes to the three arrays that hold our tile information.Consider the good old example from post 15:value = [1, 2, 3]
start = [4, 5, 6]
stop = [7, 8, 9]If we look at this in a 2d grid (our y gets encoded), we can't tell the x by reading the y array directly. We must have something like this:grid = [
 [1, 2],
 [0, 1]
 [0, 1, 2]
]If we do not have an array with these indexes, we can't distinguish whether a tile matches the x value, leading to wrong output.In practice, what would happen is me passing in the point, something like (0, 0), and then the program would perform a binary search through the tiles that the zeroth column of the grid has marked present and check if the coordinate, 0 in this case, is being covered by the tile boundaries.Let's do another example. I pass in the point (2, 4)The program goes through the tiles at position 2 on the x and find that 4 is being covered by the zeroth tile in the arrays, which has a tile type of 1.What am I missing here?

URL: https://forum.audiogames.net/post/521790/#p521790




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-22 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

You need more elements for the array to be beneficial.  Also getsizeof may not be counting the ints in the tuple: "Only the memory consumption directly attributed to the object is accounted for, not the memory consumption of objects it refers to." (from the docs).  What this means I don't know.  But in general that function is a bit ill-defined.  Some quick experiments at a shell suggests that it does indeed not include the ints: consider sizeof((1, 1, 1)) versus sizeof(1)*3 and you can see that it doesn't make sense.Python doesn't have value types.  Python just has types where all the things you might do to the type happen to make a copy of it.  This is also true of JS and most other dynamic languages.  Wherever you see a thing that looks like a value, it's probably implicitly a pointer plus a tag saying what kind of value it is.  This isn't horribly inefficient because they do some things with allocation that are out of scope for the current discussion.There is overhead though, yes.  The length of the array itself, some Python internal machinery, I believe some reserved space so that you can append without copying. Consider:values = [0 for i in range(10)]
values_array = array.array("h", values)

#prints 824464 on my machine
sys.getsizeof(values)
#prints 200064 on my machine
sys.getsizeof(values_array)Shorts are two bytes.  So 64 bytes go "missing" for some reason.  We could check the Python source if we really wanted to know.The first example of the plain old list also definitely doesn't include the ints: that's only enough bytes to encode 10 pointers on a 64-bit machine (where pointers are 8 bytes each).  As far as I know Python doesn't do pointer tagging tricks to put ints inline; again, we'd have to check Python source and stuff to find out.  But as someone who knows about such things, it would be surprising to me if they did, and even if so you can't shove a whole tuple into a pointer anyway.It is useful to think of Python lists like spines of a skeleton, where all the interesting stuff hangs off them to somewhere else in memory, if that helps you visualize the internals.Also you will discover that many things in programming as you reach the intermediate levels are horrible when run on small numbers of values, but better beyond belief when you throw large numbers of values at them.  Go a bit further and you discover that we even have ways of talking about it, so that we can describe to each other how quickly things get better or worse as you throw more values into them.  This is called algorithmic complexity, or big-o notation. You will see it at some point if you haven't already--data structure libraries almost always document algorithmic complexity.No, the y columns don't also contain these 3 arrays.  You can only compress one dimension with this approach and it always has to be the deepest index of the array.  So if it's map[x][y][z] you have to compress z only.  You can do more effective compression than this, but it's much more complicated and I wouldn't advise trying to go there for your project (and if you did, certainly not until you understand this one).Now this last bit might seem unrelated, if it does you already have the concept.  But if you don't, or if this seems weird, think about it for a while and several things might click for you:A 1d map is an array of tiles.A 2d map is an array of 1d mapsA 3d map is an array of 2d maps.I point that out explicitly because I think a large chunk of your confusion is that you haven't yet realized that maps are a composable thing.  You can do other things like make a 3d map that's a map of 128 by 128 by 128 cubes all connected together with some parent arrays where you figure out which cube it is by dividing the indexes by 128 for example--this will work, and is even on the way to one of the more advanced compression methods you can consider, it's just hard to code.

URL: https://forum.audiogames.net/post/521774/#p521774




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-22 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

Consider this code:import array, sys
x = array.array("h", (1, 2))
y = (1, 2)
print(sys.getsizeof(x), sys.getsizeof(y))The expected output?36, 28Why is a C array bigger than a plane old tuple? Is the getsizeof method wrong here?Finally, and thisshouldbe the last question on the three array subject. I'm assuming that, just like with the vertical lists, each y column will contain those three arrays. Am I correct on that front? Pretty sure I am, it's just again the "more affirmation couldn't hurt" side of me

URL: https://forum.audiogames.net/post/521768/#p521768




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-21 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

Thank you. That did help, a lot.

URL: https://forum.audiogames.net/post/521507/#p521507




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-21 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

I'm going to break this down differently, maybe it will get you un-lost.  I'm also going to stick to 2d maps, the extension to 3d is (hopefully) straightforward and this probably ends at needing to type examples.Problem 1 is map compression:A 2d map in Python is a list of lists. The outer list are the x coordinates. The inner lists are y columns.  So, a square is just:[
 [1, 1, 1],
 [1, 0, 1],
 [1, 1, 1]
]I'm sticking to a square because sadly the only way to type this as valid Python is to write x vertically.And the compressed square is:[
 [(1, 0, 2)] #  wall starts at 0, goes for 2.
 [(1, 0, 1), (0, 1, 1), (1, 2, 1)]
 [(1, 0, 2)]
]Now you're going to say "wow, that's actually bigger", and it is, but if this were a 20 by 20 square it wouldn't be.But the important thing for getting this is that we took a 2d map from a list of lists to a list of compressed lists.  In the 3d case you go from a list of lists of lists to a list of lists of compressed lists.If you just stop here it will be good enough for large maps.  If you don't get the rest of this, that's okay.The second problem is Python representation of things.  But before I get into specifics, here's some code:value = [1, 2, 3]
start = [4, 5, 6]
stop = [7, 8, 9]

expected = [(1, 4, 7), (2, 5, 8), (3, 6, 9)]

def get(x):
return (value[x], start[x], stop[x])

assert [(get(0), get(1), get(2)] == expectedThat'll pass if I didn't typo anything.And now is where I use the fact that I've helped you to learn c and apologize for losing everyone else, and explain the problem this multiple array thing actually solves.A value in Python looks a bit like this, except using C features and memory tricks you probably don't know yet:struct value {
int type; // from a list of constants, None/number/list/dict/object
void *value;
};The type tells us what the value is, so we look up the value in a void* and cast.  Notice that this is 12 bytes just to be able to *have* a value, not actually what's in it.  A tuple is then:struct tuple3 {
int size;
struct value values[3];
}In practice it's dynamically allocated with magic that lets you have slightly more efficient things and means you don't have to have one struct for each size of tuple, but that's the idea.  Notice that even though you just wanted a tuple of 3 ints you have this extra size field on the tuple, and 3 extra "this-is-an-int" fields in the values, and then each of those has a pointer to the actual int somewhere else.  A list, of course, is a big array of values with pointers to tuples, that again wastes the type field for every element.Additionally, all Python ints are 8 byte numbers (I believe).  And referring to an object has the same overhead as anything else because we tag it saying it's an object.  So, how can we make this better?Well, by using the array module, which lets you get lists from Python that only hold one type, provided that that type is one of a few kinds of integers.  Each value in those isn't tagged with the type, it doesn't have an extra pointer being stored that points at the value.  It's just a plain old vanilla C array.  But we can't get tuples in them because tuples aren't integers.  Except that two of the values here are definitely integers, and the third (that being the tile itself) can be, if you just assign numbers to all your tiles.So: what is the difference between 5 tuples in a list, and 3 arrays of  5 elements each that you put the tuples back together from as I showed above?  Something like 30 or 40 bytes per tuple.And what is the difference between using the biggest possible int for everything or saying that you only have say 65000 different kinds of tiles at most?  That you get to use a 2 byte integer instead of an 8 byte integer for the tiles array, whioch gets you another 6 bytes per tuple stored.And, if we don't store the default tile so that we can say our runs only go 255 units long, then the int for the number of tiles in the run goes from an 8 byte int to a 1 byte int, which is another 7 bytes per tuple, plus in the process you stopped storing air all together.And if you go one step further and say that the map will never be higher than 65535 meters (quite tall enough for anyone) you get to make the start array a 2 byte int instead of an 8 byte int for another 6 bytes per tuple.And now you're down to 2 bytes for the tile, 2 bytes for the start, and 1 byte for the run length.  Just 5 bytes total for each tuple.  That is literally better than the equivalent C struct:struct run {
uint16_t tile;
uint16_t start;
uint8_t run;
};Which will be 6 bytes, not 5, because of things in C that make structs have to be a multiple of their largest element in size (don't believe me, get out the C compiler, include stdint.h, and try sizeof on it.  Why this is the case is well out of scope, but suffice it to say there are good reasons).Again: take or leave however much of this you want to take or leave.  It ju

Re: Representing 3d Staircases? (Python)

2020-04-21 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

@13, I am sorry. I figured you were using an array to hold those, but I go with the you can never have too much information root.I have the vertical lists working. Could you please explain what you meant about having three arrays for start stop and distance?In post 8, you write:As for the array thing, what I'm saying is that if you have:[(1, 2, 3), (4, 5, 6), (7, 8, 9)]As a list of tuples, you can instead do:part1 = [1, 4, 7]part2 = [2, 5, 8]part3 = [3, 6, 9]And then instead of just reading from the one list, you read from all 3.So, from what I understand, you are suggesting to create three arrays, each dedicated to holding specific information about the map tile. The first array holds it's type, the second defines where it starts at (I'm assuming that we are still referencing z), and the third tells us where the tile stops.I think I figured out where I'm getting thrown off. If these arrays are designed to hold information about all map tiles, are we still using a 2d array to store indexes of those tiles?Oof, perhaps an example would help...reference_list = [
[0, 0, 0]
[0, 1, 1]
[0]
]The way I would read this is thus:(0, 0), (0, 1), (0, 2) contain a tile of type 1 from 4 to 7 on the Z axes(1, 0) contains a tile of type 1 from 4 to 7 on the z axes.(1, 1) and (1, 2) contain a tile of type 4 from 5 to 6 on the z axes.(2, 0) contains a tile of type 1 from 4 to 7 on the z axes.Is this what you meant when you said we could have 3 arrays instead of all the tuples?

URL: https://forum.audiogames.net/post/521501/#p521501




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-19 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

@12I'm leaving out the x and y parent arrays for clarity and because I don't particularly feel like typing a page-long example of this that includes all the nested lists.  That's just one vertical column.  You need to put a bunch of vertical columns in a 2d array, and you know where it is because you know which column in the 2d array you're reading.

URL: https://forum.audiogames.net/post/520893/#p520893




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-19 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

Okay. I think I understand what you mean, at least by the vertical tile method. My question is... how would I know where the x and y of those tiles are?For example, let's take your very first demonstration of vertical distancing:[(floor, 0, 1), (air, 1, 10), (ceiling, 11, 1)]We don't actually know where are those tiles at on the x - y plane. All we know that there is floor at 0 on the z, somewhere, some air above it, and then a ceiling. Am I correct on that front?If I am, then how do I know that the floor is at, say, (0, 0, 0) and not at (1, 0, 0).I think that's where I'm losing you at.

URL: https://forum.audiogames.net/post/520890/#p520890




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-19 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

@10I was addressing the overhead point.  In addition to letting you go big with respect to the map, such techniques as this let you go small with respect to the tiles.  You don't need to worry about paging from disk and stuff unless you're going to be Minecraft scale, but I opted to be complete in my answer. Take what parts of it are useful to you, and leave the rest.A 3 by 3 by whatever map would look like this:[
[encoded, encoded, encoded],
[encoded, encoded, encoded],
[encoded, encoded, encoded]
]Where the x and y are just a normal array, and the z is the special encoded array.  If you want this to actually work like a normal list, there are special Python methods you can add to your class to make brackets work.A single z column of a cavern, using the (tile, start, distance) tuples might look like this:[(floor, 0, 1), (air, 1, 10), (ceiling, 11, 1)]But as I said you can opt to leave out the air tiles if you want, and just keep the floor and the ceiling.If it's really tall and you hit the limit of 255, you'd just include a second segment with the remainder:[(floor, 0, 1), (air, 1, 255), (air, 256, 255), (air, 511, 255), (ceiling, 766, 1)]I'm suggesting 3 arrays per z-column called start, stop, and distance, where if you want the 0th tuple you grab the 0th index from all 3 and put it together yourself.  But since I've apparently confused multiple people maybe dohn't worrya bout that part of this until you have the rest working.  It's an important optimization and actually very easy to do, but if it's confusing it's not necessary to benefit.Also, it's perhaps worth calling out that you can do the same thing with a 2d map where y columns are encoded, for whoever might try to make the next wayfar 1444.

URL: https://forum.audiogames.net/post/520870/#p520870




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-19 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

@8. I'm not saying that I can't go forward because I'm limited on resources. I was stuck because of not knowing how to represent accurate staircases with my current map system. I did have a potential solution which I briefly mentioned at the end of post 1 (1 tile per an increase in elevation) but that seemed like it would be a waste.So, to clarify:You suggest the use of 3 arrays, 1 per dimension, each of them holding entries containing the current tile (integer) it's starting point, and the distance (integer below 255). If the tile is greater than 255, make another entry in the list with the remainder of the tile's distance after accounting for the built distance.Anything I missed?I know I leave out the compression and loading maps in chunks, but I want to get the main idea down and working before moving on.

URL: https://forum.audiogames.net/post/520867/#p520867




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-19 Thread AudioGames . net Forum — Developers room : manamon_player via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

maybe falling system can help

URL: https://forum.audiogames.net/post/520862/#p520862




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-19 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

@7Yes, that's reading it correctly. The tuples are tile, start, stop.  Though I do suggest tile, start, length if the map is going to be higher than 255 tiles.As for the array thing, what I'm saying is that if you have:[(1, 2, 3), (4, 5, 6), (7, 8, 9)]As a list of tuples, you can instead do:part1 = [1, 4, 7]
part2 = [2, 5, 8]
part3 = [3, 6, 9]And then instead of just reading from the one list, you read from all 3.  I'm not using tiles because this concept is more general than that.In a language like C the latter is much more efficient in some cases for reasons to do with CPU caches, but in Python it's kind of a bigger deal for this because a normal Python int is actually huge.  A normal list of tuples of ints in Python is actually a list of pointers to tuples, and the tuples are pointers to ints.  But it's worse than that, because Python being dynamically typed means that each of those pointers has a second piece of data as well saying what type it is.  You can represent your map with as few as 5 bytes per run if you separate the fields out and use the array module, but if you do it with Python lists you're going to be looking at 70 or 80 bytes for each run, since non-array-module lists have to assume that they don't know the type of the elements (this concept is called boxing, if you want something to google).We don't care about this for 2d tile grids because 1024*1024*100 is only 100MB, and most games are much, much smaller anyway.  Plus with the array module or numpy or any of like 5 other things you can get it down to 1024*1024*10 at worst, which is fine--no one is going to miss 10MB of ram.  But for large 3D maps, the third dimension kills you: 1024*1024*16*10 for a 1KM city that's only 16 meters tall is already near 200MB of ram.Much of this just boils down to how big is your map, but my main point is that if you're saying "I can't go bigger because of overhead", yes you can, this is how, and many have before you.

URL: https://forum.audiogames.net/post/520852/#p520852




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-19 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

@2, I have another question:you give an example of tiles like so:[(ground, 0, 5), (sand, 5, 7), (air, 7, 15), (cave ceiling, 15, 20)]Assuming that my list is a vertical dimension, the tiles here specify that...There's a ground tile at (0, 0, 0) to (0, 0, 5).There is sand at (0, 0, 5) to (0, 0, 7).There is air at (0, 0, 7) to (0, 0, 15).etc.Is this how am I supposed to read this?I have another question... but it will highly depend on me being correct in reading the tile example.@6, I see. Thank you.

URL: https://forum.audiogames.net/post/520815/#p520815




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-19 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

@2, I have another question:you give an example of tiles like so:[(ground, 0, 5), (sand, 5, 7), (air, 7, 15), (cave ceiling, 15, 20)]Assuming that my list is a vertical dimension, the tiles here specify that...There's a ground tile at (0, 0, 0) to (0, 5, 0).There is sand at (0, 5, 0) to (0, 7, 0).There is air at (0, 7, 0) to (0, 15, 0).etc.Is this how am I supposed to read this?I have another question... but it will highly depend on me being correct in reading the tile example.@6, I see. Thank you.

URL: https://forum.audiogames.net/post/520815/#p520815




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-19 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

@2, I have another question:you give an example of tiles like so:[(ground, 0, 5), (sand, 5, 7), (air, 7, 15), (cave ceiling, 15, 20)]Assuming that my list is a vertical dimension, the tiles here specify that...There's a ground tile at (0, 0, 0) to (0, 0, 5).There is sand at (0, 0, 5) to (0, 0, 7).There is air at (0, 0, 7) to (0, 0, 15).etc.Is this how am I supposed to read this?I have another question... but it will highly depend on me being correct in reading the tile example.@6, I see. Thank you.

URL: https://forum.audiogames.net/post/520815/#p520815




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-19 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

@2, I have another question:you give an example of tiles like so:[(ground, 0, 5), (sand, 5, 7), (air, 7, 15), (cave ceiling, 15, 20)]Assuming that my list is a vertical dimension, the tiles here specify that...There's a ground tile at (0, 0, 0) to (0, 0, 5).There is sand at (0, 0, 5) to (0, 0, 7).There is air at (0, 0, 7) to (0, 0, 15).etc.Is this how am I supposed to read this?I have another question... but it will highly depend on me being correct in reading the tile example.

URL: https://forum.audiogames.net/post/520815/#p520815




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-19 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

JFIMA uses movement counters, and they are independent for each dimention. So the horizontal part and the vertical part are generally handled separately. In theory, it can do diagonals, but I never got around to making the controls more diagonal-friendly.So if one jumps onto a slope, it's basically the same as walking onto it. I will point out, though, that the JFIMA does not allow you to walk under anything.

URL: https://forum.audiogames.net/post/520807/#p520807




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-19 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

@2. When you suggest using an array to hold a tile and it's distance, do you still keep the RLE in the picture? Are those mutually inclusive? From what I read about the algorithm it really is a toss up, that is, you can and couldn't do this.You write the following:Concretely I'm suggesting 3 arrays, tile, start, stop, that represent the parts of the tuples.I have difficulty following you hear. Do you mean 3 arrays? 3 tuples? Can you elaborate? Also, wouldn't the start and stop arrays have to hold information as to what tiles they are responsible for?Those are the questions I had right after reading the post... I'll continue researching and will come back and reread it again, just in case something else jumps out at me.@4, does JFIMA support jumping? If so, how did you handle slopes while the character's are in the air? What if the player performs my example from post 1, that is, stand next to your staircase and then jump onto it, how would JFIMA handle that?

URL: https://forum.audiogames.net/post/520790/#p520790




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-19 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

@2. When you suggest using an array to hold a tile and it's distance, do you still keep the RLE in the picture? Are those mutually inclusive? From what I read about the algorithm it really is a toss up, that is, you can and couldn't do this.You write the following:Concretely I'm suggesting 3 arrays, tile, start, stop, that represent the parts of the tuples.I have difficulty following you hear. Do you mean 3 arrays? 3 tuples? Can you elaborate?Those are the questions I had right after reading the post... I'll continue researching and will come back and reread the post again, just in case something else jumps out at me.@4, does JFIMA support jumping? If so, how did you handle slopes while the character's are in the air? What if the player performs my example from post 1, that is, stand next to your staircase and then jump onto it, how would JFIMA handle that?

URL: https://forum.audiogames.net/post/520790/#p520790




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-19 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

The way slopes work in the JFIMA is that, if a char tries to walk into that tile from its height minus 1, they are automatically moved up as well as forward. Otherwise, it behaves like any other stack of tiles.If you want it to be smoother than this, you need to calculate the height of each block at an arbitrary position on the xy / xz plane (whichever is your floor). Since these are presumably best described as cubes that are cut in half along the slope, the math is a bit easier than for arbitrary right triangular prisms (i.e. a slope that rises in the positive x direction is just y = x-tile_x).Notice, though, that this means you'll do the bunny-hop going down a slope, which might be a little less awkward in audio, but see what I did with Sonic for how that can still be awkward in audio. Avoiding this requires that you rotate horizontal movement when on a slope, which always sounds like a huge pain but turns out not to be afterward, somehow.If you allow things to be under your stairs, you might want to be careful that slopes only work horizontally. Otherwise, hitting a slope from below will cause the player to teleport through it, which I somehow keep failing to prevent in that Halloween thing I'll probably never finish even though it's so simple. You could just put a solid block under the slopes, and hope that things never align so that the player hits one diagonally, but that's kinda messy and if the slope-behavior can handle it instead, that's much better.

URL: https://forum.audiogames.net/post/520734/#p520734




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-19 Thread AudioGames . net Forum — Developers room : ogomez92 via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

I understood roughly 0.5% of post 2. Maybe I'm stupid or something.After re reading it I understand about 15%. Hmm.

URL: https://forum.audiogames.net/post/520715/#p520715




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-19 Thread AudioGames . net Forum — Developers room : ogomez92 via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

I understood roughly 0.5% of post 2. Maybe I'm stupid or something.

URL: https://forum.audiogames.net/post/520715/#p520715




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-19 Thread AudioGames . net Forum — Developers room : ogomez92 via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

I understood roughly 0.5% of post 2.

URL: https://forum.audiogames.net/post/520715/#p520715




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-18 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

You want to look into how Minecraft is implemented: it is exactly what you want to do here.  Though I'm not sure how you're going to get around the "vertical HRTF sucks" problem.  I imagine that's where you'll stop, but since I've had ideas on this myself, maybe it can be done.  If you are hoping to do a staircase without any tiles at all, you'll be disappointed: even sighted games that use voxels use voxels for those parts of the geometry.And yes, the magic Google word is voxel.You can save on resources by encoding your map in run-length encoding.  That is, pick a  dimension (say z), then instead of having the map be a big 3d array, it's a 2d array of lists, and each list looks a bit like this:[(ground, 0, 5), (sand, 5, 7), (air, 7, 15), (cave ceiling, 15, 20)]Where the numbers are the start and stop for each tile in that vertical column.  Because most tiles are air, and because when they aren't they're usually runs of the same thing, you can compress the map very significantly--significantly enough that being thousands of tiles in all dimensions is perfectly possible on a laptop.  There are libraries for this I believe: it's called run length encoding.Go two steps further, though: first, never record the default tile at all.  Second, replace your tiles with integers that refer to a tile in the tile map.  Then you have tuples of 3 integers each, and you can grab Python's built-in array module, which will pack it as efficiently as C.  Concretely I'm suggesting 3 arrays, tile, start, stop, that represent the parts of the tuples.Go one step further still: you don't do (tile, start, stop), you do (tile, start, distance), and you say that distances will never be more than 255.  Now the array for distance can be a byte instead of a multi-byte int, for another factor of 2 (or 4) on savings, and when it needs to be more than 255 you just add another entry with the same tile (and because you never record the default tile, this almost never happens).As for accessing this, you find the x and y in the obvious manner, then you do a binary search on the entries in the column to find the one that's closest to where you need to be.  Then either it's covering the coordinate you're interested in, or the coordinate you're interested in is the default tile, which is probably air.Make the default tile air and you don't pay for huge caverns *at all*.Next run this through cython, possibly with some type hints, and you'll be able to handle 1024 tile cubes like they're nothing at all."But that's not enough," I hear you say. "It's no good unless it can simulate a whole planet": to get that, do the following.1. For anything beyond a certain distance from the player, stop simulating it all together. It can be in memory but you never touch it (note: you need something like an octree to efficiently find out what's close to the player);2. Learn about mmap, which lets you treat files on disk like they're actually in memory, and the OS will handle whether it is or not for you depending on what's available (if you're wondering how big multi-terabyte databases work without going insane with seek calls, this is it);3. Change the top-level x/y coordinates from an array to a set of boxes, where each box is a file on disk that's run-length encoded, so say 128 by 128 squares, and load/unload them on demand; and4. If you need to do really complicated physics, fully decode the world into a 3d array for some distance around the player on demand.You can do all of this in Python unless you decide you need to do graphics, but you can probably also do the graphics in Python.  Some of it requires numpy and some of it requires cython, it won't be as fast/lean as if you used something else, if you try to go multiplayer you'll very quickly need threads (since everyone can be very far apart from each other).  But yeah, Python scales out this far.And for the trade-off: you lose write performance.  Not enough that the level editor is going to care, but enough that if you want to do minecraft-style falling sand or pistons or something you'll need to do further optimization.Edit: the last paragraph was supposed to say write performance.

URL: https://forum.audiogames.net/post/520641/#p520641




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Representing 3d Staircases? (Python)

2020-04-18 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: Representing 3d Staircases? (Python)

You want to look into how Minecraft is implemented: it is exactly what you want to do here.  Though I'm not sure how you're going to get around the "vertical HRTF sucks" problem.  I imagine that's where you'll stop, but since I've had ideas on this myself, maybe it can be done.  If you are hoping to do a staircase without any tiles at all, you'll be disappointed: even sighted games that use voxels use voxels for those parts of the geometry.And yes, the magic Google word is voxel.You can save on resources by encoding your map in run-length encoding.  That is, pick a  dimension (say z), then instead of having the map be a big 3d array, it's a 2d array of lists, and each list looks a bit like this:[(ground, 0, 5), (sand, 5, 7), (air, 7, 15), (cave ceiling, 15, 20)]Where the numbers are the start and stop for each tile in that vertical column.  Because most tiles are air, and because when they aren't they're usually runs of the same thing, you can compress the map very significantly--significantly enough that being thousands of tiles in all dimensions is perfectly possible on a laptop.  There are libraries for this I believe: it's called run length encoding.Go two steps further, though: first, never record the default tile at all.  Second, replace your tiles with integers that refer to a tile in the tile map.  Then you have tuples of 3 integers each, and you can grab Python's built-in array module, which will pack it as efficiently as C.  Concretely I'm suggesting 3 arrays, tile, start, stop, that represent the parts of the tuples.Go one step further still: you don't do (tile, start, stop), you do (tile, start, distance), and you say that distances will never be more than 255.  Now the array for distance can be a byte instead of a multi-byte int, for another factor of 2 (or 4) on savings, and when it needs to be more than 255 you just add another entry with the same tile (and because you never record the default tile, this almost never happens).As for accessing this, you find the x and y in the obvious manner, then you do a binary search on the entries in the column to find the one that's closest to where you need to be.  Then either it's covering the coordinate you're interested in, or the coordinate you're interested in is the default tile, which is probably air.Make the default tile air and you don't pay for huge caverns *at all*.Next run this through cython, possibly with some type hints, and you'll be able to handle 1024 tile cubes like they're nothing at all."But that's not enough," I hear you say. "It's no good unless it can simulate a whole planet": to get that, do the following.1. For anything beyond a certain distance from the player, stop simulating it all together. It can be in memory but you never touch it (note: you need something like an octree to efficiently find out what's close to the player);2. Learn about mmap, which lets you treat files on disk like they're actually in memory, and the OS will handle whether it is or not for you depending on what's available (if you're wondering how big multi-terabyte databases work without going insane with seek calls, this is it);3. Change the top-level x/y coordinates from an array to a set of boxes, where each box is a file on disk that's run-length encoded, so say 128 by 128 squares, and load/unload them on demand; and4. If you need to do really complicated physics, fully decode the world into a 3d array for some distance around the player on demand.You can do all of this in Python unless you decide you need to do graphics, but you can probably also do the graphics in Python.  Some of it requires numpy and some of it requires cython, it won't be as fast/lean as if you used something else, if you try to go multiplayer you'll very quickly need threads (since everyone can be very far apart from each other).  But yeah, Python scales out this far.And for the trade-off: you lose read performance.  Not enough that the level editor is going to care, but enough that if you want to do minecraft-style falling sand or pistons or something you'll need to do further optimization.

URL: https://forum.audiogames.net/post/520641/#p520641




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Representing 3d Staircases? (Python)

2020-04-18 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Representing 3d Staircases? (Python)

I have tried googling this and so far have found nothing that precisely answered my question.Below is some sample code for my current map tile class.class tile:
def __init__(self, minX, minY, minZ, maxX, maxY, maxZ):
self.minimumX = minX
self.minimumY = minY
self.minimumZ = minZ
self.maximumX = maxX
self.maximumY = maxY
self.maximumZ = maxZ

def coordsinSelf(self, x, y, z):
return x >= self.minimumX and x <= self.maximumX
and y >= self.minimumY and y <= self.maximumY 
and z >= self.minimumZ and z <= self.maximumZIn short, I want to have a real staircase which the user can walk up and down on. The movement would increase the user's Y and Z, or Z and Y depending on how you perceive coordinates. I do not want the user to hold page up and essentially move strait up in the air... I actually want slopes.My issue? The current tile system I use cannot support this. If the player stands beside the staircase and jumps to get on it, they will land inside the block. Ignoring the slope until they land.Let me demonstrate this with an example:Let's say that our staircase is from 0 to 30 on all dimensions. Let's also say that it has enough slope to make each step move the player by 1 unit both vertically and horizontally.Now, the player is at (31, 0, 0). They jump and tap the left arrow key. In my system, depending on the speed at which they hammer the button, they will land inside the block rather than on the first step. For example, if their Z is 4 by the time they tap the arrow, they will land on my staircase at (30, 0, 4), which is incorrect (there is no step at 30 0 4). What should happen is the player landing on the first step of the staircase, which is (30, 0, 0).I could get around this by having an individual tile mimic the elevation of the staircase, but that seems too wasteful in terms of resources.Obviously I'm missing something here. The question is what?I know that a similar question has been asked on here a bit earlier, but I wasn't really satisfied with the answers it received. Someone mentioned trying out Panda3d for 3d Objects, but the documentation I found on the library was less than helpful. To put it in perspective, the sound example took some heavy modifications on my side and even then it worked half the time.I don't mind reading... I just need to know what exactly am I looking for here.

URL: https://forum.audiogames.net/post/520631/#p520631




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector