Compile C/C++ raylib game Into WebAssembly

Поділитися
Вставка
  • Опубліковано 28 сер 2024

КОМЕНТАРІ • 51

  • @programmingwithnick
    @programmingwithnick  Рік тому +8

    If you are having trouble with make add this to yout PATH enviroment variable: C:
    aylib\w64devkit\bin to PATH
    PS: I'm creating an OOP course! Sign up at programmingwithnick.com/course for early access and a 50% launch discount.

  • @raylibtech
    @raylibtech Рік тому +65

    Very nice tutorial! Thank you very much! 👍😄

  • @R2Sam
    @R2Sam Рік тому +3

    Never knew I needed this, great tutorial

  • @TahirPalali
    @TahirPalali Рік тому +2

    Another great tutorial. Thank you!

  • @kubiz198
    @kubiz198 5 місяців тому

    The tutorial was very easy to follow, thank you!

  • @bethleemCode
    @bethleemCode Рік тому +2

    That´s a great tutorial! Thx a lot!
    Now we need a raylib to android video just like this! 😀

  • @perelmanych
    @perelmanych Рік тому

    Thank you very much for this great video! My game uses several libraries, so it looks like it will be that quest))

  • @bradmartin333
    @bradmartin333 Рік тому +2

    Thank you for making this! Great tutorial. Only snag for me was that I needed to add C:
    aylib\w64devkit\bin to PATH.

    • @programmingwithnick
      @programmingwithnick  Рік тому +1

      Thanks for sharing! Good to know.

    • @bradmartin333
      @bradmartin333 Рік тому +2

      If anyone ends up running into loading resources, append this to the build command:
      `--preload-file {resource dir respective to cwd}@{resource dir as written in raylib program}`
      example: `--preload-file src/resources/@resources/`
      can also specify specific files instead of a directory

    • @TheIllusivePanda
      @TheIllusivePanda 4 місяці тому

      @@bradmartin333 Thank you, I just spent a while trying to figure this out & this worked!

  • @akevan3556
    @akevan3556 9 місяців тому +3

    make : The term 'make' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
    spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:1
    + make -e PLATFORM=PLATFORM_WEB -B
    + ~~~~
    + CategoryInfo : ObjectNotFound: (make:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    • @user-bo6ik8pv8j
      @user-bo6ik8pv8j 8 місяців тому +1

      try mingw32-make

    • @samg5183
      @samg5183 6 місяців тому

      @@user-bo6ik8pv8j me still i have that problem...

    • @THEDuWolf
      @THEDuWolf 2 місяці тому

      @@user-bo6ik8pv8j thanks man, that works

    • @wildlifeofgreece
      @wildlifeofgreece Місяць тому

      You have to add this to yout PATH enviroment variable: C:
      aylib\w64devkit\bin

  • @luispieri640
    @luispieri640 Рік тому

    Great video and tutorial! Thanks!

  • @panos21sonic
    @panos21sonic 9 місяців тому +1

    This video troubled me quite a bit:
    When running the makefile to compile raylib, i got the error: Make:emcc: No such file or directory exists
    To resolve this, I went to where CC and AR are defined in the makefile, and replaced emcc and emar with the respective locations to the bat files

  • @Tims_Projects
    @Tims_Projects Рік тому +2

    Thankyou Nick. Another grate video. 👍
    May I ask which version of windows you have? If it is Windows 11 (I don't have), then I believe "Windows Terminal" is installed by default now.
    I have Windows 10. If you have Windows 10, then "Windows Terminal" needs to be downloaded from Windows Store (free).
    To get it to appear in the Right-Click Menu, you have to alter the registry. There are scripts which you can download to alter the registry. (after installing "Windows Terminal")
    I thought I would mention it, just in case there are others with Windows 10, that don't know why they don't see it when they right-click.
    Your video prompted me to get around to installing it myself, ha-ha.

    • @programmingwithnick
      @programmingwithnick  Рік тому +2

      Tim, I have windows 11. In windows 10 you need to hold shift+right click

    • @Tims_Projects
      @Tims_Projects Рік тому +2

      @@programmingwithnick Oh, ha-ha, I cant check that now, I have done all the above😆

  • @manuelgarciagarcia2501
    @manuelgarciagarcia2501 Рік тому

    Thank you very much for a new video. :)

  • @samdavepollard
    @samdavepollard Рік тому

    very nice
    subbed
    many thanks for sharing your knowledge

  • @abiiranathan
    @abiiranathan Рік тому

    You are a God!

  • @FriedMonkey362
    @FriedMonkey362 Місяць тому

    hello, i used your tutorial and so i use visual studio and vcpkg to include raylib (#include )
    this means the raylib source isnt really availiby and modifying the build in the vcpkg directory would mess up all of my projects
    how can i build my raylib game to web using visual studio and vcpkg?
    so i can just do smth like
    #include
    //#include
    and then in the visual studio terminal just call web-build.bat or some batch file which will call the emscipten compiler and do all that
    is there a way to achive this?
    if so i would greatly aprechiate if you were to make a tutorial on this, kind regards

  • @jasonmoon2650
    @jasonmoon2650 5 місяців тому +1

    How to solve error regarding 'make' command?
    make: command not found

    • @wildlifeofgreece
      @wildlifeofgreece Місяць тому

      You have to add this to yout PATH enviroment variable: C:
      aylib\w64devkit\bin

  • @j0of
    @j0of Рік тому +1

    i use visual studio and vcpkg to link raylib to my project. is there any way i can do this?

  • @LotsOfFunyoutubechannel
    @LotsOfFunyoutubechannel 3 місяці тому

    Hello, The game is working nicely but the game out of the two game sounds ony one of them is working, the other sound does not work. Why is it so?

  • @user-no2gt5xe7z
    @user-no2gt5xe7z 7 місяців тому

    when i did open with terminal and the install latest it did not worked and gave me errors

  • @federicosalvetti4286
    @federicosalvetti4286 6 місяців тому

    Hi Nick, this was incredibly useful. However, I am having troubles with the --preload-file command. I am including the correcth path of my resources, double checked inside the project and in the folders, but when playing the game in the localhost i get the error messages that it cannot upload the resources. Currently checking various sources, if you have any idea on the process to debug such things it would be greatly appreciated! Keep up the good work,, I'm learning so much from your videos!!

    • @federicosalvetti4286
      @federicosalvetti4286 6 місяців тому

      I did the same with another project and it fails to load that as well, I also tried to embed with the specific command from the documentation but when in localhost 8000 won't load the resources files.

    • @titan8788
      @titan8788 3 місяці тому

      im having the same problem, it says "graphics does not exist" when compiling into wasm

  • @foofoo17
    @foofoo17 10 місяців тому

    Does the audio files still work for you guys after the game becomes a web app?

  • @krzyszt0fus
    @krzyszt0fus 6 місяців тому

    This content is great!

  • @foofoo17
    @foofoo17 10 місяців тому

    Thanks Ray, how on earth did you figure this out??

  • @Kapendev
    @Kapendev Рік тому

    👍👍👍

  • @aedanwan3620
    @aedanwan3620 Місяць тому +1

    How would this work on Linux?

  • @frankstercodestuff
    @frankstercodestuff 10 місяців тому

    Is there a way to turn this into an exe or no?

  • @c.ashcraft9607
    @c.ashcraft9607 10 місяців тому

    Mine isnt Installing the python tool.

  • @ihsankurniawan3591
    @ihsankurniawan3591 11 місяців тому

    is there any docker image that does this?
    great video btw

  • @akshithabajjuri1163
    @akshithabajjuri1163 5 місяців тому

    I am getting this error when I ran the snake code
    emcc: error: '--shell-file': file not found: 'C:/raylib/raylib/src/shell.html'
    Someone please tell how can I solve this.

  • @user-xo4gn8yr5m
    @user-xo4gn8yr5m 5 місяців тому

    hi i am getting multiple erorrs at this command : ./emsdk activate latest --permanent . errors are
    Failed to read environment variable EMSDK:
    'EMSDK'
    EMSDK = C:/emsdk
    Failed to read environment variable EMSDK_NODE:
    'EMSDK_NODE'
    EMSDK_NODE = C:\emsdk
    ode\16.20.0_64bit\bin
    ode.exe
    Failed to read environment variable EMSDK_PYTHON:
    'EMSDK_PYTHON'
    EMSDK_PYTHON = C:\emsdk\python\3.9.2-nuget_64bit\python.exe
    Failed to read environment variable JAVA_HOME:
    'JAVA_HOME' any solution to these ?

    • @LotsOfFunyoutubechannel
      @LotsOfFunyoutubechannel 3 місяці тому

      I thinkt the path doesnot include the node.exe only upto \bin, same for python

  • @akimpus
    @akimpus Рік тому +1

    i get an error after entering the command:
    emcc -o snake_c.html main.c -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wunused-result -Os -I. -I D:/libs/raylib-4.5.0/src -I D:/libs/raylib-4.5.0/src/external -L. -L D:/libs/raylib-4.5.0/src -s USE_GLFW=3 -s ASYNCIFY -s TOTAL_MEMORY=67108864 -s FORCE_FILESYSTEM=1 --shell-file D:/libs/raylib-4.5.0/src/shell.html D:/libs/raylib-4.5.0/src/web/libraylib.a -DPLATFORM_WEB -s 'EXPORTED_FUNCTIONS=["_free","_malloc","_main"]'-s EXPORTED_RUNTIME_METHODS=ccall
    error is:
    emcc: error: 'EXPORTED_FUNCTIONS=[_free,_malloc,_main]'-s: No such file or directory ("'EXPORTED_FUNCTIONS=[_free,_malloc,_main]'-s" was expected to be an input file, based on the commandline arguments provided)
    How to fix it? Can someone help please?

    • @akimpus
      @akimpus Рік тому

      And so, it worked for me only with this command:
      emcc -o snake_c.html main.c -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wunused-result -Os -I. -I D:/libs/raylib-4.5.0/src -I D:/libs/raylib-4.5.0/src/external -L. -L D:/libs/raylib-4.5.0/src -s USE_GLFW=3 -s ASYNCIFY -s TOTAL_MEMORY=67108864 -s FORCE_FILESYSTEM=1 -shell-file D:/libs/raylib-4.5.0/src/shell.html D:/libs/raylib-4.5.0/src/web/libraylib.a -DPLATFORM_WEB -s EXPORTED_RUNTIME_METHODS=ccall

    • @mfalk6263
      @mfalk6263 Рік тому +4

      I had the same issue...
      Turning: 'EXPORTED_FUNCTIONS=["_free","_malloc","_main"]'
      into: EXPORTED_FUNCTIONS=["_free","_malloc","_main"]
      removing the ' on both sides made things work for me.