Author Topic: Pulsar 4X  (Read 33508 times)

0 Members and 1 Guest are viewing this topic.

Offline LoSboccacc

  • Sub-Lieutenant
  • ******
  • L
  • Posts: 136
  • Thanked: 5 times
Re: Pulsar 4X
« Reply #75 on: September 04, 2012, 06:03:33 AM »
can I build on mac?
 

Offline Antagonist (OP)

  • Pulsar 4x Dev
  • Sub-Lieutenant
  • *
  • A
  • Posts: 124
Re: Pulsar 4X
« Reply #76 on: September 04, 2012, 06:26:30 AM »
Technically yes.

Its not working correctly yet, sublight is on Mac himself and it should be working at some point.

If you're willing to offer some help on that front let us know.
 

Offline Nathan_

  • Pulsar 4x Dev
  • Commodore
  • *
  • N
  • Posts: 701
Re: Pulsar 4X
« Reply #77 on: September 04, 2012, 02:19:10 PM »
I'll go ahead and get on the skype discussion. I have still been working on the combat sim, but its fairly involving as it turns out.
 

Offline Erik L

  • Administrator
  • Admiral of the Fleet
  • *****
  • Posts: 5658
  • Thanked: 373 times
  • Forum Admin
  • Discord Username: icehawke
  • 2020 Supporter 2020 Supporter : Donate for 2020
    2022 Supporter 2022 Supporter : Donate for 2022
    Gold Supporter Gold Supporter : Support the forums with a Gold subscription
    2021 Supporter 2021 Supporter : Donate for 2021
Re: Pulsar 4X
« Reply #78 on: September 04, 2012, 10:47:12 PM »
For graphics, if you need them you might want to check out opengameart.org

Offline LoSboccacc

  • Sub-Lieutenant
  • ******
  • L
  • Posts: 136
  • Thanked: 5 times
Re: Pulsar 4X
« Reply #79 on: September 05, 2012, 02:45:21 AM »
Technically yes.

Its not working correctly yet, sublight is on Mac himself and it should be working at some point.

If you're willing to offer some help on that front let us know.

no I can only follow order and launch script I can't really resolve anything outside things I know (java/objective-c)
 

Offline joe

  • Able Ordinary Rate
  • Posts: 3
Re: Pulsar 4X
« Reply #80 on: September 05, 2012, 03:58:39 AM »
Just chiming in - was able to build the "game" and launch it on a different notebook than mine and aside from two OpenGL issues (me and Antagonist both suspect PC drivers, not the code itself) the thing runs just fine.

Resizable and scrollable throughout, the System Info and System map windows show the preinserted values and buttons click as they should. . .  So no issues I see so far :)

Will try the build on my own notebook during the weekend just to see if I do get any OpenGL issues.
 

Offline Antagonist (OP)

  • Pulsar 4x Dev
  • Sub-Lieutenant
  • *
  • A
  • Posts: 124
Re: Pulsar 4X
« Reply #81 on: September 05, 2012, 07:23:53 AM »
The repository has moved to a new organisation, Pulsar4xDevs.
This means that the repo link is now https://github.com/Pulsar4xDevs/Pulsar4x

It appears the windows client is smart enough to automagically point to the new one, so no worries if you have already cloned it.  If you have not yet, please use the new repository link.

@LoSboccacc:

We'll let you know once Mac version is working.  We have resolved most of the issues, but we can definitely do with another tester on the mac side to make sure it works for everyone when we release.

@joe:

Lemme know if updating drivers works any.  Right now we assume OpenGL 2.x minimum, which is basically DirectX 9 compatible card.  If there are a lot of people who want to play Pulsar on PCs either with really crap inbuilt or else with really old GPUs, we CAN add in OpenGL 1.x support.  But would prefer not to have to at this stage.
 

Offline Nathan_

  • Pulsar 4x Dev
  • Commodore
  • *
  • N
  • Posts: 701
Re: Pulsar 4X
« Reply #82 on: September 05, 2012, 02:16:25 PM »
Does the mac have any equivalent to the SSE instructions? thats my current method for doing square roots, but I've got some others if that comes up.

Heres the function in question:

