Simple library for HTTP-based networking, made for Naev game.
Adds SDL_net as dependecy.
Configuration is at beginning of net.c file.
File main.c contains basic example.
- You send commands to HTTP server, where script (currently in PHP) will process them
- You get Lua code as response
- You run said code inside Naev Lua interpreter
- Postal service
- Guilds
- Guild vaults
- Online features in general
- etc.
- It's slow (protocol/hosting-wise), so no real-time
- It's HTTP not HTTPS - maybe not an issue
- ASCII only for now ? - pressumed, not checked
Currently there is simplified forth system interpreter on server side.
How to forth (tldr) :
- you send
1 2 add prt
, server reads it word by word 1
is number - put it on stack2
is also number - on stack it goesadd
is function - call it- it will take two items from top of stack (first
2
, then1
) - adds them
- puts result (
3
) on top of stack
- it will take two items from top of stack (first
prt
is also function call it- it will print first thing from top of stack (
3
in this case)
- it will print first thing from top of stack (
Also see : Todo 2
- add - adds two numbers
- sub - substarcts two numbers
- mul - multiply two numbers
- div - divide two numbers
- mod - modulo of two numbers
- prt - print item on top of stack to output
- motd - prints Message Of The Day
- autoreg - generates access key and make file for it
- getkey - generate random key of given length
Some ideas on how to progress.
Automatic pilot registration. Gets access token to user.
- Game starts (or is loaded)
- Check if save contains access key
- If not, send 'autoreg prt' command to server
- Save returned key and use it from now on
Is interpreter a good way to go?
It is small and offers flexibility.
But I may just overthought it.