• Create Account

Member Since 13 Jun 2001
Offline Last Active May 21 2016 04:24 PM

### #5254124Intersect ray with heightmap

Posted by on 26 September 2015 - 06:36 AM

You can  use the Bresenham algorithm to check which cells to test.

https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm

### #5251613Sort unit vectors clockwise

Posted by on 10 September 2015 - 03:44 PM

1. Store them in 4 buckets for each quadrant by comparing the x and y sign.

2. calculate each tangent y/x

3. sort by tangent using your favorite sorting algorithm

4. combine quadrant buckets in clockwise order

### #5247837Structure of object-to-object interaction? (And other questions!)

Posted by on 20 August 2015 - 05:24 AM

I think these types of mutual interations are better handled through a mediator.

Creature::attack() {
world.attack(this, enemy, AttackType::MELEE_ATTACK);
}

World::attack(Creature attacker, Creature enemy, AttackType type) {
attackHandler = attackHandlers.get(attacker, enemy, type);
if (attackHandler) {
attackHandler.doAttack();
}
else {
// No AttackHandler found for interation between attacker and enemy
}
}

MeleeAttackHandler::doAttack() {
if (attacker.att > enemy.def) {
enemy.applyDamage(max(0, attack.damage - enemy.shield));
}

if (badluck() > 0.1 && enemy.def > 8) {
attacker.applyDamage(10); // hurt your hand while punching enemy
}
}

This prevents your creatures from directly altering the state of the other creatures and allows you to add specialized attack handlers later on if you want to expand.
A similar system could also be used for other interactions between two or more entities, for example reacting to sounds made by a creature.

### #5242743Breaking out of a nested loop

Posted by on 26 July 2015 - 06:22 AM

Look ma! no breaks!

int i, j;

for(i = 0; i < 2; i++) {
for(j = 0; j < 10; j++) {
// if(i - 1 == j + 1) <- will be true for i==2 and j==0
}
}

seriously though, how often will you have a situation where you need a nested loop and break out on an arbitrary condition and continue work after the loop?

Smells to me like a violation of SRP.

Some possible solutions depending on the actual algorithm:

Factor out the loop into another function and just return instead of breaking

or calculate the terminating condition beforehand and adjust the loop boundaries

or collect the affected elements and iterate over all of them

### #5241383[Javascript] Securing properties from client-side tampering

Posted by on 19 July 2015 - 10:50 AM

Never trust a client. The server must be the single authoritative entity at all times. You can think about insanely complex measures to prevent client side cheating but in the end hackers will always find a way around that,

So basically what you are writing in your last paragraph is how it should be done. The client only sends its intention to do something to the server which in turn changes the game state after checking the validity of the player's requests.

In order to get around the problem of latency (player presses key but only starts to move after the server has sent a response) you can employ client side prediction techniques to mask the delay. Since you are building an RPG you can also think about game design changes that mask the delay. e.g: Show "progress bars" before executing a spell so the player just thinks the delay is actually part of the game. ;)

### #5241347Good C++ engines?

Posted by on 19 July 2015 - 05:11 AM

There's always the chance that an upate may cause problems. But IMHO you are exposing your system to more harm by not installing SP1 which came out in 2011(!)

### #5241343Good C++ engines?

Posted by on 19 July 2015 - 04:46 AM

I have Windows 7 Ultimate, how can I get that SP1 for windows 7 ?

Windows update

### #5238657What kind of games can I create with my 3 member team that someone may actual...

Posted by on 06 July 2015 - 02:20 PM

Realistically, your first game is most likely not going to be a (huge) success.

That's why it is important to not sink too many man-hours into this first project.

Your best bet would be to come up with a simple game, focussed on a single gameplay mechanic and polish that until it is ready for relasing.

Since you dont have artists on your team but still want to use advanced gfx features you should aim for the "abstract" art style.

Use basic geometric shapes but apply shaders that make them look interesting.

Prototype first, this lets you quickly see if your idea is fun to play at all. Do not spend too much time working on the details in the beginning!

Let your friends/family test the game, they might give you important feedback.

The most important thing really is to just start. Unity is such an amazing engine for quick prototyping that you can quickly hack something together and test your ideas.

Good luck!

### #5238565What kind of games can I create with my 3 member team that someone may actual...

Posted by on 06 July 2015 - 02:02 AM

I'm just a bit scared of devoting hundreds of hours to a game that no one will play

Solution: Don't devote hundreds of hours into a game that no one will play. Shrink the scope and devote tens of hours into a game that no one will play and learn from the mistakes for your next game.

### #5235900Code crashing when exiting if statement

Posted by on 20 June 2015 - 01:24 PM

Could be a crash inside the log function?

Anyway, did you run it with a debugger? Assuming visual studio, hit F5. It will build your program in debug mode and attach a debugger. When the program crashes you can pinpoint the exact location and look at the state of the variables to see what is going on.

### #5225894Small indie question

Posted by on 27 April 2015 - 01:10 PM

What would be the alternative to spending the \$200?

Spend nothing: Your game will not be released.

Spend 100\$: Release the game without music?

Also, the \$100 for iOS development is an annual fee. The \$25 for android is a one off payment.

Before releasing though, make sure that your game is as polished and bug free as possible.

Also, if you want to make a profit and not just release it for fun you will have to make your game known. The chance of an app becoming successful without any advertising is virtually zero. Games like flappy bird are a very very rare exception.

### #5216919Names for a "Death Star"

Posted by on 16 March 2015 - 03:03 PM

Doomball

### #5216341Starting fresh

Posted by on 13 March 2015 - 03:31 PM

Don't set everything in stone.

Be open to criticism.

Don't withhold information from your team. (within reason)

Actually this works from the other side too

Demand changes if neccessary.

Criticise unoptimal behaviour early and fairly.

Inform yourself regulary on what's going on.

Also: Don't be a dick.

### #5214805Texture atlas generator

Posted by on 05 March 2015 - 01:26 PM

we use TexturePacker https://www.codeandweb.com/texturepacker

It is a great tool but not free. (€39.95)

### #5213304Having trouble harnessing the power of Inheritance. (best practices advice re...

Posted by on 27 February 2015 - 06:57 AM

I don't quite understand why you say this. I'm familiar with inheritance vs composition, and IS-A vs HAS-A. It seems to me that this is clearly an IS-A situation.

The problem is that you use IS-A in the way we normally use the term in natural, spoken language. However in OOP the term has very specific meaning. I personally blame bad teachers for this misunderstanding, as inheritance is often taught with contrived real world examples that never actually occur in real software projects. (Plant-Flower-Tree-Bush for example)

Make yourself familiar with the Liskov substitution principle. This should be the benchmark to decide wether you should use inheritance or composition. As a general rule of thumb: When in doubt, use composition.

PARTNERS