Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411673 Posts in 69399 Topics- by 58452 Members - Latest Member: homina

May 17, 2024, 01:30:11 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsProject Lockdown - top-down multiplayer shooter
Pages: [1]
Print
Author Topic: Project Lockdown - top-down multiplayer shooter  (Read 1746 times)
elisee
Level 1
*



View Profile WWW
« on: January 02, 2012, 05:38:03 AM »

Hello there people,

So as a side-project during the holidays, I took a short break from CraftStudio development and I started a little top-down multiplayer shooting game, it's kinda like a 2D Alien Swarm. I'm calling it Project Lockdown as a working title. Here's a short gameplay video:



(Just to be clear, this game wasn't made with CraftStudio or anything. I do plan to recreate it with CraftStudio later this year, as a way to validate CraftStudio for real game development, but for now it's just another XNA game)

I setup the engine in under 30 hours (rough estimation). It's written in C# and here's how it works:

  • XNA does rendering & input
  • I use NuclearUI (part of my open-source set of XNA libraries) for the little GUI at start up. This was a big time saver!
  • Networking is handled by Lidgren
  • Maps are created using Tiled and processed using TiledLib in an XNA Content Pipeline Extension
  • Scripting is done with Lua through LuaInterface. I was very glad to finally find an up-to-date Lua lib for C#! (well Lua 5.2 was just released but I'm fine with 5.1 support)

The engine fully separates game logic from rendering, building on previous work I had started for (the sadly unreleased for now) QuadSmash Online.

I have a GameLogic and a GameRenderer class. The host player instantiates both while other players only have a GameRenderer.

The GameLogic loads a Lua file describing the level and calls its OnInit() function after registering various facilities for loading maps or handling events. Here's the script for the current test level (FSQ is the API namespace, I'll change it to LKD or something else for the final game name):

Code:
FSQ.OnInit = function()
  map = FSQ.LoadMap( "Map01" )
end

gate01SwitchCount = 0

FSQ.OnFloorSwitch = function( floorSwitchName, pressed )
  if floorSwitchName == "switch01" or floorSwitchName == "switch02" then
    if pressed then
      if gate01SwitchCount == 0 then
        FSQ.SetLockState( "gate01", false )
      end
      
      gate01SwitchCount = gate01SwitchCount + 1
    else
      gate01SwitchCount = gate01SwitchCount - 1
      
      if gate01SwitchCount == 0 then
        FSQ.SetLockState( "gate01", true )
      end
    end
  end
end

The game runs at 60 ticks per second, and networking is 15 ticks per second. Regular object updates (position, angle updates, etc.) are sent by the server one every 4 logical ticks, and the client interpolates 4 frames between those network ticks, which means the client is always at least 1/15th of a second late (not including network latency). This is pretty much unavoidable unless you want to be doing prediction at all times for all objects. I might add some client-side prediction for player movement but for now it seems to work well enough.

One-time events (switches pressed, bullets fired, enemy damage, etc.) are sent right away by the server, specifying at which logic tick they happen. They still happen with 1/15th second delay on clients, but they are enqueued and consumed only at the correct time thanks to the precise tick info.

Here's a screenshot of the first map in the map editor:


Tiled has really grown to be a great tool. Being able to place objects and name them, and then reference them in a script file (all without writing a custom level editor) is many kinds of awesome!

That's it for now! I'll try to release a little test build of the game later this week, but I need to get back to working on animation support in CraftStudio!

Consider following me on Twitter at @elisee if you want to be kept up to date on this project and others.

See you guys soon!
« Last Edit: November 12, 2012, 10:26:39 AM by elisee » Logged

elisee
Level 1
*



View Profile WWW
« Reply #1 on: January 12, 2012, 10:06:53 AM »

Ok since I said I would, I took some time to create an archive with an initial, basic build. Players can't be hurt yet, there's no goal, only a single test level.

Instructions

The XNA 4.0 runtime is required (you probably already have it if you play lots of games).

Download and unpack Lockdown001.zip, then start Lockdown.exe to run the game.



If you want other people to join your game over the Internet, they'll have to enter your public IP address. You'll need to have your UDP port 6547 forwarded to your machine in case you're behind a router.

I'm still trying to figure out what to do with the project. I'm not sure I like the visual style that much and I've already got plenty of other stuff to work on. Anyway, enjoy!

EDIT: Just reuploaded the build using the Reach XNA profile instead of HiDef. More graphics cards should work now.
« Last Edit: January 12, 2012, 11:01:37 AM by elisee » Logged

biomechanic
Level 3
***


View Profile
« Reply #2 on: January 12, 2012, 03:11:50 PM »

I only realized that the small grey dot was the door's switch when I came back here to type this up and noticed the function name in your code. I was about to say that I tried almost all the buttons on my keyboard to activate the pink switch and none worked, so you should put the controls in your post. Now I have to change that to: make so that usable objects stand out more than random doodats.

As the camera moves there are occasional flashes of a grid, as if the tiles didn't quite fit together.

Also: is there sound? If there is, it doesn't play for me.
Logged
elisee
Level 1
*



View Profile WWW
« Reply #3 on: January 12, 2012, 03:43:25 PM »

Thanks for trying it out Smiley.

I only realized that the small grey dot was the door's switch when I came back here to type this up and noticed the function name in your code. I was about to say that I tried almost all the buttons on my keyboard to activate the pink switch and none worked, so you should put the controls in your post. Now I have to change that to: make so that usable objects stand out more than random doodats.

Yeah the pink switch is just decorative, added it after the actual switch and it looks way too much like it does something, you're right.

Quote
As the camera moves there are occasional flashes of a grid, as if the tiles didn't quite fit together.

I just checked and I can't reproduce this, but I've had similar issues in CraftStudio on some computers, the texture filtering isn't consistent on all hardware. I guess it depends on the shader model available, XNA might fall back to a lower precision mode.

Quote
Also: is there sound? If there is, it doesn't play for me.

Nope, no sound yet. I had a basic firing effect done with sfxr but it was so awful I disabled it just when I uploaded the build Grin.

Thanks for the feedback!
« Last Edit: January 14, 2012, 03:37:20 AM by elisee » Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic