Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
multiplayer game design (discussion)

 
Post new topic   Reply to topic Printable version
 View previous topic  how to make to tell batch files make a... Post :: Post my first personal project =)  View next topic  
Author Message
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Thu Nov 23, 2006 4:54 pm    Post subject: multiplayer game design (discussion) Reply to topic Reply with quote

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:
Code: Show/Hide
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.
Code: Show/Hide
/* 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 icon_biggrin.gif
_________________
ss news
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Witchie NL
Seasoned Helper


Age:33
Gender:Gender:Male
Joined: Jul 24 2005
Posts: 112
Location: Veere, Zeeland, Netherlands
Offline

PostPosted: Thu Nov 23, 2006 5:09 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Send email Visit posters website MSN Messenger
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Thu Nov 23, 2006 5:29 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Cyan~Fire
I'll count you!
I'll count you!


Age:36
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Thu Nov 23, 2006 5:36 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Visit posters website
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Thu Nov 23, 2006 6:00 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Sat Nov 25, 2006 6:26 am    Post subject: Reply to topic Reply with quote

I just came up with a friction formula with simplicity in mind and it could be adapted to see if it's the same as ball friction in ss (I'll check later):
Code: Show/Hide
#define CFG_MAX_SPEED 3000
#define CFG_FRICTION ((double)10 / CFG_MAX_SPEED)
...
   // per game tick
   pos->xspeed -= pos->xspeed * CFG_FRICTION;
   pos->yspeed -= pos->yspeed * CFG_FRICTION;

This formula has a terminal velocity property. I suggest replacing CFG_MAX_SPEED with SoccerBallSpeed and 10 with SoccerBallFriction (higher numbers do slow it down more with this formula, so at least that bit's correct).
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Bak
?ls -s
0 in


Age:24
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Sat Nov 25, 2006 10:56 am    Post subject: Reply to topic Reply with quote

powerball acceleration is not constant.
_________________
SubSpace Discretion: A Third Generation SubSpace Client
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Sun Nov 26, 2006 5:23 am    Post subject: Reply to topic Reply with quote

Oh well, that'll save me testing it.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
hellzlaker
Registered Cap Buster
Popping men in the ass since Oct 2005


Gender: NEVER ENOUGH!
Joined: Oct 27 2005
Posts: 34
Offline

PostPosted: Sun Nov 26, 2006 11:40 am    Post subject: Reply to topic Reply with quote

thats a cool idea -.- are you going to self host it ?
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address MSN Messenger
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Mon Nov 27, 2006 4:25 am    Post subject: Reply to topic Reply with quote

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 17 time(s)
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Quan Chi2
Member of "Sexy Teenagers that Code" Group
Member of


Age:33
Gender:Gender:Male
Joined: Mar 25 2005
Posts: 860
Location: NYC
Offline

PostPosted: Wed Nov 29, 2006 2:47 pm    Post subject: Reply to topic Reply with quote

Smong - brilliant. I have the game and I'd love to try this. Great job. Keep up the good work.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Non-Subspace Related Coding All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 488 page(s) served in previous 5 minutes.

phpBB Created this page in 0.509168 seconds : 38 queries executed (93.0%): GZIP compression disabled