The shoutbox is currently out of service. Join us on Discord instead.
You can help CodeWalrus stay online by donating here.

C++Builder

Started by kotu, November 09, 2016, 08:08:02 pm

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kotu

Does anyone use C++Builder? it is a mighty tool.

I still use Turbo C++ 2006 free edition which came with 100 years license

* kotu runs
SUBSCRIBE TO THE FUTURERAVE.UK MAILING LIST
http://futurerave.uk

kotu

SUBSCRIBE TO THE FUTURERAVE.UK MAILING LIST
http://futurerave.uk

Scipi

I hold that C++ builder is rather pointless. If you need rapid development with tools for potentially non-technical devs, you shouldn't be using C++. If you need precise power and low level memory access/optimizations you shouldn't be using a builder. Both halves of the tool are fine on their own, but there's really no use case for having both.




kotu

November 14, 2016, 05:31:40 pm #3 Last Edit: November 14, 2016, 07:43:29 pm by kotu
Quote from: Scipi on November 14, 2016, 04:09:25 pm
I hold that C++ builder is rather pointless.


6

*edit*
trying to edit this post, can't.  :thumbsup:


Did you think that the power / speed of C++ was somehow degraded by it having a visual form designer or something

:-|

Re. potentially non-technical devs, is this what you mean? --->


//---------------------------------------------------------------------------
void TTachGame::ProcessLeftClick(int PlayerID, int SqrX, int SqrY)
{
bool movedOrAttacked = false;
bool didNinjaMove = false;

int enemyID;
if (PlayerID == 0) enemyID = 1;
else enemyID = 0;

if (GetSelectedUnit())  // assume we are trying to move a piece
{
for (DWORD i = 0; i < GetSelectedUnit()->GetNumAvailableMoves(); i++)
{
TTachMove move = GetSelectedUnit()->GetMove(i);

if ((move.ToPosX == SqrX) && (move.ToPosY == SqrY))
{
if (move.MoveType == TMT_STANDARD)
{
// this could be a move or an attack!!

if (move.Attack || FormMain->Cursor == crCross)
{

// we are attacking another piece!! YES!!!

bool queenTeleportAttack = false;

if ((GetSelectedUnit()->GetType() == TUT_QUEEN) && (FormMain->Cursor != crCross))
{
int dx = SqrX - GetSelectedUnit()->GetPosX();
int dy = SqrY - GetSelectedUnit()->GetPosY();
if ((dx <= 1) && (dy <= 1)) {
queenTeleportAttack = false;
}
else {
queenTeleportAttack = true;
}
}

TTachUnit* enemyUnit = m_Players[enemyID].GetUnit(SqrX, SqrY);  //

// check for queen wish attack
if (FormMain->Cursor == crCross)
{
if (enemyUnit) enemyUnit->GetQueenWishAttacked(*GetSelectedUnit(), 2.5f);

TTachUnit* u = m_Players[enemyID].GetUnit(SqrX-1, SqrY);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 2.0f);
u = m_Players[enemyID].GetUnit(SqrX+1, SqrY);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 2.0f);
u = m_Players[enemyID].GetUnit(SqrX, SqrY-1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 2.0f);
u = m_Players[enemyID].GetUnit(SqrX, SqrY+1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 2.0f);
u = m_Players[enemyID].GetUnit(SqrX-1, SqrY-1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 1.0f);
u = m_Players[enemyID].GetUnit(SqrX-1, SqrY+1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 1.0f);
u = m_Players[enemyID].GetUnit(SqrX+1, SqrY-1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 1.0f);
u = m_Players[enemyID].GetUnit(SqrX+1, SqrY+1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 1.0f);
FormMain->Cursor = crDefault;

m_Players[0].PurgeDeadUnits();
m_Players[1].PurgeDeadUnits();
movedOrAttacked = true;
break;
}

if (enemyUnit)
{
if ((enemyUnit->GetType() == TUT_KING) && (GetSelectedUnit()->GetType() == TUT_PAWN))     // check for single move checkmate
{                                                                                         //  ] END OF GAME [
FormMain->DeclareEndOfGame(false, GetCurrentPlayer()->GetName());
movedOrAttacked = true;
break;
}
else if (queenTeleportAttack) {                      // check for queen teleport attack
enemyUnit->GetTeleportAttacked(*GetSelectedUnit());
}
else {                                              // check for all other TMT_STANDARD attacks
enemyUnit->GetAttacked(*GetSelectedUnit());   // this is where most of the attacks happen
}

if (m_NumNinjaMoves > 0) {
m_NumNinjaMoves--;
didNinjaMove = true;
}

m_Players[0].PurgeDeadUnits();
m_Players[1].PurgeDeadUnits();
movedOrAttacked = true;
break;
}
}
else
{
/// this is just a move.

GetSelectedUnit()->MoveToPos(SqrX, SqrY, this);
if (m_NumNinjaMoves > 0) {
m_NumNinjaMoves--;
didNinjaMove = true;
}
movedOrAttacked = true;
break;
}
}
else if (move.MoveType == TMT_BOMB)
{
// bomb the square
//...

TTachUnit* enemyUnit = m_Players[enemyID].GetUnit(SqrX, SqrY);

if (enemyUnit)
{
enemyUnit->GetBombed();
m_Players[enemyID].PurgeDeadUnits();
}
FormMain->BombNoise();
movedOrAttacked = true;
break;
}
}
}
}

