of     1   

pighead10
#59433571Sunday, December 11, 2011 9:21 PM GMT

This is a game engine in progress designed to have a scripting api for round based games, specifically shooters. Current it has a RoundManager and TeamManager, and there is also a GuiManager planned for it. But beyond then I'm stuck - what other things would you need for a game engine? Here is some sample code for initializing the engine and using RoundManager and TeamManager: repeat wait() until shared.RSEngine_ServerLoaded local RealShooter = shared.initRealShooterEngine() local roundMgr = RealShooter.RoundManager:new() --[[ roundMgr:setEndMode("kill") function onRoundStart() print("onroundstart") for _,v in pairs(game.Players:GetChildren()) do v.Character.Torso.Anchored = true end end function onRoundEnd() print("onroundned") for _,v in pairs(game.Players:GetChildren()) do v.Character.Torso.Anchored = false end end roundMgr.RoundBegin:connect(onRoundStart) roundMgr.RoundEnd:connect(onRoundEnd) roundMgr:runRound(10) ]] --[[ local teamMgr = RealShooter.TeamManager:new() teamMgr:createTrackedTeam("Test team","Bright red") teamMgr:setScoreMode("ko") teamMgr:setupLeaderboard("Score") function playerDied(player,team) print(player.Name.." of "..team.Name.." died.") end teamMgr.PlayerDied:connect(playerDied) ]]
gombob
#59435403Sunday, December 11, 2011 9:47 PM GMT

GameModeManager? :p
stravant
Forum Moderator
#59442921Sunday, December 11, 2011 11:36 PM GMT

"teamMgr:setScoreMode("ko") teamMgr:setupLeaderboard("Score")" Bad idea. That leaves room for it to silently fail when you make a typo. I would make those enums instead of strings, EG: teamMgr:setScoreMode(RealShooter.TeamManager.KoMode) Overall it would probably be better to not have the game mode tried to a team. (Why would you do this? Are you planning to have a situation in which different teams have different leaderboards? Because that doesn't even work) Also, have you seen the coding style used in my Candy Cane Katana? I would suggest taking a look at that for an elegant way to do the behind the scenes creation of a class-system like that. There's even a "Signal" class exactly identical to Roblox' one in it, even including a "wait()" method.
Waterlimon
#59464931Monday, December 12, 2011 12:16 PM GMT

Does it have options for respawning, like: Do players wait till end of round while watchin their own team players? Do players wait x seconds before respawning? (this nees a way to decide how many seconds when they die, like if they died almost instantly, wait longer) Also do chu have a ton of game modes like: -Captoor de flag -Free 4 oool -Tem dethmutch -Hurr durr hardcore 1 shot and u die no respawn mode -Kill da fat zombie player who has minigun and 10 cm armor -Capture le flags -Destroy de enemy nuke launch pad lololo -Sumon must surviv 5 mins n he get nuke bttn and kill all
pighead10
#59466738Monday, December 12, 2011 3:22 PM GMT

""teamMgr:setScoreMode("ko") teamMgr:setupLeaderboard("Score")" Bad idea. That leaves room for it to silently fail when you make a typo. I would make those enums instead of strings, EG: teamMgr:setScoreMode(RealShooter.TeamManager.KoMode) Overall it would probably be better to not have the game mode tried to a team. (Why would you do this? Are you planning to have a situation in which different teams have different leaderboards? Because that doesn't even work) Also, have you seen the coding style used in my Candy Cane Katana? I would suggest taking a look at that for an elegant way to do the behind the scenes creation of a class-system like that. There's even a "Signal" class exactly identical to Roblox' one in it, even including a "wait()" method." I thought of enums first, then realized Lua didn't have them and used a string. I'll use that way of making enums. The setupLeaderboard() function's parameter is the heading of the leaderboard. The scoreMode is not bound to a team, I just included it in the TeamManager functionality (TeamManager has a table 'Teams' inside it where all the teams and relevant things are stored). It has an optional second parameter of a team you want it to, which sets the scoring rules for teams. "ko" is the only one, which gives the team/s a point whenever someone on their team gets a kill. What's a "Signal" class? I'll take a look at your class system, knowing me mine will be incredibly inefficient. @Radio No, I completely forgot about respawning options. I'll add that into the team manager. I haven't got different game types as its mainly for shooter games and isn't supposed to have tons of pre built stuff, but instead a lot of easy flexibility to make the stuff. I have RoundBegin and RoundEnd events, and prebuilt modes for both of them instead.
Waterlimon
#59466812Monday, December 12, 2011 3:30 PM GMT

I guess signal means events, like eventobj=event:connect() eventobj:disconnect() or event:wait()
pighead10
#59468934Monday, December 12, 2011 5:46 PM GMT

I was making my own event class, then found after making basic functionality it didn't have disconnect, wait, etc. I just took mattchewy's and used his.
pighead10
#59516359Tuesday, December 13, 2011 7:32 PM GMT

Hang on - would you need respawn modes? That wouldn't be something of its own, whenever you die you get put to the spawn anyway. The respawn would probably be some option in the GUI (whether or not to show the "enter game" gui depending on current status). Then again, I would need something else to show that...
stravant
Forum Moderator
#59521144Tuesday, December 13, 2011 9:33 PM GMT

Here's how I would do the API if I were you: Main classes: Team: Tracks stuff about the team, total kills, total lives, stuff like that if teams have them. Which players are on the team, etc. Game: Tracks the current game. This way you can have information such as rounds for games. Class: everyone likes class based combat. You need a representation of the classes. Then have a "GameMode" class which you plug into the "Game" class that determines how it runs, EG: local gameMode = CaptureTheFlagMode.new() gameMode:setNumRounds(30) gameMode:setBaseOne(game.Workspace....) gameMode:setFlagSpawn(...) ... Game:setGameMode(gameMode) Do the same sort of thing for stats: local killsStat = KillsStat.new() killsStat:setLabel("KOs") Game:getLeaderboard():addStat(killsStat) That way you can add as many thing as you want without having to touch the actual main code for the thing, you only have to write "plugins" of sorts which listen for events of the game like "onPlayerDoed" or "onPlayerKilledPlayer", and use those to modify stuff.
pighead10
#59556575Wednesday, December 14, 2011 5:17 PM GMT

I have Round, Team and Class. I should have named Round "Team" and I'm am moving the leaderboard to Round (which is now Game, as I am adding new stuff to it).
pighead10
#59603449Thursday, December 15, 2011 9:01 PM GMT

I will have to use custom events to transmit things from other managers to the one managing the stuff that is relevant but not directly then? =/

    of     1