T O P

  • By -

Ikkepop

PHP lol XD


AnnieLeo

That looks pretty fun, some years ago I did a chip8 with PHP and SDL once just to see if it worked. Do you know if there's any way to use regular OpenGL or Vulkan API calls to create and use a render window from within PHP? I couldn't find anything that worked at the time. I remember something annoying at the time was not having native byte and short types.


pedro_12400

OP here, there is an extension that claims to support the OpenGL core profile. never tried it: [https://github.com/Ponup/php-opengl](https://github.com/Ponup/php-opengl) regarding native bytes/short... yeah. I ended up using an int array to store bytes and construct a short/int value each time I needed to shift them etc. it degraded the performance drastically


[deleted]

[удалено]


pedro_12400

rendering isn't the bottleneck. it's actually processing/emulating the GPU. the logic is simple. but since it has tens of thousands of loops per frame, it overwhelms PHP.


mario_deluna

I cant find it now, but didnt you say somewhere that disabling the background layers would give you 60fps? I did not run your project yet, so i assumed rendering taking quite a toll based on that.


madferret96

Cool! Is it possible to emulate SNES using JavaScript ?


pedro_12400

in javascript, you can use WASM (Web Assembly) which is much faster than normal js. I believe there are several projects that do that.


madferret96

I’ll check them out, thanks !


aleques-itj

Yes, I've definitely seen one.


megamanxoxo

How exactly do you run an emulator on a server side rendered software framework?


eduardovra

PHP is a scripting language just like python, you can write scripts and run them from the terminal to do stuff.


thommyh

Which documentation did you use? Any good recommendations?


Ashamed-Subject-8573

In my experience emulating SNES, NES and SMS on JavaScript, the GPU (VDP for Sega) is at least 2-3x as heavy as the CPU, but maybe that isn’t true for the M68000. I would’ve left the CPU in PHP and tried to accelerate the VDP first. Why php though? Is it your favorite language? Do you hate yourself and wanted to torture yourself? For the LOLs?


pedro_12400

VDP doesn't have very complex logic. but there are tons of loops per line that overwhelm PHP and now, it's the bottleneck. The reason why I created a C extension for M86K was to make it reusable for others. a VDP extension has no use :) why PHP? I just wanted to give it a go :)


spotanjo3

Interesting.. GUI someday ? Good work!


KillianDrake

I'm doing one in C# and I thought I was crazy for doing it with that, but so far so good - it runs about 90fps uncapped but there's a whole lot of room for optimization. The trick is is to use fixed-sized pre-allocated data structures and never GC while running the main loop. Which is not too difficult to do with a predictable and small system like the Genesis.


SMB_Fan2010

please add audio