if (movedOrAttacked == false)  // assume we are trying to select something else
{
if (m_NumNinjaMoves == 0) {
SelectUnit(SqrX, SqrY);
}
}

//-----------------------------------------------------

// CHECK FOR THE OTHER END OF GAME STATES  (THERE IS ONE ABOVE) //

// check for dead king

if (m_Players[enemyID].KingIsDead()) {
FormMain->DeclareEndOfGame(false, GetCurrentPlayer()->GetName());
}

// check for K vs K draw

if (m_Players[0].OnlyKingIsLeft() && m_Players[1].OnlyKingIsLeft()) {
FormMain->DeclareEndOfGame(true, "");
}

// check for KQ vs K win

if (m_Players[0].OnlyKingIsLeft() && m_Players[1].OnlyKingAndQueenAreLeft()) {
FormMain->DeclareEndOfGame(false, m_Players[1].GetName());
}
else if (m_Players[1].OnlyKingIsLeft() && m_Players[0].OnlyKingAndQueenAreLeft()) {
FormMain->DeclareEndOfGame(false, m_Players[0].GetName());
}

//-----------------------------------------------------
// hand control to next player
if (movedOrAttacked)
{
if (didNinjaMove && m_NumNinjaMoves > 0)
{
if (FormMain->Menu_BlackBoxEnabled->Checked) {
FormMain->SaveBlackboxData();
}
}

// SEND GAME TO OTHER PC (NETWORK) HERE

RandomlyAddPowerup();
IncrementNumMoves();
FormMain->SendMove();


//----
if (m_NumNinjaMoves == 0)
{
HandControlToNextPlayer();
//FormMain->SendNextPlayer();
}
}
}
//---------------------------------------------------------------------------