Code: [Select]
void calcDistance()
{
//check if less than 4 distances to be calculated
//if no then load and calc distances for 4

for( int loop = 0; loop < agentNum; loop++ ) //for each agent
{
for( int loop2 = loop; loop2 < agentNum; loop2+=4) //calc 4 at a time
{
if( agentNum - loop2 < 4 )
{
__declspec(align(16)) float xData[4] = { 0.0 };
for( int loop3 = 0; loop3 < (agentNum - loop2); loop3++)
xData[ loop3 ] = ships[ loop ].position.x - ships[ loop2 + loop3 ].position.x;

__declspec(align(16)) float yData[4] = { 0.0 };
for( int loop3 = 0; loop3 < (agentNum - loop2); loop3++)
yData[ loop3 ] = ships[ loop ].position.y - ships[ loop2 + loop3 ].position.y;

__declspec(align(16)) float zData[4];

__asm
{
movaps xmm0, [xData + 0x00]
movaps xmm1, [yData + 0x00]
 
mulps xmm0, xmm0
mulps xmm1, xmm1

addps xmm0, xmm1
 
sqrtps xmm0, xmm0

movaps [zData + 0x00], xmm0
}

for( int loop3 = 0; loop3 < (agentNum - loop2); loop3++)
{
ships[ loop ].dist[ loop2 + loop3 ] = zData[ loop3 ];
ships[ loop2 + loop3 ].dist[ loop ] = zData[ loop3 ];
}
}
else
{
__declspec(align(16)) float xData[4];
xData[0] = ships[ loop ].position.x - ships[ loop2 + 0 ].position.x;
xData[1] = ships[ loop ].position.x - ships[ loop2 + 1 ].position.x;
xData[2] = ships[ loop ].position.x - ships[ loop2 + 2 ].position.x;
xData[3] = ships[ loop ].position.x - ships[ loop2 + 3 ].position.x;

__declspec(align(16)) float yData[4];
yData[0] = ships[ loop ].position.y - ships[ loop2 + 0 ].position.y;
yData[1] = ships[ loop ].position.y - ships[ loop2 + 1 ].position.y;
yData[2] = ships[ loop ].position.y - ships[ loop2 + 2 ].position.y;
yData[3] = ships[ loop ].position.y - ships[ loop2 + 3 ].position.y;

__declspec(align(16)) float zData[4];

__asm
{
movaps xmm0, [xData + 0x00]
movaps xmm1, [yData + 0x00]
 
mulps xmm0, xmm0
mulps xmm1, xmm1

addps xmm0, xmm1
 
sqrtps xmm0, xmm0

movaps [zData + 0x00], xmm0
}

ships[ loop ].dist[ loop2 + 0 ] = zData[ 0 ];
ships[ loop ].dist[ loop2 + 1 ] = zData[ 1 ];
ships[ loop ].dist[ loop2 + 2 ] = zData[ 2 ];
ships[ loop ].dist[ loop2 + 3 ] = zData[ 3 ];

ships[ loop2 + 0 ].dist[ loop ] = zData[ 0 ];
ships[ loop2 + 1 ].dist[ loop ] = zData[ 1 ];
ships[ loop2 + 2 ].dist[ loop ] = zData[ 2 ];
ships[ loop2 + 3 ].dist[ loop ] = zData[ 3 ];

}
}
}
}
« Last Edit: September 05, 2012, 02:43:50 PM by Nathan_ »
 

Offline LoSboccacc

  • Sub-Lieutenant
  • ******
  • L
  • Posts: 136
  • Thanked: 5 times
Re: Pulsar 4X
« Reply #83 on: September 05, 2012, 04:45:26 PM »
Does the mac have any equivalent to the SSE instructions?


yes, they're intel now. I believe you could have some problem with the asm syntax, but I see that at least  you're declaring everything16-bit aligned, which is the main problem when porting asm to osx


btw, why asm and not something like http://www.agner.org/optimize/vectorclass.pdf (simd for the lazy)?
 

Offline Nathan_

  • Pulsar 4x Dev
  • Commodore
  • *
  • N
  • Posts: 701
Re: Pulsar 4X
« Reply #84 on: September 05, 2012, 05:23:29 PM »
The example of how to do it that way was 1 page, and I was looking for something quick. also I wanted to experiment with the SSE stuff in any event.
 

Offline SnopyDogy

  • Pulsar 4x Dev
  • Chief Petty Officer
  • *
  • Posts: 41
  • Pulsar4x Dev
    • Pulsar4x
