Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / [STICKY] The Posting Competition

Author
Message
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 12th Jan 2015 02:12
You're no programmer. Arrays are absolutely vital. Code duplication should never be encouraged.
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 12th Jan 2015 02:40
Share the Indicium!

Also Page



Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 12th Jan 2015 02:56
You're giving terrible advice... I have no love to share for that.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 12th Jan 2015 02:58 Edited at: 12th Jan 2015 03:00
Mr. Valentine is doing that old approach where he says "OK, I'm allocating objects 100 through 500 for level data, objects 501 through 900 for particles, objects 1000 through 1400 for ammo etc.".

If you pre-define these ranges beforehand then for the most part you can actually make a game without using arrays. You just have to iterate using the correct for-loops.

However, Mr Valentine, this only works for stack based datasets. You haven't considered what happens when you suddenly delete an object in the middle of your collection.

What happens if you have created 100 plains, ranging from object 1 to 101, and then you decide to delete object 50. What happens then? How do you skip that object when you process collision? And what happens when you delete object 81, object 21, and object 56? And what happens when you need way more objects than only 100, but if you go over 100, you'll be colliding with the next object range for particles?

Take breakout for example, the game Yodaman is working on. When a ball hits a brick, you delete that object. There's no way around that.

So, most programmers sooner or later figure out that defining these ranges is a bad thing, and they discover that dynamically managing object numbers by using arrays is way more effective.

I like offending people. People who get offended should be offended. -- Linus Torvalds
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 12th Jan 2015 03:09 Edited at: 12th Jan 2015 03:11
IF OBJECT EXIST(X)
NEXT X

But I agree, if the number of objects being checked for is vast, it could be a while...

EDIT

Right... I meant...

FOR X = OBJECTSTART TO OBJECTEND
IF OBJECT EXIST(X)
ENDIF
NEXT X

Sorry I cannot think straight when someone is trolling... [not you TheComet]

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 12th Jan 2015 03:18
Did you know, though, that what you're doing is basically exactly how an array works. You're using the object's existence as a flag to see if a "slot" for an object is available or not.

I like offending people. People who get offended should be offended. -- Linus Torvalds
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 12th Jan 2015 03:32
he's not trolling, just disagreeing. as TheComet mentions the problem with this method is that it is inflexible and requires you to maintain foreknowledge of hard coded ranges. changes and management becomes ever more difficult.

to be honest, the only time I ever know what specific number an object or image is assigned is when I look back through debug logs. there is no need to ever manage or work with specific numbers in the code. the concept of 'object ID' should be more abstract so that you can just worry about what it represents instead of the specific value.

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 12th Jan 2015 03:45
Quote: "You're no programmer. "


I was talking about the Love he shares for others...

Quote: "there is no need to ever manage or work with specific numbers in the code. the concept of 'object ID' should be more abstract so that you can just worry about what it represents instead of the specific value."


Precisely!

Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 12th Jan 2015 04:02
precisely except I'm speaking in favor of dynamic arrays, this isn't really possible with predefined ranges

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 12th Jan 2015 04:24 Edited at: 12th Jan 2015 04:26
I'm speaking in favour of dynamic points. To be honest, the only time I ever know my specific number of points is assigned is when rnd128 runs his php script

I like offending people. People who get offended should be offended. -- Linus Torvalds
Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 12th Jan 2015 04:27 Edited at: 12th Jan 2015 04:31
I am speaking in favour of dynamic null points

YES I WON NULL POINTS!!!!!!!

Ah, also, I just lost the game.

Apparently, some believe that 'The Game' is officially over when the UK prime minister announces that on television. I think the Posting Competition should have something like this. The forum president should have power to announce when the Posting Competition is over.

Of course, this should start for the next forum president, not for us current presidents.

BTW, nonZero and I have been in super duper secret communication lately. He has been off the forums, since he has been busy leading the TGC military. The TGC military is currently waging war against TGD (The Game Destroyers).

Dar13
18
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 12th Jan 2015 04:35
Quote: " Sorry I cannot think straight when someone is trolling... [not you TheComet]"

No one is trolling. They are simply telling you that what you are proposing is not worthwhile. Your way is bad programming practice and considerably slower than a raw array. The OBJECT EXISTS() function iterates over a linked list to find if the array contains the object so you're performing an O(n^2) operation to discover if a specific object exists. While this is a trivial example, keeping performance characteristics like this in mind are important parts of programming.

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 12th Jan 2015 04:42 Edited at: 12th Jan 2015 04:47
My stolen points was that there was no need for such hateful commenting... I did not invalidate what he was saying though regarding the arrays...

