Commit Graph

44 Commits

Author SHA1 Message Date
Barry Kane f411333203 Refactored SilverMUD to use the queue type for command events.
- Removed the old commandQueue type.
- Removed the functions relating to creating, pushing, popping, and peeking the commandQueues.
- Refactored the gameLogicHandler to use a queue type.
2023-02-13 17:23:30 +00:00
Barry Kane 602f177a8f Added some more comments.
- Commented the data structures in areadata.h and gamelogic.h.
2023-02-12 23:32:39 +00:00
Barry Kane d0e4a8f9fc Removed the body of the try command.
- Removed the try command's test functionality to allow for the later implementation of the actual functionality.
2023-02-12 23:13:10 +00:00
Barry Kane 66e0279e78 Commented the data structures in queue.h.
- Commented all the data structures in queue, to make it slightly clearer as to their usage and what they store.
2023-02-11 00:07:30 +00:00
Barry Kane feb1743425 Added naming rule 2 2023-02-10 23:33:36 +00:00
Barry Kane 52fd7ef6fb Wrote more documentation and a rule for the style guide.
Documented basic usage of the client's launch options to join a server and added the no one letter variable names rule.
2023-02-09 21:53:23 +00:00
Barry Kane a38cbb70a8 Fixed Thomas's Bug.
In short:
- When a large amount of input was recieved, the server would hang.
- The server would hang on queue->lock for the input queue, in pushQueue().
- Upon debugging, it was revealed that queue->lock was actually false at this time.
- GCC had optimized out the actual loop, leaving it to get stuck even though the variable had changed.
- Adding the volatile keyword to the lock fixed this issue.
2023-02-08 17:15:23 +00:00
Barry Kane c2c77d6343 Cleaned and styled SilverMUDClient.c
- Brought SilverMUDClient.c to a consistent style.
- Cleaned and neatened various parts of SilverMUDClient.c.
- Minor cleanup of playerdata.h.
- Began writing the SilverMUD Style Guide.
- Removed outputQueue-test.c, because outputQueue no longer exists.
2022-12-21 20:31:32 +00:00
Barry Kane 6a653c75b9 Implemented proper thread sleeping and additional output thread
- Replaced previous inefficient "spin-waiting" with proper thread sleeping.
- Added threading primitives to the queue type to enable this.
- Added additional thread for output management.
- Miscellanous cleanup and restructuring.
2022-12-21 00:49:26 +00:00
Barry Kane 15d82f59ee Refactored the outputQueue to use the new queue type
- Patched a bug where I didn't set the correct type for queue nodes.
- Removed all traces of the previous outputMessageQueue type.
- Removed the pointer "next" in outputMessage.
- Rewrote the the main thread and game logic thread to use a queue for output.
- Refactored outputMessage to allow for a variable amount of playerInfo pointers.
2022-12-20 15:55:24 +00:00
Barry Kane 9b3df5928b Refactored the input queue to use the new queue type
- Removed all traces of the previous inputMessageQueue type.
- Removed the pointer "next" in inputMessage.
- Rewrote the the main thread and game logic thread to use a queue for input.
2022-12-19 23:44:16 +00:00
Barry Kane 8ae3eaf2b8 Added queue.c and queue.h.
- Added a singular queue type for input/output messages and commands.
- Added a test of the queue type in tests.
- Made some edits to the Makefile to enable the addition of debug code using the preprocessor.
- Minor styling and spelling updates in gamelogic.c/h and text effects .h.
- Ready to integrate the new queue type in place of the previous ones.
2022-12-18 21:07:10 +00:00
Barry Kane 2ab873b40b Make the client respect the set character delay.
- The client now respects the character delay set on the command line.
2022-11-30 15:31:14 +00:00
Barry Kane 4cc0d3a0f6 Completed the conversion to the new linked-list type.
- Moved all code relating to skills to use the new linked-lists.
- Removed all old code relating to other lists.
- Improved linked lists to get nodes more efficiently in the second half of the list.
2022-11-29 21:13:03 +00:00
Barry Kane 51f1a953e7 Refactored areas to use linked-lists.
- Refactored the server to rely on the linked-list version of area lists.
- Removed all old code pertaining to Area/Path lists.
- Removed a no-longer useful test for corestat-from string performance.y
2022-11-18 14:44:25 +00:00
Barry Kane 6b3d9febf6 Linked lists now destroy the pathList of an area.
- Modified destroyList to destroy pathLists in areas.
2022-11-13 18:26:36 +00:00
Barry Kane d843f0b170 Added one-way path function.
- Added a function to create one way paths.
- Changed the test areas to a new setting and to include one-way paths.
2022-11-13 18:21:06 +00:00
Barry Kane 582a0d02ae Refactored paths to use linked lists.
- Removed the code for the now-obsolete-before-actually-being-used pathLists.
- playerAreas now contain a list called pathList.
- Refactored createArea, createPath, and the /move and /look commands.
- Added typedefs to prevent the compiler being unable to link.
2022-11-13 00:23:42 +00:00
Barry Kane f3ad758e4f Preliminary implementation of linked-list.c
- Implemented first pass of linked-list.c.

TODO:
- Polish linked-list.c 'till you can see a reflection in it.
- Refactor existing codebase to use linked-list.c.y
2022-11-11 22:58:05 +00:00
Barry Kane c68e66e7bc Squashed current warnings.
- Fixed all current warnings.
- Added the ability to set the text delay as a command line option in the server.
2022-10-31 01:55:44 +00:00
Barry Kane ca8ba5e410 Incremented version numbering in preperation for merge to master.
- Incremented version numbering to Alpha 0.4.
2022-10-30 13:00:18 +00:00
Barry Kane d9497679cb Implemented Skill Checks.
- Implemented skillCheck.
- Allowed for the in-game testing of skillCheck via /try.
- Slightly reorganized the Makefile.
- Tweaked the logoString to display correctly.
- Edited the client and server to generate gprof data when in debug builds.
2022-10-30 12:58:39 +00:00
Barry Kane f2dd83857f Completed Reorganization of Area Data
- Moved the appropriate data structures and functions into areaData.
- Made movePlayerToArea a gameplay primitive.
2022-10-23 17:07:13 +01:00
Barry Kane 52b4b1e2f0 Warning fixes and Makefile edits
- Adjusted the Makefile to create gprof data in the server (currently inactive as the server never terminates.)
- Fixed warnings in areadata.c and gamelogic.c.
- Added bruteforcePrint for completeness.
2022-10-18 21:00:57 +01:00
Barry Kane 60110d3abd Made client exit gracefully upon server exit:
- The client now checks the return value of messageReceive.
- Renamed lists.c/.h to areadata.c/.h.
2022-10-16 21:28:32 +01:00
Barry Kane b8189ae2de Began implementation of skills and stats.
- Added text wrapping in client.
- Implemented functions for managing skill data.
- Rewrote some existing functionality to allow for variable length game messages over multiple userMessages.
- Reorganized the code yet again.
- Introduced enums for coreStats and outcomes.
- Implemented core stat checks.
- Added more example skills.
- Rewrote test areas to have longer descriptions.
2022-10-16 16:13:33 +01:00
Barry Kane 8673bb1ad5 Reorganized file structure.
- Reimplemented /LOOK.
- Commands are now accepted in both upper and lower case.
- Move now accepts a number for easier movement.
2022-05-20 22:28:07 +01:00
Barry Kane 151f3002b8 Began implementing game logic and re-implementing commands
- Reimplemented /MOVE and /EXIT
- The server is now multi-threaded
- Input and output is now queued
2022-05-05 19:45:27 +01:00
Barry 0b3a72beff Removed inputhandling library
The functionality was moved to inputoutput.
2022-04-07 01:39:59 +01:00
Barry 4ddb80b8b2 Basic message queuing implemented
- Messages are now queued on reception by the server.
- Message queue datastructures are now added.
2022-04-07 01:38:36 +01:00
Barry e4b8693037 Cleaned up client.
- Cleaned up the client codebase.
- Throughly commented SilverMUDClient.c.
- Added a boolean for bolding slowPrintNcurses.
- Added a user-configurable delay for text printing.
- Other small improvements.
2022-03-15 14:52:49 +00:00
Barry 5d772df469 Added initial GnuTLS encryption.
- Added inputoutput.c
- Added inputoutput.h
- inputoutput contains wrapper and helper functions for transmitting messages over GnuTLS.
- Moved the userMessage struct definition to inputoutput.
- Reworked client and server to use GnuTLS.
- Removed all commands from server in preperation for upcoming command and message queues.
- Names and areas are no longer considered for messaging.
- Changed Makefile to link GnuTLS.
2022-03-06 00:36:42 +00:00
Barry 235ff8e74f Added basic logging support and command-line options to the client.
- Added basic logging support to the client.
- Added basic command-line options to the client:
  -g: Enables a game-log, must have a file-path.
  -c: Enables a chat-log, must have a file-path.
  -i: Sets the IP address to connect to.
- Removed the C-c handler, appeared to be broken anyways. Consider
  reimplementation at some point.
- Added /EXIT command to allow for leaving the game.
- The client now exits gracefully if the server dies.
2021-12-26 19:07:30 +00:00
Barry 6c93805d6f Added initial implementation of doubly-linked lists
- Added lists.c
- Added lists.h
- Changed initialisation of rooms to add a third room and to add the rooms to a
  list.
- Added datastructures for area and path nodes for doubly-linked lists.
2021-12-05 23:33:53 +00:00
Barry 241ac7a92b Added area and path creation functions
- Added missing header guards.
- Increased the size of message contents to 2048.
- Added area and path initialization functions.
- movePlayerToArea no longer segfaults.
- /LOOK added to allow players to find exits.
- Amount of paths allowed out of an area has been decreased to 16.
- Debug builds are now available from the Makefile.
- Removed unused variables.
- Input sanatization has been moved to the server-side, phew.
- Server messages are now displayed differently to player messages.
- New area initialization has been added until I can integrate Guile.
- Server's sendBuffer has been renamed messageBuffer.
- Areas now have descriptions.
- Descriptions are sent to the player upon joining an area and /LOOK-ing.
2021-11-04 23:14:47 +00:00
Barry 85a31a2933 Added basic area system
- Added playerdata.c
- Added basic move command
- Added a basic initialisation of two connected rooms
- Added datastructures for areas and paths
2021-10-21 21:58:55 +01:00
Barry Kane ae8373d4ce Incremented Version Number.
- Incremented version number in preperation for merge.
2021-09-15 00:28:57 +01:00
Barry Kane 18a4f416f6 Added basic name system
- Added basic name system.
- Added playerdata.h.
- Added basic /NAME command. TODO: Create proper command system.
- Added datastructures for user messages and user names.
2021-09-15 00:07:13 +01:00
Barry Kane 9411803942 Increment version message for merge.
Incremented the version number by 0.1 for the server.
Added version splash to the client.
2021-09-10 15:07:42 +01:00
Barry Kane 7047d0ee08 Added two-window messaging to the client.
Client now has two seperate Ncurses windows for sending and receiving.
Added SIGINT handler which sets a global boolean to gracefully exit and free memory.
Sending and Receiving are now on their own threads.
A pointer-to-struct is now passed to the threads.
The main thread will now wait to cancel the threads upon receiving SIGINT.
slowPrintNcurses now takes a window argument.
The server now doesn't check that a client receives the message that they sent, allowing for full chat history.
2021-09-10 15:03:02 +01:00
Barry Kane 33bc9bcda0 Adapted client to use Ncurses instead of raw terminal output:
Created "slowPrintNcurses", which is a version of "slowPrint" compatible with Ncurses screens.
Ncurses is now used in place of raw-terminal output.
The screen clears after inital start-up messages.
C-d no longer exits, and still doesn't spam.
Added Ncurses to the ld options of client in the Makefile.
Created ld options for server in the Makefile.
2021-09-03 18:47:11 +01:00
Barry Kane 849a80bd37 Basic input sanatization:
Created new library to deal with user input.
Implemented check in client to prevent C-d spamming the server.
C-d now exits.
Implemented check in client to prevent clients sending messages containing only newlines
to the server.
2021-08-19 23:07:58 +01:00
Barry Kane 2c093903a4 Git Sanity Check 2021-08-17 18:57:56 +01:00
Barry Kane 618b2144e3 Initial release of SilverMUD:
Features Added:
- Server capable of receiving and sending messages to up to 64 clients.
- Client capable of sending and receiving messages from the server, multi-threaded.
- Text effect library with one effect.

Features Changed:
- None, initial release.

Features Removed:
- None, initial release.
2021-08-15 19:42:37 +01:00