You can help CodeWalrus stay online by donating here. | New CodeWalrus | Old (dark mode) | Old (light) | Discord server
Administration Center

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Scipi

#1
Gaming / Re: Two (obscure) games I like
December 07, 2018, 02:43:03 PM
Quote from: TruDev on December 07, 2018, 03:56:28 AM
Shoutouts to @Scipi for having the protagonist as his avatar

Can confirm, OneShot is a great game :3
#2
Other / Re: Politics? Where's your dot? :)
March 22, 2017, 09:42:41 PM
I expected my self to be a bit more authoritative, but I'm not surprised with being left

#3
Tech, Science & IT / Re: Wonderful Software Bugs
March 08, 2017, 02:38:07 AM
I once played a game called Aurora and it had a really odd text bug where text was disappearing in tree lists in the GUI. The cause was a VB5 bug with touchscreen drivers that my drawing tablet had triggered.

We had a classic one at work recently. A library we developed was causing some really strange behavior. The application it was developed for would launch and run the library code fine, but would segfault sometime afterwards. We couldn't figure out what it was until one of us noticed we forgot a semicolon after a struct definition and the compiler thought its definition kept going. We didn't even get a warning about it, let alone a compile-time error. <_<
#4
Quote from: PT_ on February 01, 2017, 08:03:02 PM
My intention was that I have no problems with clickbaits (well, not 100% true), but the staff shouldn't make such topics, they are an example for the others
But this is just my opinion, don't mind me if you disagree.

Not everything need be distilled and serious all the time. ;) The core trait that makes CW (and Omnimaga, for that matter) successful is that we're inherently fun-loving and not very rigid. ^_^
#5
PC, Mac & Vintage Computers / Re: C++Builder
November 14, 2016, 08:36:22 PM
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.
#6
PC, Mac & Vintage Computers / Re: C++Builder
November 14, 2016, 08:19:25 PM
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.
#7
PC, Mac & Vintage Computers / Re: C++Builder
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.
#8
The only silver lining with Pence is that officially the VP's role is only to resolve tie-breakers in the Senate. But if anything happens to Trump, it'll be Pence who we get as President.
#9
Quote from: p2 on November 10, 2016, 10:15:33 AM
it has begun...



But also:
Quote from: Putin"Russia is ready and wants to restore the full fledged relations to the United States. I repeat: we understand that this will be a difficult way but we are ready to play our part in it."

It's tragic, though I'm not surprised with the sheer emotional charging and fear mongering that went on with this campaign. What's worst is it seems the LGBT community doesn't have a whole lot to fear from Trump himself. On election night, his policies on LGBT rights (as well as Planned Parenthood) were removed. The Republican controlled house and senate might try something, but Trump seems unconcerned either way on the issue. At least on an official basis.
#10
Quote from: DJ Omnimaga on November 09, 2016, 04:57:54 PM
so hopefully he won't turn Canada and Europe into a dumping ground for deported Americans

That would be amazing, though. I'd let myself be deported at that point :P

QuoteSpoiler: Hillary Clinton crying

Clinton crying would imply she has a soul.

Jokes aside, I really am rather worried. Not really about Trump, but what people will do. I'm also worried about Pence.
#11
You don't call the KeyListener functions yourself, instead you register them with your canvas and they get called for you by the system when certain things happen.
Adding it looks something like this:

//...
frame.addKeyListener(keyControls);
//...
#12
Tbh, I really dislike how Java handles it's inputs. Asynchronous input handling means that program state could change at any point in the frame unpredictably.

Also, granted this is supposed to be a simple implementation, it won't work very well when gui's are thrown into the mix (because gui's should get priority handling of events and should be able to "consume" them to stop the event from propagating). I mention this only because it's the exact issue that stopped my progress on Walriimon ;)

I've been trying to find the time to put together a small demo of this for a while now, actually.
#13
Drawing & Animation / Re: Walrii fanart
October 24, 2016, 10:11:42 PM
Happy Birthday CW :3

#14
It wasn't for a serious program, but i had some really weird C code written for the old code golf competitions.

Back in the Game Of Life one, I decided I would write my entry for the GBA. Normally in the GoL, you'd have to implement a swap buffer. The front buffer would hold the previous GoL state while the program used it to build the next state in the back buffer. Then at the end of the frame, the buffers would be flipped and the new front buffer copied to the screen. This all ends up being a good chunk of code. And for Code Golf, that's obviously bad.

However, the GBA has a screen mode which splits video memory into two segments. On any one frame, one segment would be used for drawing the next frame while the other segment is displayed... Sound familiar? So in my GoL entry, I [ab]used video memory to serve as my GoL buffer. I read directly from pixels on the screen for my previous GoL state and read directly to the video backbuffer to generate my next state. Than I simply swap the buffers to increment the GoL sim and to display all in one.

Another weird thing I did was in a previous Code Golf where you had to read your own source file. As part of the program, I needed a concise way to check if I hit the end of the file. Normally, you'd do a comparrison against EOF like so:

i = getc(f);
while(i != EOF){
  //...
  i = getc(f);
}


This is waaay too verbose, though. For starters you have to duplicate i = getc(f);!
You can cut it down if you remember that in C, assignments have an implicit return value (so you can do things like a = b = c)
This turned the code into:

while((i = getc(f)) != EOF)
//...


Pretty good, right? But still not enough. Precedence rules make it so you have to waste two characters on parenthesis. I also wanted to get rid of the EOF comparison wholesale.
In the C standard, EOF is always -1. So by that, you can always add one to get 0, which is the value for false in C. Unfortunately, because we're changing every character that gets read, we have to revert it when we want to use it.

while(i = getc(f)+1) a[i-1]++;

However, this is still an extra 4 characters. I wanted to cut that down even further. It just so happens that -1 is 0xFFFFFFFF. Or all 1's in binary. So all I really needed to do was flip all bits and if the value was -1, it'll become 0. Fortunately, C has a bitwise operator for that: ~. So my final code became:

while(i=~getc(f))a[~i]++;
#15
PC, Mac & Vintage Computers / Re: Simple graphics in
October 22, 2016, 12:27:17 AM
Quote from: c4ooo on October 21, 2016, 10:48:56 PM
Quoteimport java.awt.*;
import java.awt.image.*;
import javax.imageio.*;
import java.lang.*;
import java.io.*;
import javax.swing.*;
Never import entire APIs O.O

That really shouldn't be a big issue. I'd expect the Java linker to be smart enough to only take the classes it needs from the API. It might only slow down compiling to bytecode, at worst.
Website statistics


MyCalcs | Ticalc.org | Cemetech | Omnimaga | TI-Basic Developer | MaxCoderz | TI-Story | Casiocalc.org | Casiopeia | The Museum of HP Calculators | HPCalc.org | CnCalc.org | Music 2000 Community | TI Education | Casio Education | HP Calcs | NumWorks | SwissMicros | Sharp Calculators
Powered by EzPortal