Hurray! Another multiplayer clone project. :)

Discuss and distribute tools and methods for modding. Moderator - Grognak
User avatar
fdagpigj
Posts: 83
Joined: Sat Apr 25, 2015 3:14 pm

Re: Hurray! Another multiplayer clone project. :)

Postby fdagpigj » Tue Feb 09, 2016 11:31 am

kcd.Spektor wrote:
fdagpigj wrote:Well, I just made a simulation in pygame (python 2). No idea why. Because it's fun, I guess. I feel like I have something pretty close to the original now.


Well I'm not familiar with python, so that code doesn't help any bit :)
Can you draw a logic tree for your algorithm?


I was almost going to, but I think some pseudocode is better. And I've slightly updated the logic since I posted but not gonna edit my post again because reasons. This logic assumes the following:

Each door always has a valid roomA, but roomB is null if the door is an airlock. Oxygen is a float in the range 0.0 to 100.0. Each room has exactly one oxygen value no matter its size, like in FTL. Each room also has a breaches integer property which represents the total number of hull breaches in that room. oxygenPower() gives the amount of power bars in the oxygen system, allDoors() and allRooms() an array of all rooms and doors on the ship, respectively. tickGame() occurs at set intervals.

Code: Select all

function tickGame() {
   for (var room in allRooms()) {tickRoom(room)}
   for (var door in allDoors()) {tickDoor(door)}
}
function tickRoom(room) {
   room.oxygen -= 0.04 + room.breaches*0.5 //subtract the default depletion rate and a large extra amount per breach... I'm still not 100% happy with the breaches but I can't come up with anything better that's not stupidly complex
   if (oxygenPower() > 0) {
      var refillRate = (1.0 + ( ( oxygenPower() - 1.0 ) ^ 2 ) / 4.0  ) / 1300.0 //level 2 should refill 1.5x as fast as level 1, level 3 3x, at least IIRC how FTL works
   } else {var refillRate = 0}
   room.oxygen += (200 - room.oxygen) * refillRate //add oxygen relative to how full the room already is... I'm not sure it's necessary to be relative but I think it makes more sense
    room.oxygen = max( min(room.oxygen, 100.0), 0.0 ) //limit the oxygen to between 0 and 100
}
function tickDoor(door) {
   if (door.open) {
      redistributeOxygen(door.roomA, door.roomB)
   }
}
function redistributeOxygen(roomA, roomB)
   if (roomB != null) {var oxygenB = roomB.oxygen}
   else {var oxygenB = -500.0} //door is an airlock so set the oxygen level to a negative value to force the room to lose oxygen faster than it otherwise could
   var difference = abs(roomA.oxygen - oxygenB)
   if (roomA.oxygen < oxygenB) {var sign = -1}
   else {var sign = 1}
   var change = min( max( difference / 20.0, 0.1), difference/2.0 ) //don't change the 2.0 since the maximum change should be half of the difference else the new values will reverse roles
   //since we compare the magnitude of the difference to a constant we need to take the absolute value and later multiply by -1 if it used to be negative
   roomA.oxygen -= sign * change
   if (roomB != null) { //the necessity of this check probably depends on how sensitive the language is, but it doesn't hurt to leave it in
      roomB.oxygen += sign * change
      if (roomB.oxygen < 0) {roomB.oxygen = 0}
   }
   if (roomA.oxygen < 0) {roomA.oxygen = 0}



I hope that helps :)
kcd.Spektor
Posts: 586
Joined: Thu Nov 26, 2015 8:21 am

Re: Hurray! Another multiplayer clone project. :)

Postby kcd.Spektor » Tue Feb 09, 2016 12:36 pm

fdagpigj wrote:I was almost going to, but I think some pseudocode is better.

Actually no. A visual logic tree is easier to adjust between different languages.

Each door always has a valid roomA, but roomB is null if the door is an airlock.

You are basic on doors while I can base only on cells(not rooms).

Each room has exactly one oxygen value no matter its size, like in FTL.

No, because I have no "rooms" I have cells and cells have walls(and doors).

hope that helps :)


I really appreciate the effort, but if you could draw a logic tree for the algorithm that would be better.
Also it's not critical anymore, since I've managed to make my algorithm working, so if it takes a lot of time - then just leave it :) .
User avatar
fdagpigj
Posts: 83
Joined: Sat Apr 25, 2015 3:14 pm

Re: Hurray! Another multiplayer clone project. :)

Postby fdagpigj » Tue Feb 09, 2016 2:17 pm

kcd.Spektor wrote:
fdagpigj wrote:I was almost going to, but I think some pseudocode is better.

Actually no. A visual logic tree is easier to adjust between different languages.


Well, I don't know how to make logic trees, and I tried to avoid using anything that would be too different across languages? I really don't know though, maybe Java really is just so much different.

Each door always has a valid roomA, but roomB is null if the door is an airlock.

You are basic on doors while I can base only on cells(not rooms).

