Commit Graph

5 Commits (netcode)

Author SHA1 Message Date
kts 7bc43929e0 Added much code for the foundation of the netcode. Server automatically starts on port 31337 and runs as a separate thread in the SDL client. This TCP server functions as a basic echo server and can be connected to thru telnet or by typing 'connect 127.0.0.1 31337' in timesynk's console. Once connected, the echo functionality can be tested by using console command 'send my message goes here'. Somewhat buggy and crashses on occasion - suspected cause is consoleLog()ing a string that is not properly nul terminated, resulting in reading memory out of bounds. Curses client does not run the server properly at the moment, probably due to using select on server, clients, and stdin when combined with ncurses - will look into this later. 2013-11-06 23:40:19 -08:00
kts 8fc710f3a2 Successfully recoded both SDL and curses client to use a model that ticks the world according to a Tick Event/Signal. How this works in SDL is a simple SDL Timer that pushes an SDL_USEREVENT with a code of EVENT_TICK at some interval in ms. The curses client works by calling setitimer with tickSignal as a callback, triggering whenever a SIGALRM signal is given. This was chosen for maximum cross-compatability for POSIX platforms, even though Linux has excellent timer fd support. Both the SDL and curses interfaces can have their tickrate modified by calling tickrate some_number_in_ms from the console. 0 stops the timer. For all of this to work, main() no longer has the while loop contained in it, but rather calls interfaceLoop() and lets the interface handle it (as this is extremely platform/api specific - some platforms have user input strongly tied into the drawing window (SDL), so we cannot use a monolithic select()-style while loop for all). Much more to be cleaned up, but this sets the foundation for network code. 2013-11-04 02:32:07 -08:00
kts 29cdd11ec8 Added basic NPC/monster functionality as well as a console system. Simply call ConsoleLog(&string) and it'll create a new ConsoleEntry, set the console_last_entry's next to it, set the new entry's prev to console_last_entry, and finally set console_last_entry to point to the new entry (functions very similarly to Tile Chains). This may later be changed to an array form so as to easily pull sections of the log from anywhere. 2013-10-19 22:56:46 -07:00
kts 6e414d9223 Who knows what has been added! As far as I recall, *context(s) were tweaked, added compiled-in graphics for the SDL client, and probably some other stuff. 2013-10-14 19:21:33 -07:00
kts 0c5dc4c822 Initial commit, contains a barebones structure with the interface for both (x)curses and SDL. Can be built via the Makefile or via the XCode project in the xcode/ subdirectory 2013-09-17 22:37:36 -07:00