Re: Pulsar 4X
« Reply #85 on: September 05, 2012, 06:33:50 PM »
For the record the log file output bu Pulsar includes information like Video Card, OpeGL version detected, GLSL (Shader) version detected, etc. It should be just after the stargen stuff. If you are having OpenGL Problems you can check there to see if Pulsar can find a compatible version of openGL (anthing higher than 2.1, not sure if 2.0 works as it hasn't been tested).
 

Offline Antagonist (OP)

  • Pulsar 4x Dev
  • Sub-Lieutenant
  • *
  • A
  • Posts: 124
Re: Pulsar 4X
« Reply #86 on: September 06, 2012, 05:03:39 AM »
We've started to use the github issue tracker.  Just for reference, this is for bugs and assistance requests.  If you gonna work on something and complete it yourself there is no need for a ticket.  On the other hand if there is something you won't get to in a while and might be suitable for a newcomer or bored dev to tackle, please submit a ticket.

We might also use this for tracking milestones, but lets see how it goes first.
 

Offline Antagonist (OP)

  • Pulsar 4x Dev
  • Sub-Lieutenant
  • *
  • A
  • Posts: 124
Re: Pulsar 4X
« Reply #87 on: October 01, 2012, 02:39:03 AM »
Alright, with the release of alpha 1 we need to start thinking about what we want for alpha 2.

Note that none of this is authoritativeness. We are a loose collection of devs. You want to put in something, put in something. I'm only raising this topic for discussion on what would be cool to show off next release.

First thing I'm thinking is the actual time controls. Not just will planets moving smoothly around their orbits look awesome, time controls are required for economies, ships, and actually any gameplay element whatsoever.

Second what would be cool is selectable planets in the system map, summary of planet on the left, buttons or double clicking taking them to the planet in F9, or to the economy screen.

On the backend, I'd like to improve the stargen a little.  Add comets, find a nice way to get asteroid belts working too.  And clean up orbits so we don't get AS MUCH crossing as we do now, but keep crossing possible.

Trying to get mac and linux builds working has been educational and... its not easy.  Something is especially seriously wrong with mac's mono, but we're on it. Hope to get that working properly for next release.

Otherwise I like and I'm impressed with what we have.  This is a hobby, all devs volunteer their time, and we have made quite nice progress so far. Great job all!
 

Offline Nathan_

  • Pulsar 4x Dev
  • Commodore
  • *
  • N
  • Posts: 701
Re: Pulsar 4X
« Reply #88 on: October 03, 2012, 03:17:23 AM »
I've finally finished with the sensor model.

Sensor components themselves store a lookup table of values, where the signature of any particular ship just needs to be plugged in to get the appropriate value.
Code: [Select]
int getActiveDetectionRange(activeSensor *sensor, int TCS, int MSP)
{
//limits of the array
if( TCS > 499 || TCS < 0 )
{
return -1;
}
int range;
if( TCS != 0 )//ships
{
/*int shipTCS = TCS - 1;

if( shipTCS > 499 )
shipTCS = 499;*/
range = sensor->lookUpST[ TCS ];
}
else //missiles
{
range = sensor->lookUpMT[ MSP ];
}

return range;
}
Next up are ships, which store their signatures, a pointer to a sorted linked list of all 3 detection values, and an indicator for whether or not a player has IDed this ship this tick:
Code: [Select]
//Detection related statistics
int TCS; //Total Cross Section for active scanners. modified by cloaks
int tSig; //thermal signature of ship. modified by thermal reduction
int maxTSig; //maximum thermal signature of the ship.
int eSig; //EM signature of ship. no way to reduce this, shields and actives are always detected.

//which players have detected this ship and how.
unsigned int thermalDet[32];
unsigned int EMDet[32];
unsigned int activeDet[32];

//this ship's placement in the linked list of thermal/em/TCS lists.
sortList *thermal;
sortList *EM;
sortList *active;

At the taskforce level I have a distance table, a pointer to each of the best passive sensors, an active sensor que for which active sensors are on and working, and a lookuptable that addresses the active sensor que, which can then be used to access that particular sensor's lookup table, and finally the heads and tails of each of the sorted linked lists of all the ships in this taskforce, from least to greatest.
Code: [Select]
if( TG->activeCount != 0 )
{
for( int loop = 0; loop < 500; loop++ )
{
//TG->tfLookUpST is different from ->lookUpST. the first stores an index to the active que, the second
//stores a range value at that particular resolution. In effect tfLookUpST points you at the best sensor to
//look for that resolution value with its lookUpST.
if( TG->activeQue[ TG->activeCount ]->lookUpST[ loop ] > TG->activeQue[ TG->tfLookUpST[ loop ] ]->lookUpST[ loop ] ) //<<<
{
TG->tfLookUpST[ loop ] = TG->activeCount;
}
}

for( int loop = 0; loop < 15; loop++ )
{
if( TG->activeQue[ TG->activeCount ]->lookUpMT[ loop ] > TG->activeQue[ TG->tfLookUpMT[ loop ] ]->lookUpMT[ loop ] )
{
TG->tfLookUpMT[ loop ] = TG->activeCount;
}
}
}

at the player level I store global taskforce contacts, any taskforce that I no longer need to search because it has been detected, or cannot be detected(EM signature = 0)
Likewise I do a per player sensor sweep that touches on every taskforce in the global list, and every ship in that taskforce. First I check to see if none of the ships are detected(comparing best sensor vs biggest signature), then I check to see if they all are via the smallest signature against the appropriate sensor, and finally I run backwards through the linked list marking everything that is detected as detected

Code: [Select]
if( P->contactACTGlobal[ loop2 ] != tick && P->TFList[ loop ]->activeCount != 0 )
{
noDet = 0;
allDet = 0;

shipSig = tfListGlobal[ loop2 ]->tfShipList[ tfListGlobal[ loop2 ]->aTail->index ]->TCS;

shipSig = shipSig - 1;
if( shipSig > 499 )
shipSig = 499;

shipDet = getActiveDetectionRange( P->TFList[ loop ]->activeQue[ P->TFList[ loop ]->tfLookUpST[ shipSig ] ], shipSig, 0);

//First check the biggest ship, which should be paired correspondingly to the longest ranged sensor
//If a smaller vessel would be detected at this range, then the biggest vessel must definitely be detected by that sensor or any better sensor
//barring a bug of course, but that doesn't detract from the logic
if( dist > shipDet ) //no detections
{
noDet = 1;
}

if( noDet == 0 )
{

shipSig = tfListGlobal[ loop2 ]->tfShipList[ tfListGlobal[ loop2 ]->aHead->index ]->TCS;

shipSig = shipSig - 1;
if( shipSig > 499 )
shipSig = 499;

shipDet = getActiveDetectionRange( P->TFList[ loop ]->activeQue[ P->TFList[ loop ]->tfLookUpST[ shipSig ] ], shipSig, 0);

if( dist <= shipDet ) //in this case the smallest ship is detected, which means that all larger ships must also be detected
{
allDet = 1; //either by this sensor, or by a better one
for( int loop3 = 0; loop3 < tfListGlobal[ loop2 ]->shipCount; loop3++ )
{
ship *enemyShip = tfListGlobal[ loop2 ]->tfShipList[ loop3 ];
enemyShip->activeDet[ P->ID ] = tick;
}

P->contactACTGlobal[ loop2 ] = tick; //all ships in this taskforce are detected
}
}//end if all detected

if( noDet == 0 && allDet == 0 ) //the larger ships are definitely detected, smaller ones may not be
{

sortList *aDet = tfListGlobal[ loop2 ]->aTail;
while( aDet != NULL )
{
ship *enemyShip = tfListGlobal[ loop2 ]->tfShipList[ aDet->index ];

if( enemyShip->activeDet[ P->ID ] != tick ) //this ship is already detected
{
shipSig = enemyShip->TCS;

shipSig = shipSig - 1;
if( shipSig > 499 )
shipSig = 499;

shipDet = getActiveDetectionRange( P->TFList[ loop ]->activeQue[ P->TFList[ loop ]->tfLookUpST[ shipSig ] ], shipSig, 0);

if( dist <= shipDet )
{
enemyShip->activeDet[ P->ID ] = tick;
}
else //once again, if this ship is not detected, but a smaller one is, then it would stand to reason that this ship would also be detected by that sensor.
{
break;
}
}
aDet = aDet->next;
}//end while
}//end if some detected
}//end if contactACTGlobal = tick

In this 1st picture, I have 32 players, 10 taskforces per player, and 7 ships per taskforce, I can do ~40fps with this happening every 16 ms.
http://imageshack.us/f/10/stress1h.jpg/

printing strings is horridly painful though.
http://imageshack.us/f/14/stress2e.jpg/

So I have working mechanics for engines and sensors now, though I'll probably scale back the player/taskforce count in the future.
« Last Edit: October 06, 2012, 07:23:10 PM by Nathan_ »
 

Offline Nathan_

  • Pulsar 4x Dev
  • Commodore
  • *
  • N
  • Posts: 701
Re: Pulsar 4X
« Reply #89 on: October 03, 2012, 09:30:25 PM »
Alright, found a few bugs, and have a better display of the sensors working, its not 40fps, now its down to 20fps, but still, this is with some 2240 ships.

The dark blue tfs are the ones who are only being spotted by the EM from their one sensor craft, the dark green craft have that, and a few of their ships being spotted by sensors. The light green craft are all lit up on actives, and the yellow one is spotted on thermal as well as active(as well as the one sensor craft).