I welcome constructive criticism, not pointless babble, I don't have time for hateful things or people...

I welcome an apology if he had not intended to offend/troll...

EDIT

And I repeat myself [Once more due to the same person], This is a forum, not a place to down talk anybody else... debating ideas, thoughts, opinions, not talking in a trashy manner, such a phrase is just a sign of ones self character, I would never say such a hurtful thing about anyone else, not even in a comedic manner.

Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 12th Jan 2015 04:46
Quote: "I welcome an apology if he had not intended to offend/troll..."
He doesn't need to apologize if he never intended to troll.

Nobody here is trying to put you down.

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 12th Jan 2015 04:48 Edited at: 12th Jan 2015 04:58
Quote: "He doesn't need to apologize if he never intended to troll."


I know, just pointing out my humour there

EDIT

But when something stupid is spoken by the same person more than once in such a manner, I simply must point it out to them so they can realise they are just being arrogant, stupendous and ignorantly hateful... I do not need to bother pointing out his history of such mannerism as he has never made any attempt to apologise and I need not bother either way, I just want to point out that he needs to think twice before posting... as is the unwritten rules here...

EDIT

Also...

Quote: "You're giving terrible advice... "


Could just say, I disagree with that idea, you could do it this way...

EDIT

If anybody disagrees with my view on life as being polite to each other, I kindly ask you to not communicate with me, even if I forget and respond to something you asked for help or I responded to your post, I have a policy on not keeping grudges for longer than a moment if at all... Trolls, keep laughing, I am getting on with life

The Zoq2
16
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 12th Jan 2015 11:11
Quote: "You will know which objects are for the boundaries, so you perform a check for those objects before a check for the bricks..."


But how do you keep track of what objects are the boundaries without an array. Are you saying that should be read from the ini file every time collision is checked or are you saying they should be stored in regular variables and then have the same code run many times like this?



That would be some extremley bad code because it's not expandable or anything. And reading and writing to an ini file would take ages compared to the collision check

Say ONE stupid thing and it ends up as a forum signature forever. - Neuro Fuzzy
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 12th Jan 2015 11:16 Edited at: 12th Jan 2015 11:17
Nope only storing the bricks data in the file, paddles and walls in code...



EDIT

Hmm forgot the project was done in AppGameKit, so nvm...

Yodaman Jer
User Banned
Posted: 12th Jan 2015 20:07
I am SOOOO close to getting the collision detection working. I don't think I'll need to cast any kind of ray as that's overcomplicating the problem.

My big issue seemed to be the way I was telling the computer to check the positions of the ball against the brick. I was using ball.x or ball.y to check, and what I SHOULD have been doing was getting the width+height of the ball with GetSpriteX() and GetSpriteY() and same for the bricks, and wah-la, suddenly the bricks started deleting correctly, one at a time, as they should be!

But the main problem I'm still having is getting the directions to reverse correctly, so I'm looking into using Vectors, which AppGameKit doesn't seem to have much documentation on...

