0xE111 / cat-400

Game framework for nim programming language. Modular and extensible
Mozilla Public License 2.0
88 stars 5 forks source link

Compiling 2d template / example #24

Closed jasonpeinko closed 4 years ago

jasonpeinko commented 4 years ago

Really cool project, I love the design you are going with. Also I know the tutorials aren't done but nice work with them so far!

I feel like I'm missing something completely obvious when it comes to compiling as the enet wrapper is complaining about csize_t on both linux and windows.

/home/jason/.nimble/pkgs/c4-#head/c4/lib/enet/enet.nim(32, 20) Error: undeclared identifier: 'csize_t'

Are the included examples and 2d template are in a working state?

My list of steps:

  1. nimble install https://github.com/c0ntribut0r/cat-400@#head
  2. git clone https://github.com/c0ntribut0r/cat-400.git
  3. cd cat-400/c4/examples/ping-pong
  4. nim c -r project

nim -v

Nim Compiler Version 1.0.6 [Linux: amd64]
Compiled at 2020-01-23
Copyright (c) 2006-2019 by Andreas Rumpf

git hash: 89b39ee8fe271d0e1b75c15a4c6cf82eb9c13aea
active boot switches: -d:release
0xE111 commented 4 years ago

Thanks for your feedback!

Yeah it takes a lot of time to write tutorials, even more than writing code itself. Please report if you have some questions/misunderstanding after reading existing tuts, let's make them better :) Same with code, I have plans to test and write instructions how to run the entire thing on major platforms but currently there are none :(

There are 2 demo things working: ping-pong game and 2d template. To run ping-pong demo:

cd c4/examples/ping-pong/
nim c --threads:on --multimethods:on -r project -l=debug

space starts the game; use left-right arrows to move.

Regarding the error you mentioned: csize_t was introduced recently, and Cat 400 works only on bleeding edge nim. Please install latest dev branch.

jasonpeinko commented 4 years ago

Thanks for the info, it's impressive you've put it so much effort to the tutorials already. I used to write flash game tutorials back in the day so I'll see if I can find some time to help out. I've been checking out Amethyst https://book.amethyst.rs/stable/intro.html on the rust side and they have some decent docs, I just can't bring myself to enjoy the syntax of rust :rofl:.

I was able to make some progress and run the ping-pong example. The 2D template runs as well however the SDL2 window fails to initialize (I have a hunch it's due to something on my end). This was on a laptop running Arch with nVidia. On the same laptop in Windows the enet wrapper will fail to compile due to a recursive type declaration with the socket (guessing it doesn't like the mix of Socket and SOCKET? Currently trying to get nim devel to build on my arch desktop to see if the issue was just my configuration.

If I may ask, what is your motivation behind this project (hobby/commercial)?

jasonpeinko commented 4 years ago

Just a small update, I was able to get the 2D template working on the desktop. I'll do some more digging but i'm assuming nvidia is the issue on my laptop.

Looking forward to seeing if I can get bgfx and imgui running.

0xE111 commented 4 years ago

Rust is a language I completely dislike, but unfortunately nim has nothing as cool as "Are we game yet?". So if you want do gamedev on modern languages, you should either spend months learning rust or spend months waiting for game stuff to appear in nim :(

I have Archlinux laptop with Nvidia card as well, and thanks to nvidia-xrun I can test with both nvidia on/off. Currently I also have an error when running ping-pong demo, and the error is inconsistent - sometimes it happens, sometimes not:

  X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  3 (X_GetWindowAttributes)
  Resource id in failed request:  0x4a0000e
  Serial number of failed request:  222
  Current serial number in output stream:  224

I get this even without nvidia. Is it the same you got? I haven't found a reason yet.

Also, please post the sockets-related error from Windows, it needs to be fixed.

I plan to create a game, and I chose nim as main development language for it. Since nim lacks "serious" and well-documented game framework/engine, I have to create it myself. So this project is an open-sourced core of my game. And of course it's hobby bc words "money" and "indie gamedev" don't fit very well :)

I had some bgfx bindings and even a bgfx system but I dropped their support long time ago. Maybe you'll find them useful.

Imgui looks interesting, looks like there's a package for it.

jasonpeinko commented 4 years ago

Created #27 for the windows enet binding issue.

Sounds like we have a near identical arch setup (i'm using xrun too). I haven't tried with Intel. My desktops all run amd which have been great on linux. My errors looked just like yours and as you said it seemed to change every time. I was thinking it could be an issue with the window manager, though for me i3 with amd works and i3 with nvidia does not.

0xE111 commented 4 years ago

I think i accidentally fixed this issue when fixing another one. Pls update and lmk if latest version works for you.

jasonpeinko commented 4 years ago

Yep, that did fix it. I had to remove {.base.} from video.nim's init method. Otherwise the compiler would complain that the method is not a base.