Each room has exactly one oxygen value no matter its size, like in FTL.

No, because I have no "rooms" I have cells and cells have walls(and doors).


Then I guess you could apply my redistributeOxygen function to each cell border. Not really sure how you're going about it though.

hope that helps :)


I really appreciate the effort, but if you could draw a logic tree for the algorithm that would be better.
Also it's not critical anymore, since I've managed to make my algorithm working, so if it takes a lot of time - then just leave it :) .
[/quote]

And cool that you got something working, I'm probably not gonna bother drawing a tree. I'll most likely use the code I wrote for a project of my own later down the road anyway, so it wasn't completely wasted time on my part either.
jrb00001
Posts: 201
Joined: Fri Jan 15, 2016 2:22 pm

Re: Hurray! Another multiplayer clone project. :)

Postby jrb00001 » Tue Feb 09, 2016 4:49 pm

kcd.Spektor wrote:
jrb00001 wrote:I think the amount of replenished oxygen per cell should be divided by the amount of room cells. Bigger ships need more oxygen!

This can lead to 0 oxygen replenishment on really big ships.
And on smaller ships it would be replenished really slow, but venting it out will still be fast, and that would be a disballance.

It would lead to a slow replenishment on big ships but a fast replenishment on small ships. If you need a faster replenishment on big ships, just add more oxygen systems (which should not be a problem because big ships are bigger than the smaller ones :D).
kcd.Spektor
Posts: 586
Joined: Thu Nov 26, 2015 8:21 am

Re: Hurray! Another multiplayer clone project. :)

Postby kcd.Spektor » Thu Feb 11, 2016 6:26 am

jrb00001 wrote:It would lead to a slow replenishment on big ships but a fast replenishment on small ships. If you need a faster replenishment on big ships, just add more oxygen systems (which should not be a problem because big ships are bigger than the smaller ones :D).

True.
But I think I'll keep it even for all ships, for now.
And if it will look out of ballance, then I can change it later.
Soap
Posts: 8
Joined: Mon Feb 08, 2016 5:58 pm

Re: Hurray! Another multiplayer clone project. :)

Postby Soap » Thu Feb 11, 2016 1:17 pm

Spektor let me tell you that's the best project I never seen.

Your alpha is amazing, it's just all we want my friends and me. An FTL like game multiplayer, with multiplayer crew inside one ship !
You're on the way to made our dreams come true.

We look forward to confront IA ships now :D
Thanks for all !

EDIT: Someone could open an alpha server to try it with few persons ? (Pvp & Crew vs crew)
kcd.Spektor
Posts: 586
Joined: Thu Nov 26, 2015 8:21 am

Re: Hurray! Another multiplayer clone project. :)

Postby kcd.Spektor » Thu Feb 11, 2016 5:11 pm

Soap wrote:Spektor let me tell you that's the best project I never seen.

Your alpha is amazing, it's just all we want my friends and me. An FTL like game multiplayer, with multiplayer crew inside one ship !
You're on the way to made our dreams come true.


Thanks for the support :)
This kind of comment is something that really helps to keep developing.
We look forward to confront IA ships now :D
Thanks for all !

It's comming soon :)
EDIT: Someone could open an alpha server to try it with few persons ? (Pvp & Crew vs crew)

I think that jrb wanted to host one. But he needs to be able to run the server with console only.
And that will be available in the nearest update.
jrb00001
Posts: 201
Joined: Fri Jan 15, 2016 2:22 pm

Re: Hurray! Another multiplayer clone project. :)

Postby jrb00001 » Thu Feb 11, 2016 5:15 pm

Soap wrote:Spektor let me tell you that's the best project I never seen.

Your alpha is amazing, it's just all we want my friends and me. An FTL like game multiplayer, with multiplayer crew inside one ship !
You're on the way to made our dreams come true.

We look forward to confront IA ships now :D
Thanks for all !

EDIT: Someone could open an alpha server to try it with few persons ? (Pvp & Crew vs crew)

I will open a server as soon as kcd.Spektor releases a new version which fixes the headless part.

kcd.Spektor wrote:I think that jrb wanted to host one. But he needs to be able to run the server with console only.
And that will be available in the nearest update.

When will you release the update?
kcd.Spektor
Posts: 586
Joined: Thu Nov 26, 2015 8:21 am

Re: Hurray! Another multiplayer clone project. :)

Postby kcd.Spektor » Thu Feb 11, 2016 5:17 pm

Small update.

I'm 99% done with the oxygen related stuff (mechanic, fires, breaches).
After that will be::
1 making the server runnable from console
2 adding some parameters to the ship editor
3 posting a tutorial for ship editor

And then I will release another version.
:)
kcd.Spektor
Posts: 586
Joined: Thu Nov 26, 2015 8:21 am

Re: Hurray! Another multiplayer clone project. :)

Postby kcd.Spektor » Thu Feb 11, 2016 9:37 pm

Updated the TODO list on first post.

Who is online

Users browsing this forum: No registered users and 42 guests