A problem in bgt which I can not understand

2017-01-18 Thread AudioGames . net Forum — Developers room : Rastislav Kiss via Audiogames-reflector


  


A problem in bgt which I can not understand

Hello,normally I searching on Google before asking question somewhere, hovever in this case I haven't any idea what to do or search. My problem is following:I am developing minecraft for the blinds as I noticed few times before. For begin, I selected surface of size 200*200*200 blocks, what gives 800 blocks. That is okay, game is relative fast, working without lags etc. Problem shows when loading map. for first versions of project, I choosed simple notation like this:me.x;me.y;me.z;block.x;block.y;block.z;block.id;block.x;bnlock.y;block.z;block.id etc.Yeah, it can be reduced by using for example ascii characters to reduce size, but that is not important now, problem is in time which program needs to load map.For first, I choosed method of loading all blocks to the string, and split them with string_split. Hovever this wasn't so effective, result array has 800 instead of 1600 places. I don't know why, but as I am thinking abo
 ut it, is possible that there were some programming mistakes, but that isn't important, after it I choosed my own method to read string with map character by character, find separators and enter values to the three dimensional array, which is used as a main world matrix.Code was simple, like read_until function from file object, there was one pointer and something like:string string_read_until(string input, int pointer) {string result="";while (input[pointer]!=";") {result+=input[pointer];pointer++;}}This is not of course original code, it has seeable out of bounds bug when implementing, but original has prevention, this is only example how code looks. It works, only small mistake was there. Loading duration was about 50 minutes, loading space 200*200*10.I didn't know what to do. After some time, I got an idea. I overwrited my function with read_until from file object, and whole system remaked
  to read directly from file. I was really surprised when after this change map loaded in time about 10-20 seconds.And that is what I don't understand, why reading from my ssd hardrive (not tested on hdd) is faster than reading from memori? Ram should to be faster if I know right, so why this is happening? I am asking also because now I am working on server, and clients take again about 50 minutes to load sended map, that's really long,I need to make it faster but don't know how to do it, only solution seems to save received map to the file and use standard loading method, but this is not explayning problem itself, also more disk usage is needed.Thank you for help, I want to record small introduction for our Slovak and Czech blind community, so we need multiplayer mode as soon as possible.GreetingsRastislav

URL: https://forum.audiogames.net/viewtopic.php?pid=294052#p294052





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

Re: A problem in bgt which I can not understand

2017-03-06 Thread AudioGames . net Forum — Developers room : Rastislav Kiss via Audiogames-reflector


  


Re: A problem in bgt which I can not understand

Hello all,so I returned to the coding after small pause and begun with this project. I decided to not make directly dll and its joining when I don't know what will be the result, but I decided to take basic surface from bc (blindcraft, I know that there is similar project called with the same name hovever it is in unknown phase and I created title by myself for my product, so I will call it blindcraft while there is no concrete product from someone other) and coded it in c++. It was interesting work, I am not very experienced in this language so I started with making bgt_kit for c++, for this time only basic needed classes like file. After it I made few comparisons that will possibly not surprise pro developer, but I was really amazed:First - declaration of three dimensional array 200*200*200, bgt 4 seconds, c++ 1 second. Not very important, difference can be produced by bgt's resizing cycles which c++ do not need.- assigning array with values (part i
 ntegers), in this case array hat int type. Result: bgt 1 second, c++ 1 second.- assigning array with values (part blocks), now array hat block value, block is class with two variables, int id and string zone. Result: bgt 4 secs, c++ between 1 and 2 secs. It is interesting, looks like c++ have faster organization in its classes, but it is still not very important, few seconds is survivable thing if did only one time.- loading map from file, this is most interesting and most important part of this comparison, I will repeat what is program doing while loading from file:1. Load file to string variable.2. set pointer variable to 0 and call read_until function which will use the pointer variable to return text until given symbol. (note: by pointer is meaned int variable, not pointer as a type).3. this read_until function is called four times in one loop to separate x, y and z position of each block + its id, loop is called until function returns blank string
 , that means end of the file, so end of map too. In this step all returns are converted to int and assigned to the world array.And that is all, both languages hat the same or very similar functions and result? Bgt - estimated 55 minutes, c++ - 3 seconds!!!Someone can find my surprise very stupid, probably it is, I knew that bgt is slower than other languages because of byte code, but I did not know that difference can be counted in hours, days or veeks if there are larger maps. I will only add that loaded data was not size 200*200*200, air is not saved with the map and this was default layout (flat world) used for testing with volume 200*200*10. So imagine that this two languages are loading full map, possible later when I add things like mountains, mines etc., time 20 it is 20 hours for bgt, 1 min for c++.Testing was not made with something like timers or stopwatchs, I listened only for my clocks on wall, but ration between values is correct. Anyway small numbe
 rs are not important, I wrote about the main difference and there is no problem with measuring. Now I decided to remake bc in c++, It will be funny because I have no basics like audiolibraryes or some functions usable in audiogames, I must bring them from bgt, for audio I successfully compiled bass library used for example also in Eurofly, so I will look what I can do in c++, how similar can I do It to soundpool, if I have success, I will probably make it public for next beginning c++ ag developers.Thanks for reading, hope it wasn't too boring. GreetingsRastislav

URL: http://forum.audiogames.net/viewtopic.php?pid=300795#p300795





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