Code check: crashes, errors, and game methods

Non-platform specific questions.

Code check: crashes, errors, and game methods

Postby DST » Wed Apr 02, 2008 10:19 pm

(a long read....but if you're pulling out your hair with errors then it might be worth your time!)

Many of us are having crashing problems, artifacts, sound problems and problems with actors not
doing what they are told.

In the interest of collaborating our efforts in solving these problems, I'm starting a crash
thread for code and game setup to help avoid these.

I have found, and maybe you have too - that when you make a simple game, it works almost
exactly the way you thought it would. Sometimes you have to rewrite something that doesn't, but
for the most part you can make a simple fun game in an hour, and it works great.

But when you make a complex game...and you start changings things based on variables, crashes and
errors occur much more frequently. Things don't work the way you thought they would. So you try them
different ways...and sometimes it works...but sometimes it doesn't.

And when you read the forums for problems others are having, you get lots of posts that are not
really programming or GE errors, but instead they are system-related erros,
which no one in the forum can really fix because no one else but you owns a radeon 8920se on a via1020
chipset, and we can't viruscan your computer for you, or check every dll file on your system
for version.

If you are having unexplainable crashing errors, and you can't get help in the forum,
TEST YOUR SYSTEM FIRST! Install GE on another pc and try it again. Have a friend export the exe for you.
POST YOUR GAMES when you need help. That will help eliminate many possible causes of the errors, namely,
what our junky hardware running junky windows causes.

Often, when it is a simple code error, other forum users will post the proper code. Problem solved.
I always love to see this, thanks to all the ppz who help!

Now for the ones that just don't make any sense:

Sometimes the help posts claim that it's GE's fault, and you should wait for an upgrade, or that's
just how its going to be, or everyone gives up on it.

I'm not questioning the authenticity of that advice; but I don't believe it is the last answer.

Here is what I think, and why I'm starting this thread:

Even if it is GE's fault, or the fault of the current windows libraries, given the simple/complex
game scenario I mentioned earlier, there are ways around these errors. There are methods that
will work even if your game isn't working now.

I'm suggesting that the first and foremost cause of errors is GAME STRUCTURE. Not only the
start/play/end loops, but the kill/healthmeter/die loops, and the die/eventenable/etc loops. All
of the loops. There are certain ways of setting up a game that are doomed from the start, and
according to Hilbert's tenth problem there is no way of predicting all of them. Look up Hilbert's
tenth problem on the wiki if you want to know more.


So what I want to do here discuss and post our game methods and structures, and check them against
the methods of the more experienced programmers here. Try to find exactly where in the script the problem occurs.


I think some of these distinctions are important:

If a player moves by +x/-x are the results of collisions different than if a player moves by xvelocity?

If a player collides with "Any Actor" and then executes a switch or if command, isn't it different than if a player
collides with each actor specifically and has a specific command for that collision?

If a player can die from a collision, is it different than if a player can die in a Draw Actor Event?

For instance: Player1>Collision>someactor>
Code: Select all
if (health > 0){
health-=1;

 if health <= 0){
Destroy Actor(EventActor);
}

<<-- Is this possible? It seems to work. Is is wrong? I don't know. Should that be a Draw Actor Event?

No one is going to sort thru someone else's complex script looking for things. So the best I can figure
is to state the most important scripts, the ones that I use over and over and over, and if anyone
sees something that doesn't make sense, explain what they would do in that situation. Hopefully, over time,
we can all develop our sense of game structure and cut our errors down dramatically.


Here is my typical game structure:

Weapon and collision damages are all based on if commands, with nested switches,
Such as 'if collide.cancollide, followed by switch (player1.lookdirection)' <- can I nest like that?

Enemies spawn at startup, but do not activate until hitting the Activation actor (a little larger
than view, wireframe, and parented to view). <- should there be 'god' actors spawning enemies instead?

Most actors die by
Code: Select all
if (health <= 0){DestroyActor("Event Actor");}

in their Draw Actor Event. <- is this the correct way?

Many also have a collision with a deathactor offscreen, rather than using 'out of vision'.
This keeps them alive if their paths take them out of view momentarily.

When they die, most actors 1. play a sound and 2. create a death animation actor(explosion).

Some actors pass activation events upon their deaths, and others change variables such as score, or
another enemy's velocity or angle.

Some cloned actors create a global numbercount for them, and when they
are all dead and the number count is 0, the boss actor moves to the view. Now this was
called by boss's Draw Actor Event.
Code: Select all
if (numbercount <= 0){xvelocity = -4;}


Some actors are made up out of multiple actors, parented to a single one, and only one of them is allowed
to collide with player1's weapons, it deals out damage for the whole group of actors, and also takes
care of their destruction.

Now I have all sorts of problems, from enemies respawning, to the exe file crashing, to enemies
who won't animated even though their brother enemies animate the same way just fine.

All I want to know is....is there something I keep doing that I shouldn't be?
Is my syntax worth a crap?
Is
Code: Select all
if (collide.cancollide == 1){do this}

the correct way to write that?

Can I use a global integer several times at once as a random?
Code: Select all
burstangle=rand(360);

This code occurs in multiple clones all running the same timer.

And what does the code
Code: Select all
DestroyActor("Event Actor");

actually do?

Is this a Normal Cpuspike? The blue arrow indicates the start of the game. The red arrow
marks the moment when the screen goes black and the windows error message comes up.
cpuspike.jpg



About this Thread:

I may not be explaining things properly. If you have suggestions, please post them.
Especially if I have made this too complex for non-native english speakers to understand.

If you have suggestions about how a proper game setup should be, please post them, or
refer us to demos/urls that help explain these things. (thank you Jazz e Bob for the demos, you
definitely know how to structure a game properly!)

Thanks for reading!
Last edited by DST on Thu Apr 03, 2008 1:17 am, edited 1 time in total.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Code check: crashes, errors, and game methods

Postby makslane » Wed Apr 02, 2008 10:54 pm

Great post, thanks!
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: Code check: crashes, errors, and game methods

Postby j2graves » Fri Apr 11, 2008 2:48 pm

makslane, u may want to make this a sticky topic. that way people won't keep coming here and asking about the stuff mentioned.
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: Code check: crashes, errors, and game methods

Postby j2graves » Sat Apr 12, 2008 3:47 pm

I c u took my advice =D
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: Code check: crashes, errors, and game methods

Postby Lexcondran » Fri Aug 01, 2008 1:58 am

Ive learned one how to solve one of GE's main prblems. The wall issue. ITs actually simple and requires the physical esponse. Use the collison event//then choose physical response as the action//Make the action repeat---Set the info
like this to make the wall work//Specify==1--1--0--1 are the four 's to be used.
http://www.mediafire.com/?e4zzycilztdm1qm =My RPG APP FILE V. 3.0 {7/15/2010}
http://www.mediafire.com/?tjjmmmkzyga =My editable demo of my Rpg for people V2.3
viewtopic.php?f=6&t=10247 =Link to my RPG's (4.0) Topic =]
User avatar
Lexcondran
 
Posts: 230
Joined: Thu Jul 31, 2008 6:09 pm
Location: Tucson, Arizona, USA
Score: 8 Give a positive score

Re: Code check: crashes, errors, and game methods

Postby DST » Fri Aug 01, 2008 11:34 pm

Lexcondran wrote:Ive learned one how to solve one of GE's main prblems. The wall issue. ITs actually simple and requires the physical esponse. Use the collison event//then choose physical response as the action//Make the action repeat---Set the info
like this to make the wall work//Specify==1--1--0--1 are the four 's to be used.


That's not a problem. That's how you do physical response, the normal, proper way. It has nothing to do with this topic.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Code check: crashes, errors, and game methods

Postby Zivouhr » Thu Jun 19, 2014 3:28 pm

Interesting topic, thanks DST.

My two current challenges to figure out in a large, open map side scroller adventure platformer; 86 MB game:

1. 12 items to collect to unlock the door for each Tomb. Most times, when the player hits the Activation Event item, it registers with the Door (which is set to accept ALL ACTORS and perform the action of disappearing so you can get the key inside the door.

The problem is, on random playthroughs, sometimes the item Activation Event won't detect the player collision, and if you miss a single item, the door won't open because it depends on All 12 Actors for the activation event to work. Since there is no default way to set a minimum number of how many items can be accepted for the door to open, it's all or nothing because of this random error.

Example:
Hit all 12 items in a tomb, but on the 5th item, no sound was heard (meaning it didn't register the activation event), the item disappears, but then when you get the 12th item, the door doesn't open and there is nothing you can do but to exit the tomb and restart it all over again because of an error. :o

The bigger the game got, the more this problem cropped up, compared to the first Tomb created, which ran perfectly with the same exact activation event set up. Because of this inconsistency, I had to compromise with some designs of the game, and add in a fail safe trigger so if you leave the tomb without opening the door, all of the items reset and reappear so you can make the attempt again to the frustration of the gamer, who wasted their efforts collecting all 12, only to see one of the items didn't register as it should have.
The original goal being once you got the door open, nothing reappears.

I can't think of any other way to go about this at the moment. Maybe I should avoid activation events and try to come up with a more consistent method?

EDIT: I noticed that certain activation events, once deleted and reattached, in larger files, begin working again, while until that was done, the adjustment of coding had no effect it seemed. I have much to learn so this is still inconclusive as to why certain events don't always work.

One thing to be sure of, is try not to include any "Destroy Actor" events for the item being collected with an activation event attached to it or distributed by it. Once I eliminated the Destroy actor and made it invisible instead, the results were much more consistent. Thanks.
City of Rott Game created on Game Editor http://cityofrott.wordpress.com/
User avatar
Zivouhr
 
Posts: 549
Joined: Sat May 17, 2014 2:12 pm
Score: 59 Give a positive score

Re: Code check: crashes, errors, and game methods

Postby Goomba » Tue Sep 16, 2014 2:04 am

I got a problem, whenever I load a png in it crashes.... (version 1.4)
Batman can't be killed - setosorcerer
he can only be neutered... - ASFJerome
User avatar
Goomba
 
Posts: 220
Joined: Wed Apr 25, 2012 2:55 am
Location: Beyond time and space...
Score: 7 Give a positive score

Re: Code check: crashes, errors, and game methods

Postby skydereign » Tue Sep 16, 2014 2:18 am

So you are saying it crashes when you try to load any png? Or is it one in particular? Sometimes if your png is corrupt this can happen. What happens if you load a game that had a png in the game? Does it still crash? I'll need more information than "I load a png in it crashes" if I am going to be able to help you.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Code check: crashes, errors, and game methods

Postby Goomba » Tue Sep 16, 2014 1:20 pm

any png and I'm not sure if it happens with a game with a png in it...
Batman can't be killed - setosorcerer
he can only be neutered... - ASFJerome
User avatar
Goomba
 
Posts: 220
Joined: Wed Apr 25, 2012 2:55 am
Location: Beyond time and space...
Score: 7 Give a positive score

Re: Code check: crashes, errors, and game methods

Postby skydereign » Tue Sep 16, 2014 9:50 pm

Well, that's still not much to go on. I don't remember anyone else having this problem. What happens when you run it from the command prompt? Is there any error displayed when it crashes? When exactly does it crash? Also you might try redownloading gameEditor. If that doesn't fix it then there is probably something wrong with your computer setup. gE uses libpng which is pretty standard, and it is compiled into the gE executable so there shouldn't be any problems.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Code check: crashes, errors, and game methods

Postby Goomba » Tue Sep 16, 2014 10:14 pm

I dont knwo what to tell you except what I have already told you... I tried redownloading it but it still didnt work... gonna try the beta to see if that is any different
Batman can't be killed - setosorcerer
he can only be neutered... - ASFJerome
User avatar
Goomba
 
Posts: 220
Joined: Wed Apr 25, 2012 2:55 am
Location: Beyond time and space...
Score: 7 Give a positive score

Re: Code check: crashes, errors, and game methods

Postby skydereign » Tue Sep 16, 2014 10:23 pm

Goomba wrote:I dont knwo what to tell you except what I have already told you...

Have you tried this?
skydereign wrote:What happens when you run it from the command prompt? Is there any error displayed when it crashes? When exactly does it crash?

In some versions of gE it will give you some helpful output when it crashes if you run it from the command line. Also, for the when it crashes, does it crash as soon as you select the png image, or does it crash when you finish adding it by clicking add?
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Code check: crashes, errors, and game methods

Postby Goomba » Wed Sep 17, 2014 1:30 pm

when I finish adding it... And how do you run it from command prompt?
Batman can't be killed - setosorcerer
he can only be neutered... - ASFJerome
User avatar
Goomba
 
Posts: 220
Joined: Wed Apr 25, 2012 2:55 am
Location: Beyond time and space...
Score: 7 Give a positive score

Re: Code check: crashes, errors, and game methods

Postby skydereign » Wed Sep 17, 2014 10:57 pm

Goomba wrote:And how do you run it from command prompt?

I believe you can just open the command prompt and drag the exe into the window. I'm not on windows right now, but if that doesn't work, you can use the start command to run executables.
Code: Select all
start path/to/gameEditor/gameEditor.exe

The dragging the executable in should at least give you that path/to/gameEditor/gameEditor.exe completion.

Goomba wrote:when I finish adding it...

So gE does actually load the png in for you to edit the frames, it just won't let you actually add it to the game? Does this happen with a certain ged you have, or does it happen on even blank gE projects?
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Next

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron