|
Server Help Community forums for Subgame, ASSS, and bots
|
Author |
Message |
Smong Server Help Squatter
Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Thu Nov 23, 2006 4:54 pm Post subject: multiplayer game design (discussion) |
|
|
|
|
I once played some of the Super Monkey Ball 2 party games. I thought they were quite colorful and fun, at least for the short amount of time I played them.
My aim is to recreate the "monkey fight" mini-game and use server authorative features.
Warning: technical area ahead!
I plan to write the game in two parts:
- A core that can connect to asss, handle file transfer, track players and provide chat functions. It will also provide events, graphics, sound and lvz loading.
- Game code and everything that goes with it such as graphics.
I'll probably release all the headers for the core and all the source for the game.
Questions:
- How to seperate the the core from the game code, where would you draw the line when it comes to players? Take into account players can have a lot of game specific information associated with them, but also the core must track some player info to provide chat functions.
- I'm using C, but for the player module I'm wrapping all the data in functions that read/write to parts of it. This is mainly for anti-cheat reasons. Any suggestions on enumerating players and also should I provide separate "faster" functions for working on the user's own player (to save going through GetSelfPid() all the time).
- Text drawing. I want to provide plain text drawing and a lot of extra more advanced text drawing functions such as centered text, wrapped text, colored text (picking a row from the font sheet). These advanced features can all be mixed and matched, but the functions take different numbers of parameters, any ideas how to implement this? I don't want loads of really long function names and lots of copy/pasted code.
- Server confirmed "commands". Things like move forward, rotate left, etc will be sent to the server for confirmation. The client will move/rotate instantly otherwise lag will be noticeable. However if the client doesn't receive a confirmation after a certain amount of time it should revert to the old position. I've been thinking about this and so far I've thought of "undo" states that get saved on every key press. These would get processed on a timeout, also note they are relative undos, not absolute (otherwise you would be jumping everywhere as soon as you lose 1 confirmation to packet loss). Is there any other way to implement the "revert on timeout" thing?
Here are the relevant parts of the player header file:
struct PlayerPosition
{
int x, y, xspeed, yspeed, rotation;
};
struct player_stats_t
{
int points;
int kills, deaths;
};
int Player_GetSelfPid(void);
int Player_GetSelfTeam(void);
int Player_IsSpectator(int pid);
int Player_IsSelfSpectator(void);
int Player_GetPlayerCount(void);
void Player_GetPlayerName(int pid, char *namebuf, int buflen);
int Player_GetPlayerTeam(int pid);
/* stats */
void Player_SortByPoints(void);
void Player_SortByName(void);
void Player_EnumStats(void (*func)(int pid, struct player_stats_t *stats,
void *clos), void *clos);
/* position */
/* copies the value of pos to internal storage. */
void Player_SetPlayerPosition(int pid, struct PlayerPosition *pos);
/* copies the internal values to pos */
void Player_GetPlayerPosition(int pid, struct PlayerPosition *pos);
/* pos is a pointer to a read only version of the player's position. you can
* modify it but it won't get saved unless you call Player_SetPlayerPosition.
* note: this only enums players that are in a ship. */
void Player_EnumPositions(void (*func)(int pid, struct PlayerPosition *pos,
void *clos), void *clos); |
Here's the text header file so far. I haven't done all the features yet, but as you can see the function names and number of parameters is starting to get rediculous. Colored text is limited to the format of the ss font sheet, what if a game wanted a color like brown? Is it worth implementing palette swapping to get arbitrary font colors, this would only be flat colours, not a gradient for simplicity.
/* these settings are ok for one color of an ss font sheet. */
#define TEXT_FRAMES_WIDE 48
#define TEXT_FRAMES_HIGH 2
#define TEXT_START_CHAR ' '
#define TEXT_END_CHAR (TEXT_START_CHAR + TEXT_FRAMES_WIDE * TEXT_FRAMES_HIGH)
/** font colors */
enum
{
F_WHITE,
F_GREEN,
F_BLUE,
F_RED,
F_YELLOW,
F_PURPLE,
F_ORANGE,
F_PINK,
/* the last one */
F_COUNT
};
/** basic write text to dest at xy using fontsheet font (the font sheet should
* contain only 1 color). */
void GfxText_DrawText(ImageHandle dest, ImageHandle font, int x, int y,
const char *format, ...);
/* more complex text drawing */
void GfxText_DrawTextCentered(ImageHandle dest, ImageHandle font, int x, int y,
const char *format, ...);
void GfxText_DrawColoredText(ImageHandle dest, ImageHandle font, int color,
int x, int y, const char *format, ...);
void GfxText_DrawColoredTextCentered(ImageHandle dest, ImageHandle font,
int color, int x, int y, const char *format, ...); |
-- End of technical stuff. --
I don't mind if you didn't read all of this post. I will upload some demos and screenshots of the game when they are ready _________________ ss news
|
|
Back to top |
|
|
Witchie NL Seasoned Helper
Age:33 Gender: Joined: Jul 24 2005 Posts: 112 Location: Veere, Zeeland, Netherlands Offline
|
Posted: Thu Nov 23, 2006 5:09 pm Post subject: |
|
|
|
|
i dont see why this is in non-subspace related coding? Its supose to connect to a subSpace (Continuum) server.
Anyway. Great. Im looking forward to see some screenshots.
|
|
Back to top |
|
|
Smong Server Help Squatter
Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Thu Nov 23, 2006 5:29 pm Post subject: |
|
|
|
|
I'm just reusing the network layer. Pretty much everything else will be different. For example in monkey fight the weaon requires "charging" by holding down a key, this will increase the strength of the weapon.
|
|
Back to top |
|
|
Cyan~Fire I'll count you!
Age:36 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Thu Nov 23, 2006 5:36 pm Post subject: |
|
|
|
|
For one, why not just a flag for centering text?
About player data, how about the core keeps track of all the information it needs to plus an opaque value that can be a pointer to a custom extra info structure.
The server-confirmed commands seems like it would probably stress the server a little too much. What about Bak's idea of other players checking? _________________ This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
|
|
Back to top |
|
|
Smong Server Help Squatter
Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Thu Nov 23, 2006 6:00 pm Post subject: |
|
|
|
|
Player data, I suppose I could make the core give each player a pointer to game defined data. Only problem is possible duplication of data (freq/ship can effect the chat colors/formatting) and at which point does the game get to initialise the pointer. The first can be ignored, the second can be solved easily with player enter/leave callbacks.
I think server-confirmed commands should be fine. Looking at online FPS's, bandwidth usage is 10-100x more than ss and the games update 10x faster than SS. So you don't get 400 players per server in FPS, but I doubt that will happen with this game.
|
|
Back to top |
|
|
Smong Server Help Squatter
Joined: 1043048991 Posts: 0x91E Offline
|
|
Back to top |
|
|
Bak ?ls -s 0 in
Age:25 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
|
Back to top |
|
|
Smong Server Help Squatter
Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Sun Nov 26, 2006 5:23 am Post subject: |
|
|
|
|
Oh well, that'll save me testing it.
|
|
Back to top |
|
|
hellzlaker Registered Cap Buster Popping men in the ass since Oct 2005
Gender: NEVER ENOUGH! Joined: Oct 27 2005 Posts: 34 Offline
|
Posted: Sun Nov 26, 2006 11:40 am Post subject: |
|
|
|
|
thats a cool idea -.- are you going to self host it ?
|
|
Back to top |
|
|
Smong Server Help Squatter
Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Mon Nov 27, 2006 4:25 am Post subject: |
|
|
|
|
I'll probably get phong to host it on one of his linux asss servers.
Current status player-player collisions are done. Player-glove collisions don't seem to work properly, but I can't know for sure until I add support for the new packets to asss.
game1.png - 26.14 KB
File downloaded or viewed 18 time(s)
|
|
Back to top |
|
|
Quan Chi2 Member of "Sexy Teenagers that Code" Group
Age:33 Gender: Joined: Mar 25 2005 Posts: 860 Location: NYC Offline
|
Posted: Wed Nov 29, 2006 2:47 pm Post subject: |
|
|
|
|
Smong - brilliant. I have the game and I'd love to try this. Great job. Keep up the good work.
|
|
Back to top |
|
|
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
Software by php BB © php BB Group Server Load: 750 page(s) served in previous 5 minutes.
|