(don't)
SUBSCRIBE TO THE FUTURERAVE.UK MAILING LIST
http://futurerave.uk

Scipi

November 14, 2016, 08:19:25 pm #4 Last Edit: November 14, 2016, 08:20:59 pm by Scipi
Quote from: kotu on November 14, 2016, 05:31:40 pm
Quote from: Scipi on November 14, 2016, 04:09:25 pm
I hold that C++ builder is rather pointless.


6

*edit*
trying to edit this post, can't.  :thumbsup:


Did you think that the power / speed of C++ was somehow degraded by it having a visual form designer or something

:-|


Not necessarily, just that when you have compiler generated code like that you lose a lot of information and control over how your program is running and the state of the system. These are things you generally want to know about when using C++ at a low-mid level. And if you don't need to work at that level, why are you using C++? A gui builder is more in the domain of designers anyways. And C++ is not at all a design language.

Really, it's a better paradigm to use a 3rd party library for your gui stuff if you need a C++ powered gui system.

1. You retain control over your main. Which means you retain control over the entire scope in which your program operates.
2. You dictate the scope in which the gui system operates, not the other way around. So you want the gui to only operate for a certain time slice? Go for it. You want to determine when in your program the gui runs? You can do that. Want to have a say over the gui working in a single thread or in multiple threads? Totally within your power.
3. You're not locked into one gui system. If a gui library doesn't have a feature you really need, you can switch out to another one. C++ Builder locks you into their system (and if you choose not to use it, what's the point of C++ Builder anyways?)
4. You have the option to offload the gui system to a scripting language more suited to the task, like python or lua. That way your non-tech designers can work with design-friendly languages while your tech engineers support them with C++ engine stuff. Example of this workflow: Unreal Engine.
5. You're not limited in how you want to architect your code.




kotu

Nothing to say really

(apart from the VCL)
SUBSCRIBE TO THE FUTURERAVE.UK MAILING LIST
http://futurerave.uk

Scipi

Quote from: kotu on November 14, 2016, 05:31:40 pm
Re. potentially non-technical devs, is this what you mean? --->


//---------------------------------------------------------------------------
void TTachGame::ProcessLeftClick(int PlayerID, int SqrX, int SqrY)
{
bool movedOrAttacked = false;
bool didNinjaMove = false;

int enemyID;
if (PlayerID == 0) enemyID = 1;
else enemyID = 0;

if (GetSelectedUnit())  // assume we are trying to move a piece
{
for (DWORD i = 0; i < GetSelectedUnit()->GetNumAvailableMoves(); i++)
{
TTachMove move = GetSelectedUnit()->GetMove(i);

if ((move.ToPosX == SqrX) && (move.ToPosY == SqrY))
{
if (move.MoveType == TMT_STANDARD)
{
// this could be a move or an attack!!

if (move.Attack || FormMain->Cursor == crCross)
{

// we are attacking another piece!! YES!!!

bool queenTeleportAttack = false;

if ((GetSelectedUnit()->GetType() == TUT_QUEEN) && (FormMain->Cursor != crCross))
{
int dx = SqrX - GetSelectedUnit()->GetPosX();
int dy = SqrY - GetSelectedUnit()->GetPosY();
if ((dx <= 1) && (dy <= 1)) {
queenTeleportAttack = false;
}
else {
queenTeleportAttack = true;
}
}

TTachUnit* enemyUnit = m_Players[enemyID].GetUnit(SqrX, SqrY);  //

// check for queen wish attack
if (FormMain->Cursor == crCross)
{
if (enemyUnit) enemyUnit->GetQueenWishAttacked(*GetSelectedUnit(), 2.5f);

TTachUnit* u = m_Players[enemyID].GetUnit(SqrX-1, SqrY);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 2.0f);
u = m_Players[enemyID].GetUnit(SqrX+1, SqrY);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 2.0f);
u = m_Players[enemyID].GetUnit(SqrX, SqrY-1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 2.0f);
u = m_Players[enemyID].GetUnit(SqrX, SqrY+1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 2.0f);
u = m_Players[enemyID].GetUnit(SqrX-1, SqrY-1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 1.0f);
u = m_Players[enemyID].GetUnit(SqrX-1, SqrY+1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 1.0f);
u = m_Players[enemyID].GetUnit(SqrX+1, SqrY-1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 1.0f);
u = m_Players[enemyID].GetUnit(SqrX+1, SqrY+1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 1.0f);
FormMain->Cursor = crDefault;

m_Players[0].PurgeDeadUnits();
m_Players[1].PurgeDeadUnits();
movedOrAttacked = true;
break;
}

if (enemyUnit)
{
if ((enemyUnit->GetType() == TUT_KING) && (GetSelectedUnit()->GetType() == TUT_PAWN))     // check for single move checkmate
{                                                                                         //  ] END OF GAME [
FormMain->DeclareEndOfGame(false, GetCurrentPlayer()->GetName());
movedOrAttacked = true;
break;
}
else if (queenTeleportAttack) {                      // check for queen teleport attack
enemyUnit->GetTeleportAttacked(*GetSelectedUnit());
}
else {                                              // check for all other TMT_STANDARD attacks
enemyUnit->GetAttacked(*GetSelectedUnit());   // this is where most of the attacks happen
}

if (m_NumNinjaMoves > 0) {
m_NumNinjaMoves--;
didNinjaMove = true;
}

m_Players[0].PurgeDeadUnits();
m_Players[1].PurgeDeadUnits();
movedOrAttacked = true;
break;
}
}
else
{
/// this is just a move.

GetSelectedUnit()->MoveToPos(SqrX, SqrY, this);
if (m_NumNinjaMoves > 0) {
m_NumNinjaMoves--;
didNinjaMove = true;
}
movedOrAttacked = true;
break;
}
}
else if (move.MoveType == TMT_BOMB)
{
// bomb the square
//...

TTachUnit* enemyUnit = m_Players[enemyID].GetUnit(SqrX, SqrY);

if (enemyUnit)
{
enemyUnit->GetBombed();
m_Players[enemyID].PurgeDeadUnits();
}
FormMain->BombNoise();
movedOrAttacked = true;
break;
}
}
}
}

if (movedOrAttacked == false)  // assume we are trying to select something else
{
if (m_NumNinjaMoves == 0) {
SelectUnit(SqrX, SqrY);
}
}

//-----------------------------------------------------

// CHECK FOR THE OTHER END OF GAME STATES  (THERE IS ONE ABOVE) //

// check for dead king

if (m_Players[enemyID].KingIsDead()) {
FormMain->DeclareEndOfGame(false, GetCurrentPlayer()->GetName());
}

// check for K vs K draw

if (m_Players[0].OnlyKingIsLeft() && m_Players[1].OnlyKingIsLeft()) {
FormMain->DeclareEndOfGame(true, "");
}

// check for KQ vs K win

if (m_Players[0].OnlyKingIsLeft() && m_Players[1].OnlyKingAndQueenAreLeft()) {
FormMain->DeclareEndOfGame(false, m_Players[1].GetName());
}
else if (m_Players[1].OnlyKingIsLeft() && m_Players[0].OnlyKingAndQueenAreLeft()) {
FormMain->DeclareEndOfGame(false, m_Players[0].GetName());
}

//-----------------------------------------------------
// hand control to next player
if (movedOrAttacked)
{
if (didNinjaMove && m_NumNinjaMoves > 0)
{
if (FormMain->Menu_BlackBoxEnabled->Checked) {
FormMain->SaveBlackboxData();
}
}

// SEND GAME TO OTHER PC (NETWORK) HERE

RandomlyAddPowerup();
IncrementNumMoves();
FormMain->SendMove();


//----
if (m_NumNinjaMoves == 0)
{
HandControlToNextPlayer();
//FormMain->SendNextPlayer();
}
}
}
//---------------------------------------------------------------------------


