Jump to content

Recommended Posts

Posted

Create or join a lobby, then hold V key to talk.

MultiplayerGame.zip

Source looks like this:

#include "App.h"

using namespace Leadwerks;

int main(int argc, const char *argv[])
{
	Steamworks::Initialize();

	//World setup
	auto window = Window::Create("Multiplayer Game", 0, 0, 1024, 768);
	auto context = Context::Create(window);
	auto world = World::Create();
	auto gui = GUI::Create(context);	
	auto camera = Camera::Create();
	
	//Create server list
	auto serverlist = Widget::ListBox(20, 20, 400, 300, gui->GetBase());
	int count = Lobby::Count({ { "game","mplayertest" } });
	Lobby* lobby = nullptr;
	for (int n = 0; n < count; ++n)
	{
		lobby = Lobby::Get(n);
		serverlist->AddItem(String(lobby->steamid),n==0);
	}
	lobby = nullptr;

	//GUI buttons
	auto button_join = Widget::Button("Join",20, 20+300, 76, 28, gui->GetBase());
	auto button_create = Widget::Button("Create", 20 + 76 + 2, 20+300, 76, 28, gui->GetBase());
	bool recording = false;
	
	while (true)
	{
		if (window->KeyHit(Key::Escape)) break;
		if (window->Closed()) break;
		
		if (lobby)
		{
			if (recording)
			{
				if (!window->KeyDown(Key::V))
				{
					Sound::StopRecording(lobby);
					recording = false;
				}								
			}
			else
			{
				if (window->KeyDown(Key::V))
				{
					Sound::StartRecording();
					recording = true;
				}
			}
		}
		
		P2P::Receive(-101);
		
		Time::Update();
		world->Update();
		world->Render();
		
		while (EventQueue::Peek())
		{
			auto event = EventQueue::Wait();
			if (event.id == Event::WidgetAction)
			{
				if (event.source == button_join)
				{
					int index = serverlist->GetSelectedItem();
					lobby = Lobby::Get(index);
					lobby->Join();
					gui->Hide();
				}
				else if (event.source == button_create)
				{
					lobby = Lobby::Create();
					lobby->SetKey("game", "mplayertest");
					gui->Hide();
				}
			}
		}
		
		context->Sync();
	}
	return 0;
}

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

I think you might be crashing my app when you join. Did you try to send a voice message?

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

i can hear someone testing but dont think they can hear me lol

Asus ROG STRIX B350-F GAMMING

AMD Ryzen 7 1700x

32 gb ddr4

15 TB raid 5 HD

Nvidia EVGA 1060GTX

Win10 64bit

Posted

You may need to check your Windows settings and make sure there is a microphone active.

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

Okay, I think I just received a message from you and it crashed my computer due to a coding error...

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

yep that me lol

at home off sick for a while so can do lots of testing for you lol

Asus ROG STRIX B350-F GAMMING

AMD Ryzen 7 1700x

32 gb ddr4

15 TB raid 5 HD

Nvidia EVGA 1060GTX

Win10 64bit

Posted

Okay, basically it is working but I have to fix something. I will continue tomorrow. Thanks!

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

The download is updated to fix the bug. Can someone please start it up and join my game?

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

Okay, thanks for your help! Basically, it works, although it needs more work to be better. :D

My job is to make tools you love, with the features you want, and performance you can't live without.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...