How can I save a long variable as PlayerPrefs - long-integer

Im making an idle clicker game and im using long instead of int to store large numbers. I have looked for a solution but i havent found anything that works for me

Related

Struggling with 2d platforms physics

Im making a game in Rust(Im a beginner) for my son and am somehow struggling with platforms - specifically modifying their length. I can get the platforms if i use certain numbers but if i try to modify the platform width I run into problems.
If i use the const PLATFORM_WIDTH=400 then everything works fine (i seemingly can make any number of them and it all works), but I don't want to have platforms of a fixed width (length), I want each platform to be of variable width. If I try to make the platform width say 100.0 then it is rendered correctly but I can walk over empty space as if there was a platform there. If I make them greater than 400 they are rendered but the sprite will fall through solid floor at some points.
Really don't know where Im going wrong and this annoying issue is preventing me from making progress on my game.
Id really appreciate if someone could take a look at my code and tell me where im going wrong.
My code is here:
https://github.com/country-bumpkin-software/rusty-miner/blob/main/src/main.rs
Also can someone explain to me why the Rect function seems to take negative numbers for the x, y coords?
The problem is that you sometimes use the width from the platform struct (e.g. when checking for intersections on line 264) and sometimes use the PLATFORM_WIDTH and PLATFORM_WIDTH_HALF constants (e.g. when drawing the platform on line 346).

How to display image directly from variable?

Is it possible to display an image directly from variable? I made a program that receives data from sql server and generates tables in excel. However sql could also have binary values for images and so on... which I would like to display in excel cells. But loadpicture, addpicture don't support this... I would like to avoid saving them into temporary files or avoid using external programs and display directly from memory while afterwards keeping the images in excel. Is this possible?
Ok tricky :)
Shape images can comes from file or from the web. So how about to implement a tiny webserver via vba which serves those images. VBA Webserver for Excel or
homebrewed web server vba
(If you get websocks running ) BTW: to implement a webserver is rather trivial. In your case he just has to deliver the images - which is done by a base64 encoded string with a few header lines. Another way is to modify some VB.Net Webserver to a COM DLL. Also not THAT complicated simple VB.NET Webserver <<< Might be a good idea if you are on 64 bit. Anyhow if you got the Webserver thing up you can now showel your database datas into the webserver and let he deliver them to a shape by a URL. To be honest that all is pure overkill. I use a software ram disc for such purposes. For example Softperfect Ram disc. So there is no real file written cause it uses a small amount of memory for the virtual disc. Its damn fast cause the computer ram is used and after reboot everything is gone if you whish. Sure you might parse the database data by VBA and write the pixels little by little to the shape. Some guys have made a full image processor in vb6 which is nearly vba Photo Daemon So you can see how easy to decompose and compose images. I just hope that something might be usable for you. This is not really a "answer" but might give you some ideas. The pure VBA Webserver is nice if you get the winsocks running. Ive fooled around a bit with this as we was still on 32 bit - was funny :)
This was tried three years ago and did not work directly from a variable. (see Inserting an Image into a sheet using Base64 in VBA?)
Giving up the "don't save to temporary file" idea and the whole thing is easy. (see How to embed a GIF image into an Excel file). Why not save it to a file? e.g. in a ram disk?
;-)

Reading and understanding a raw audio file(specifically MP3)

I am trying to understand what the raw data from an audio file looks like and how to get that data. I want to take the data and analyze it and see if I am able to make a program that can recognize patterns in a song such as in a hip hop song, finding the same beat in a chorus. In my head I think this could be a doable task if the data is in an integer form.
I've looked up many tutorials for this but all the tutorials use other libraries or don't explain it in a way I understand(more than likely the source of my issue).
I am wondering if there is someone out there that can help me understand a few things.
1). In an MP3 file, what is actually being stored in the file. Is it an integer that tells the radio/amp/audioPlayer a frequency, another integer for amplitude, etc...(over simplified because I don't know what other data is stored in an audio file).
2). If it is stored in an integer format, is there a way to read the integers and analyze it. If it is not stored in an integer format, how is it stored, and is there a way to convert it to an integer format?
3). In visual representations of an audio files like this one, it seems more clear what is what. It seems like the frequency is where on the circle the audio is represented, and the amplitude is how high it jumps. Is this right? Or does it just appear that way and I am understanding it incorrectly.
4). Is this task harder than I think it is? Considering I haven't found any good explanations or tutorials on how to do so, I am skeptical on how easy this would be.
(Sorry if this was poorly phrased, first question on stack and I am just illiterate :^)

Love2d draw from table

Is there an efficient way in Love2d to print a big (like, 800 x 600) table of color values on the screen? I've tried things like creating lots of rectangles (which is horribly slow) or creating an imageData and drawing that (which would be fine if the table-values didn't change at every frame, but they do). Thanks!
If you can compute the values without (much) extra data, you could try writing a shader and letting that compute stuff as things are being drawn.
If that doesn't work, using an ImageData can usually be made a lot faster than it is by default. First, you should ensure that you're not calling g = love.graphics.newImage( image_data ) per frame but create it once and then only call g:refresh( ).
The next thing is that :mapPixel is really slow because it's constantly calling from C into Lua (once per pixel) and that's quite a bit of overhead. It's faster to rewrite that in Lua or just use a plain loop with :setPixel (and maybe :getPixel).
If that's still too slow, the last problem is the following: LuaJIT cannot JIT-compile calls to C functions provided via the normal Lua API. But these can be replaced if you describe the data structure via the ffi and then let LuaJIT do the accesses directly. Slime has done this for love-0.9 (code on github). Just require that file and it will replace the slow functions, and everything should be a lot faster. I'm not 100% sure but I think I already used this with the current version (0.10) and it still works. (If the internal format of the ImageData ever changes, it will break, but it should be relatively easy to fix – and it's likely that someone else will update the code and post it somewhere.)

HTML5 web audio getting stuck (buffering issue?)

I am working on a (weekly radio show) audio website and I keep getting the same problem, the audio files that are up to 1hr long keep getting stuck.
I have tested several different players, both the flash player Wimpy Player, and HTML5 players such as Audio5js, jPlayer, and pickle player.
AND I have tested to sample the sound in different bit rates, 8,24,64,128 but the sound files keeps getting stuck. Not always, but often enough to be a serious problem.
The file starts playing but a bit in (all from a few seconds to almost at the end of the 1 hr show) it just stops and the only way to keep playing it is to reload the file. To me it seems like a buffering problem.
I don't understand why.
If anyone has ever had a similar problem, please tell me what I am missing.
I got the answer myself to this one.
After double-, triple-, quadruple-checking everything it hit me, the site was hosted by GoDaddy and I know that it is not the best quality you can expect from them. (Actually they are really bad in more than one way. Never go with GoDaddy if you can avoid it. Just my personal opinion.)
We changed the hosting and the problem was gone.
To bad it had cost me days of work for nothing.

Resources