I modified my code as such (yes, there are still some magic numbers but it's easier to see them that way the moment, once I figure out the right values they'll become a #constant):


The code for bouncing the ball back in the x direction works fine, but the y direction code seems to never get executed for some reason.

BUT I AM SO CLOSE I CAN TASTE IT


It's back, baby!
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 12th Jan 2015 20:36
Quote: "BUT I AM SO CLOSE I CAN TASTE IT"


Cream Cheese or Pickled Onion? Good Work dude! keep at it!

Next Person Gains Points++

Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 12th Jan 2015 20:54 Edited at: 12th Jan 2015 20:55
Really? Points.

Christ AppGameKit code is messy. Why is it in an elseif? Surely the X and Y need to be changed together and not one or the other?
Yodaman Jer
User Banned
Posted: 12th Jan 2015 21:13
Quote: "Surely the X and Y need to be changed together and not one or the other? "


Not if you want realistic looking angles. If I changed both together it would bounce incorrectly and be infuriating to the player.

I based that code off of code I saw somewhere, it is a bit messy but should theoretically get the job done just fine. However, it only handles the x movement, and if I split the blocks up it will reverse BOTH directions which is NOT what I want!

Does anybody have any tips? This is like six days in a row where this isn't working and it's driving me nuts.


It's back, baby!
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 12th Jan 2015 22:16 Edited at: 12th Jan 2015 22:27
Here, try something like this, its DBpro, but should convert to AppGameKit easily enough.



Note though that on the collision if block, you only want to set the new heading, not calculate a new position as that effectively moves the back at double speed, with the new heading, it will get that new position on the next movement update at normal speed. It is here only to quickly check that the math had the intended result

Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 12th Jan 2015 23:42
Quote: "Not if you want realistic looking angles. If I changed both together it would bounce incorrectly and be infuriating to the player. "


Don't understand. Changing motion of more than one axis does not look unrealistic.
Yodaman Jer
User Banned
Posted: 13th Jan 2015 00:49


Look at the original Breakout game. If the ball bounces on the bottom of the brick, it will reverse the y direction so that it's going back down, but leave the x direction alone, to simulate angle in = angle out. How is that difficult to understand?

@Ortu:

I will give that code a shot once I convert it, thank you!


It's back, baby!
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 13th Jan 2015 02:05 Edited at: 13th Jan 2015 02:17
Quote: "Look at the original Breakout game. If the ball bounces on the bottom of the brick, it will reverse the y direction so that it's going back down, but leave the x direction alone, to simulate angle in = angle out. How is that difficult to understand?"


the ball is still going to move and change position in two axis though in this case, I think that's where the confusion is.

I think I get what you're doing now, but I think this complicates things as different angles of incidence will need different values for X speed and Y speed no? you are basically positioning the ball from the game boards frame of reference, such that the ball doesn't 'rotate' and move 'forward'in a new direction, it literally moves backwards.

my code above is considerably different in that it is more based on the balls frame of reference, it rotates its forward direction and positions itself using a single direction angle and speed

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 13th Jan 2015 05:43 Edited at: 13th Jan 2015 09:19

PROCRASTINATE = 1


EDIT

Here, have some fun...


____
____
____
____


Seditious
12
Years of Service
User Offline
Joined: 2nd Aug 2013
Location: France
Posted: 13th Jan 2015 06:56
Two selects? That would cause a syntax error.
Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 13th Jan 2015 06:59
Select two? That would cause an error syntax.

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 13th Jan 2015 07:29 Edited at: 13th Jan 2015 10:10
I thought something was wrong, I used the same list sequence as in the DBPro Help Documentation...

Corrected...

EDIT

BTW those are individual images >.<

Also, Oh nono, the first one is a reference in the text...

EDIT

Is Thraxas on moderation?

Anyway fixed it

Here, have some fun...


____
____
____
____


EDIT

Anybody else notice there are 600~ threads in the AppGameKit Showcase board?

budokaiman
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 24th Jun 2009
Playing: Hard to get
Posted: 13th Jan 2015 11:57
h

"Giraffe is soft, Gorilla is hard." - Phaelax
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 13th Jan 2015 12:18
BETA Forum is offline! The Next says it will be offline for some time and is working on a new one entirely!

EPIC!

Clonkex
Forum Vice President
16
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 13th Jan 2015 12:30
Quote: "Christ AppGameKit code is messy."


You meant clean, right?

Quote: "Is Thraxas on moderation?"


???

Quote: "BETA Forum is offline! The Next says it will be offline for some time"


Hooray!

Quote: "...and is working on a new one entirely!"


...not so hooray. Never been a fan of the beta forums because I like my current forums, and a full from-scratch rewrite will make the beta forums even more dissimilar to the live forums...

-----------------------------------------------------

Got some unexpected work on Monday, today and tomorrow. Yay for money to buy the parts to build my Arduino-powered custom-built quadcopter-that-I-have-no-idea-how-to-build!

Thraxas
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Feb 2006
Location: The Avenging Axe, Turai
Posted: 13th Jan 2015 12:48
Quote: "Is Thraxas on moderation"


I did one of my favourite tricks. I opened a thread, went and did some other stuff and then I replied to a post without refreshing the page first. So what I had written had already been said twice before... hours earlier.

So I deleted my post.
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 13th Jan 2015 13:02
I see!

Dark Java Dude 64
Community Leader
15
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 13th Jan 2015 14:24
Quote: "and a full from-scratch rewrite will make the beta forums even more dissimilar to the live forums"
You don't know this for sure.

Quote: "...not so hooray. Never been a fan of the beta forums because I like my current forums,"
I have never been a fan of beta either, but whoa, try to be a little more encouraging to TheNext eh? He is doing the best he can.

Quote: "I did one of my favourite tricks"
Yes! My favorite trick too.

Yodaman Jer
User Banned
Posted: 13th Jan 2015 17:25
Ortu, I tried your code but it doesn't seem to want to work very well, the ball keeps moving int he same direction even though it clearly hits the bricks. I tried modifying it but I think I messed it up even more


I think spending a week on this problem has shown me that I am not as good a programmer as I used to be


It's back, baby!
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 13th Jan 2015 17:45
Aw I hate being back on normal forums.
Ortu
DBPro Master
18
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 13th Jan 2015 17:51
I looked at the beta forums once or twice but mostly just kept using the main one

Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 13th Jan 2015 18:37
I'd gotten really used to the new layout.
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 13th Jan 2015 18:49
All those broken VIDEO tags...

The Zoq2
16
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 13th Jan 2015 18:58
I agree indicium, the betaforum layout felt a lot nicer. The text is so tiny on the regular.

Say ONE stupid thing and it ends up as a forum signature forever. - Neuro Fuzzy
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 13th Jan 2015 19:04
It feels so compressed.
Dar13
18
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 13th Jan 2015 19:33
I haven't been on the beta forums much at all. *shrug* I don't blame him for wanting to just re-do the whole thing. Hopefully it'll be close to the same feel.

Quote: " I think spending a week on this problem has shown me that I am not as good a programmer as I used to be "

Don't feel too bad, this is a tricky one. I ran into it myself on my breakout clone. I don't think I ever solved it so you're probably further along than me!

Yodaman Jer
User Banned
Posted: 13th Jan 2015 20:27
Quote: "Don't feel too bad, this is a tricky one. I ran into it myself on my breakout clone. I don't think I ever solved it so you're probably further along than me!"


I just can't believe that something that should be *that* simple is proving to be ridiculously difficult.

Also why does AppGameKit not have any kind of native Vector methods for 2D?!?! That would help me a TON.

I know i could make my own using Types and whatnot but it feels like a bunch of extra work. I'm really starting to consider using something like Unity for this game because it has those functions built in.


It's back, baby!
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 13th Jan 2015 20:37
Quote: "Also why does AppGameKit not have any kind of native Vector methods for 2D?!?! That would help me a TON. "


Really? Wow.
Yodaman Jer
User Banned
Posted: 13th Jan 2015 20:42 Edited at: 13th Jan 2015 20:46
Is there a reason you "sound" surprised like that? Of course vectors would help, it would make storing and modifying coordinates so much easier, and much much tidier.

For example, I hate doing things like this...

ball.x = someValue
ball.y = someValue

SetSpritePosition(ballSprite, ball.x, ball.y


When I could just do
ballPosition = someOtherVectorValue
SetSpritePosition(ballSprite, ballPosition.x, ballPosition.y)


It reduces the lines of code and makes it much more organized. And yet they only put in functions for 3D vectors, not 2D. Why that is, I have no idea.

Instead of sounding rather negative (and condescending) you could actually say something a bit more constructive than "Really? Wow."

Also if they had native vector methods I could use something like Unity's "reflect" method, which would make this SOO MUCH easier. *sigh* They like to frustrate me they do.

Ugh typos, I hate this keyboard


It's back, baby!
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 13th Jan 2015 21:14
Quote: "Instead of sounding rather negative (and condescending) you could actually say something a bit more constructive than "Really? Wow.""


Erm what? I'm wowing at the fact something that prides itself on 2D game development has no capability for vector math...
Yodaman Jer
User Banned
Posted: 13th Jan 2015 21:30
Oh, Ok I see now I misread your original post/tone. My apologies.

I'm just so frustrated with this I guess I'm reading too much into things!

But yeah, NO abilities for vector math at all, at least for 2D. Very frustrating, and the only way around it would be to create my own methods. However I am quickly losing interest in this and thus the motivation to continue on!

Although I might have gotten closer. Seems this mostly works but it still feels way too clunky.


It works great for the x direction, but as soon as the y direction block is approached it will either skip over it entirely, or reverse both directions even though the ball only hit the side of the block and not the top. Ugh.


It's back, baby!
Seditious
12
Years of Service
User Offline
Joined: 2nd Aug 2013
Location: France
Posted: 14th Jan 2015 01:20
Quote: "Also why does AppGameKit not have any kind of native Vector methods for 2D?!?! That would help me a TON. "


This is why you should be using C/C++/C#/Java/HTML/Any other modern programming language.
budokaiman
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 24th Jun 2009
Playing: Hard to get
Posted: 14th Jan 2015 02:18
Dig

"Giraffe is soft, Gorilla is hard." - Phaelax

Login to post a reply

Server time is: 2026-07-09 22:29:46
Your offset time is: 2026-07-09 22:29:46