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.
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!