(don't)


That looks more the code of a naive or inexperienced dev rather than a nontechnical one. ;)

A nontechnical dev would be more along the lines of someone who has little to no knowledge of hardware and memory. They aren't able to do things like specify struct alignments, custom allocators, inline asm, specifying calling conventions, and all the other things C/C++ gives you control over. They're more along the lines of artists where they know in manipulating control flow and tweaking values to get things to look and feel the way they want.




kotu

November 14, 2016, 08:51:09 pm #7 Last Edit: November 14, 2016, 09:21:06 pm by kotu
that's fine

we'll end the discussion here if you like.


*edit*
to clarify this guy just got sacked from his job [obscene] <<_____ other,une  8)

I would say someone who had little or no knowledge of hardware and memory would be an inexperienced dev.  HARDCORE


*edit--*


Quote from: Scipi on November 14, 2016, 04:09:25 pm
I hold that C++ builder is rather pointless. If you need rapid development with tools for potentially non-technical devs, you shouldn't be using C++. If you need precise power and low level memory access/optimizations you shouldn't be using a builder. Both halves of the tool are fine on their own, but there's really no use case for having both.


im done
SUBSCRIBE TO THE FUTURERAVE.UK MAILING LIST
http://futurerave.uk

DJ Omnimaga

Personally I think it's a matter of preference.

p2

That's seriously a 100year licence...?  :ninja:
don't all copyrights void 25years after the author's death...?  ???
And do they seriously believe we weould still use that stuff in 100 years? OR are they just trolling us there?  <_<
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

DJ Omnimaga

It depends of the country I believe.

xMarminq_

Quote from: p2 on November 15, 2016, 12:33:21 pm
That's seriously a 100year licence...?  :ninja:
don't all copyrights void 25years after the author's death...?  ???
And do they seriously believe we weould still use that stuff in 100 years? OR are they just trolling us there?  <_<


You have to thank Walt Disney and its lobbyists for keeping the rights to Mickey Mouz for boosting it up that high.
But keep on track  :D
I don't associate with associations

p2

can't wait for someone going to yail for pirating a 99year old software ;D
but sadly won't see that happening anymore ._.
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

kotu

Quote from: p2 on November 15, 2016, 12:33:21 pm
That's seriously a 100year licence...?  :ninja:

i have 89 years and 10 months remaining on mine
SUBSCRIBE TO THE FUTURERAVE.UK MAILING LIST
http://futurerave.uk

p2

you should ask them fi you could split it up to use it on 100 devices for 1 year each ;D
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

Powered by EzPortal