Author Topic: RegalPrime-UnityEngine v1.4.1 - 8-18-15  (Read 31053 times)

RegalPrime

  • Wannabe
  • Posts: 37
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 37.0.2062.120 Chrome 37.0.2062.120
    • View Profile
  • Playstyle: Keyboard
Re: Unity Fangame Engine - 9-19-14 - Legit Cat Boss
« Reply #15 on: September 19, 2014, 06:27:31 PM »
- Game Uploaded and main post updated -

Wasnt sure how much I could get done with being gone, but after I started working on a boss, I found myself pushing hard to get it finished for todays release. This boss uses the object script Ive been working on for the past 2+ weeks and the HP module from a few weeks before that. Its a pretty legit boss, not that difficult (i guess I know how everything works so its a bit easier for me), but it shows that many of my scripts are working well and are useful.

Overall the creation of the boss went pretty smoothly. Some of the combination scripts I recently threw together need a bit more work.
- The boss could easily be a single animated object + any number of projectiles, but I wanted to stick 100% with using my object script
Screenshot of the boss
(click to show/hide)

Boss Info - This is how the boss was built and acts and thus contains spoilers.
Id prefer you test out the boss before reading what is below, but I know some are not interested in downloading a work in progress every week.
(click to show/hide)
« Last Edit: September 27, 2014, 02:20:31 AM by RegalPrime »

RegalPrime

  • Wannabe
  • Posts: 37
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 37.0.2062.124 Chrome 37.0.2062.124
    • View Profile
  • Playstyle: Keyboard
Re: Unity Fangame Engine - 9-27-14 - Generic Monster AI Scripting
« Reply #16 on: September 27, 2014, 02:11:52 AM »
Just a post update this week + a screenshot
The time it takes to bundle it up and make sure the game works every week takes some time, and I feel it wont hurt too many feelings if they cant download this every week (especially when the new content isnt very visible in game).

I felt it was time to make a screen via ripping the sprites from another game to see how it goes.
I took the spinny room from castlevania 4.
(click to show/hide)

It worked out fine but it needed monsters so I found a good castlevania sprite sheets and worked on creating simple prefabs + animation controllers for a few monsters (you can see which ones i made in the above screenshot in the lower unity window). Added in random spawn Medusa heads to the map for the section in the middle and it looks nice. Upon ripping the medusa stone shot animation, I added a bit to the GUY script to allow for easier addition of other types of shots.

After making a few monsters prefabs I made a simple AI for one (hopper monster), and then upon doing the next monster I found myself making a separate AI for it. It kind of felt redundant doing this for every monster every time so I started working on a generic monster AI that can be just added to any monster and have variables to set how they would act (more complicated monsters, like bosses, would need made-from-scratch scripts).

I figure I would need a melee type attacker script / shooter type script / and a flyer type script to deal with the basic types of monsters. All of these are tied into a generic animation controller so that the correct animations are selected automatically when the monster does a certain action.

Right now Im working on the basic melee type and have patrolling / move twords player / leap / attack at player all based on AoE range (all have variables that can be set in the editor to tell when / how fast / distance). This still needs a lot of work, but it should be useful later so I wont have to make so many similar scripts for every monster added.

Made a new walking animation for the pixel cat, kinda looks crappy because I did it pixel by pixel myself but it got the job done. Put my generic AI script on it and now i have a crazy cat following me everywhere :p I guess disabling the attack part of the AI makes it good for NPCs as well.

RegalPrime

  • Wannabe
  • Posts: 37
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 37.0.2062.124 Chrome 37.0.2062.124
    • View Profile
  • Playstyle: Keyboard
Re: Unity Fangame Engine - 10-5-14 - Monster AI Scripting - Week 2
« Reply #17 on: October 05, 2014, 03:17:38 AM »
Was really hoping to get a release update for this week going, but completing all the AI scripts just didnt happen.
Well, I mean they did get finished in the rough sense but I had no time to do some hardcore testing on how well it would hold up in different circumstances. Overall, the air based AI took a bit longer than the ground AI and I ran out of time.

A general overview of what the AI does and the variables that are editable on the gameobject
AttackRadius - Anything less than this distance the scripted object will attack the player. Default attack is a simple "leap at player" action.
PassiveRadius - Anything more than this distance the scripted object will enter in a passive state and start patrolling.
Any gap between the 2 radii causes the object to move towards the player.
Setting these variables would allow for passive mobs / patrolling mobs / following mobs / aggressive mobs / etc just by setting the different radius (dont want it to attack, then set attack radius to 0 / etc).

Has the option to jump up blocks if moving and one is in the way
MoveSpeed - The speed at which the object will move when trying to reach the player

PatrolArea - The distance on either side of the object it will patrol. If set to 0, the object will only turn around when it hits the wall or a drop off is in front of it
PatrolSpeed - The speed of the patroling object. If set to 0, the object will enter an idle state.

Default attack action variables
JumpSpeed - Speed of the jumping object
JumpPower - Jump power of the object
DelayBetweenJumps - The time between jumps

Shooting attack based variables
ShootWhenAggro - Selecting this will cause the object to shoot a preloaded gameobject forward when in attack range (this replaces the leap-at attack action)
ShootAtPlayer - Setting this to true, will shoot the projectiles at the player when in range
ShotSpeed - Speed of the shot
NumberOfShots - Number of shots per set
ShotDelay - Delay between each shot
ReloadDelay - Delay between each set of shots
ShotConstraint - The monster will only shoot when the player is within this constraint (think of it as being in the guns sight range). Being outside of it will cause the monster to move at the player.

The flying monster AI needed to be done in a separate script and took longer than I hoped.
The flying AI is similar to that of the ground based, but movement / dive attack is handled differently. Most of the other code had to be redone to deal with a flying based object.
The generic variables are mostly the same as the ground based AI and not worth listing again.

Finally figured how to reuse the generic animation controller I created (fleshed that out this week also, and I hope the logic holds up). Was able to RIP a sprite, create the different states (idle / attack / movement animations) and plug it into the generic animation controller and the script just made it work. No hassle / no mess. Going to have to go through the other sprites I made previously and update them. It is a lot easier to make fully functioning sprites now.

More coding to do, but I got a lot done.
If I get the AI cleaned up this week, I will try to not start something new and work on making a few maps to showcase the new monster AI types.

RegalPrime

  • Wannabe
  • Posts: 37
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 37.0.2062.124 Chrome 37.0.2062.124
    • View Profile
  • Playstyle: Keyboard
Re: Unity Fangame Engine - 10-10-14 - New Version 1.06 - AI and Stuff
« Reply #18 on: October 10, 2014, 06:18:28 PM »
1.06 Uploaded and main post updated
If you have some time, feel free to download and try out this new version.

Finally put the finishing touches on the ground / flying AI and worked making a few types of monsters prefabs.
- I grabbed a character who had flipping / shooting / walking sprites and used him for the ground AI test (from Majyuuou King of Demons)
- Added a death sprite for the kitty
- Added the Raven from castlevania 4 to use for the flying AI test

Since I had to make a new room to showcase the AI objects, I decided to grab a super mario world sprite sheet and use that (it looks pretty nice and was easy to add). I thought it would be hard to put all the AI monsters in the same scene and I didnt want to make a HUGE room to fit them all in either. I ended up making buttons that spawn the particular monster in the center of the scene when clicked. The 8 clickable options are shown on the screenshot below.

Screenshot of the new AI room
(click to show/hide)

I also added in the Castlevania 4 spinny room I created last week into the game (see previous weeks screenshot)

- Reordered a few scenes
- Im sure there was some other scripting stuff that came up and was changed

JGBMaster

  • Spike Dodger
  • Posts: 206
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 38.0.2125.101 Chrome 38.0.2125.101
    • View Profile
  • Playstyle: Keyboard
Re: Unity Fangame Engine - 10-10-14 - New Version 1.06 - AI and Stuff
« Reply #19 on: October 11, 2014, 07:11:49 AM »
Sick work you're making here, man! :D
Looking forward to see more of this engine :3
Twitch: https://twitch.tv/jgb_iw
YouTube: gamemastr97
Twitter: https://twitter.com/jgb_iw
Speedrun.com: https://www.speedrun.com/jgbmaster
Discord: JGB#1037

RegalPrime

  • Wannabe
  • Posts: 37
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 38.0.2125.104 Chrome 38.0.2125.104
    • View Profile
  • Playstyle: Keyboard
Re: Unity Fangame Engine - 10-18-14 - Version 1.06 - Tons of little things
« Reply #20 on: October 19, 2014, 12:07:18 AM »
Not going to release an updated game this week even though things look different.
Working on making all new maps and dont want to release it with only one completed (screenshot below).

Started cleaning up my list of smaller things to do since I got the AI script done last week.

Added in a game timer and death counter (game timer is only in seconds, no use calculating time every frame and I can change to minutes / hours / days during display later).
Worked on cleaning up the Gamecontroller script to incorporate the new items.
I wasnt going to mess with the file loading screen but I needed to add in death / game time, so I changed a few things.
Changed the File Selection screen to show deaths / timer. The labels and buttons scale based on screen size.
Was hoping the new GUI system would be released from Unity soon, but I shall wait some more.

Secret string added to the Gamecontroller to differentiate between save game files.
- Im not sure if this was the correct way to do this, but previously any save file would work no matter what I would do in the game (ie extremely generic save file)
- Now, there is a secret string added to the gamecontroller that it must match in order to load the data from a saved file.

Added to the Area modifier script to deal with movement speed change and other variables regarding triggering (move speed / jump / gravity / max fall speed / etc)
Searching around and I think I found the settings for water and I added those to the area modifier - water prefab.

Added code to allow for enabling / disabling of autofire.

Updated / redid the Objects via waypont script (used in moving platforms)
All of the platforms prefabs (both jumpthrough and sticky) have been updated and the triggers are more exact.

Added spawn bouncy object to the Object spawner script.

Warp in room script updated
- Warp in room changed to give the ability to keep the offset of enter / exit to allow this prefab to be used in screen-wrapping
- Previously, when the player entered the trigger they were spawned to the exact exit point no matter the point of entry.

Added the spike treadmill script / prefab (you know that, spike goes up / moves across the ground / then goes back into the ground thing)
- Has settings for speed / spike spawn rate. Starting point / Ending point are empty gameobject that can be placed anywhere.
- Can twist / spin the prefab any direction and it will work (ie, spikes going along the ground vs going up the wall is nothing more than rotating the parent object)
- Has the option for the movements to be based off of global / local transforms (global would make it so that the spikes always are facing up while local would be facing up relative to the parent objects current rotations).

Redid scene 3 that showcased the warp in room prefab (Screenshot below)
Those ninja star things spin (bottom middle ones spin along the y-axis and the right set spin along the z-axis)
(click to show/hide)

Previously, each of my scenes showcased a prefab in the simplest of ways. Redoing the room caused me to find an oversight in how one of my prefab was scripted.
So it seems I will be redoing all of these simple crappy rooms and making them a lot more complicated / harder.
My goal is to end up with around 20 screens of medium difficulty
- maybe 2 screen per important prefab
- So 2 dealing with the warp in room prefab, 2 dealing with water, 2 dealing with movespeed / jump trigger, 2 with traps, etc (just to test how they hold up)
- Im sure I might need more screens if the prefab is more complex

Add in the boss I made before and I guess I can release my first game with this engine.

It has been going through my mind that I might possibly somewhat kinda maybe think about getting close to doing a limited release of the engine to those who are interested.
Have been thinking about what I really need to finish up on in the engine. Much of the major items are complete.
Making a game myself using what I have built will give me a better idea.
- Even this week I have started going through and reordered / renamed scripts / prefabs to be more consistent. I also need to comment the scripts better.
- Also making a general use guide will take a bit of time as well (how the engine is setup overall).
- Im not in a hurry, but these are some things going through my mind.
« Last Edit: October 19, 2014, 12:11:38 AM by RegalPrime »

RegalPrime

  • Wannabe
  • Posts: 37
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 38.0.2125.111 Chrome 38.0.2125.111
    • View Profile
  • Playstyle: Keyboard
Re: Unity Fangame Engine - 10-28-14 - Version 1.06 - 1/2+ of new game done
« Reply #21 on: October 28, 2014, 03:19:44 AM »
Having fun working on the new game except when I hit writers block and cant think of how to design a screen :/
Other than that, doing some lighter scripting. A few objects didnt interact well with each other and I will have to deal with it sometime. I think I have the solution, but you never know if changing one logic will break something else later.

Spike treadmill updated more. Idea is still the same but it spawns the objects using their collider / hitbox (instead of the sprite size) when calculating the spawn offsets. This also makes it easier to place the prefab. Snap the prefab to the ground or ceiling and snap the start / end objects along the ground and the objects spawn perfectly.

Spike chopper script created. Its a simple script that makes an object slam to the ground then go back up. Has options for start delay / up-down speed / etc etc stuff

Started making object spawner script scripts (ie using my super script from a while ago to make secondary scripts extremely easily)
Color change script - Simple script that changes the color randomly of an object it is attached to. Also has the option to set the size of a color vector and set colors to spawn through (instead of randomly picking colors, you can configure it to loop through a specific set of colors. All of this is simply done through the editor). Also can use this vector and change the alpha to make a fade / unfade effect

I had quite a few oneshot spawners in my object spawner script and I created another script + prefab to use them more easily. The short of it is, if you need some object to spawn In a direction / at the player / a wavy line / a random spray / a directional spray / circle burst / single object follower / single object bouncy, you just drop this object into the editor, set the variables, and it works. Can have X sets or just constant spawns.

Reverse gravity (flip character) was added. Was pretty easy to put this in surprisingly. Has a weird interaction when you manipulate the guys stats (ie low gravity / +-speed / jump speed). I think I know the problem and put it on my list but for now, those wont be on the same screen lol.

I updated my time change script. Has options to increase / decrease the game speed over X time. Also has the option to maintain relative speed (ie even if the world speeds / slows, the character will still move the same). I just made a pretty crazy screen using this script, was really simple yet fun.

Im at ~15 Rooms created in the game so far. Not really sure how many more to go. My plan is to keep going until I run out of scripts / prefab (each different type of prefab will get a few screens). Kinda funny the more levels I make, I end up rewriting or adding parts to the script or making totally different one I wasn't planning on. Guess its a good thing though.

Screenshot ... maybe later.

RegalPrime

  • Wannabe
  • Posts: 37
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 38.0.2125.111 Chrome 38.0.2125.111
    • View Profile
  • Playstyle: Keyboard
Re: Unity Fangame Engine - 11-8-14 - Game so close
« Reply #22 on: November 08, 2014, 03:02:02 AM »
Hmm I feel bad not posting an update for so long. Ive been adding levels and doing minor scripting (a few oddities poped up)
Finally hit the point I figured I need to make my levels look better and I added lightning and shading. Then I put in backgrounds because I was sick of looking at that blue background.
Picked out some music that hopefully isnt awful :p (5 songs)

I think I hit the point where I dont need to showcase any new prefabs and Im at 36 real screens (there are other transition / simple screens that aren't worth counting. Unity says 44 screens total in the build). Sooo, where does that leave things? I am testing right now to deal with any big issues that may arise. Hopefully one of these playthroughs my OCD wont catch something. I can pass the game in ~40mins, so I suppose it would take others longer since they dont know the inner workings of the game.

After I get things settled, I will post the game here for anybody to test. I didn't go overboard on difficulty and hopefully it is "balanced."
This was more of a test on how the engine is working and it brought up a lot of oversight in certain scripts.

After that, the game will be released, then back to engine programming (and hopefully its release sometime thereafter).

Screenshot time. At the start of the week I updated the look of every screen.
Here is a 3xView of the transition for a climbing screen I did.
First screen was simple drag and drop stuff (typical basic guy screen)
Second, is the alternate sprites
Third is the shading / lighting (ya, you can pick up those torches).
(click to show/hide)


Game released
See first post for more information.
https://www.mediafire.com/download/k5r3hnyyp501or0/I_Wanna_Help_the_Cat.zip
« Last Edit: November 10, 2014, 02:34:18 PM by RegalPrime »

Zurai

  • Community Manager
  • Spike Dodger
  • Administrator
  • Posts: 170
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 38.0.2125.111 Chrome 38.0.2125.111
    • View Profile
  • Playstyle: Keyboard
Re: Unity Fangame Engine - 11-10-14 - I Wanna Help the Cat - Pre-Release
« Reply #23 on: November 11, 2014, 12:53:36 PM »
Im really interested on how this works out, loading the game right now and I will probably stream it a bit in a few hours. Feel free to tune in or check the VOD later if you want to
see someone playing through it :FrankerZ:
Stop by and say hello at www.twitch.tv/zurairofl :PogChamp:

BBF

  • Cherry Eater
  • Posts: 95
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 38.0.2125.111 Chrome 38.0.2125.111
    • View Profile
  • Playstyle: Keyboard
Re: Unity Fangame Engine - 11-10-14 - I Wanna Help the Cat - Pre-Release
« Reply #24 on: November 11, 2014, 03:51:57 PM »
I played it for a little bit and have to say...the movement feels REALLY weird. I thought it would control more like Boshy (with acceleration and stuff) but I even struggled to get past the first couple of screens.

The water section felt fine, except for the movement I just could not get used to.

The Torch effect is nice, not sure how I like the grabbing mechanic, not a fan of how they are implemented gameplay wise.

RegalPrime

  • Wannabe
  • Posts: 37
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 38.0.2125.111 Chrome 38.0.2125.111
    • View Profile
  • Playstyle: Keyboard
Re: Unity Fangame Engine - 11-12-14 - Information
« Reply #25 on: November 12, 2014, 02:42:27 AM »
Finished watching the video, thanks for all your comments.
I will comment on what you mentioned during the playthrough.

Mashing bullets doesn't work - There is a delay on fire rate set to every 0.1s. Instead of limiting the bullets on screen I just limited the fire rate.
That torch, was added in near the end and it seems making the pickup / drop button the same as shoot was not too bright :p
Because of it being the same button, there is a 1s delay between being able to pickup and drop it, which adds more confusion.

Guy sometimes off the ground a pixel, is probably an issue with me stinking on creating the ground hitboxes, but I will keep an eye out to make sure it isn't anything more.

Mentioned that water might making the character fall slightly slower. Right the only difference between normal stats and water stats is that the fall speed is capped at -2 instead of -9. I had a hard time finding stats and information about how certain objects effect the player. For the most part I think I collected from enough random posts and sources, but its possible they may have been wrong.

Boss was laggy. Yep, at the moment each object is being created and destroyed X seconds after. For simple things this is ok, but massive amounts of object it can be laggy.
There is a thing called Object Pooling that reuses the objects instead of creating and destroying them all the time. This is extremely more efficient but I haven't coded it into the object spawner script yet. On my list of things to do.

Now onto the more complex stuff.
Right now the character is controlled by velocity / rigidbody / collider and there is nothing other than Unity stopping the character from going through the walls or ground.
I have found that even a spike 1-2 pixels inside another block can still be "touched" if you are moving at high enough velocity, even though the character actually never ends up inside of that object. So walking over a certain "safe area" is ok, but jumping and landing will cause you to touch that submerged spike pixel. So it seems that unity, even though for a split second, will move you to your next position, calculate game stuff, then say, Woooha you aren't supposed to be here, and move you back to just before the solid object before the visual frame loads. So if you are at the correct align you could, for an instant, be considered in a block and use a basic jump instead of double jump or be inside a spike and die. This is what was going on and I need to really dig into how Unity actually calculates it and how my scripts are interacting with that effect. I will probably have to put pre-wall / ground checks to prevent that. Overall I could remove velocity all together and put in Transform based movements, but then I loose all the power having a velocity gives.

Holding onto directions after reloading doesn't move you. Yep, I know ///
There is also a small chance of doing a boosted jump, which you did once and were confused. This has to do with the jump signal being pressed, released, and pressed in a single frame (I think).

Unresponsiveness of movement. Ive been meaning to update how and when button presses work. Ive been away from playing typical guy games since I started working on this engine and I know I have lost "what feels right." I know my design choice for button presses is very basic and worked at the start, but its time to update it.

Overall these "more complex stuffs" are all in the 2D controller which needs an update badly anyways.
I think I spend wayyyy too much time on coding prefabs to make it easy to create a screen (All the objects in the game were just drag and drop prefabs).
Its about time I go back to coding the 2D controller.

As for things I learned from watching you play.
I took out the option to change the screen resolution (which is default unity stuff). It seems I should of kept it in.

My screen wraps prefabs where placed in quickly. They need to be positioned better to give a more real screen wrap effect.
After the castlevania room. The spawn point is in a dumb place and since you are pressing left to get into the boss room, you are extremely likely to walk backwards a room. Sorry about that.
Boss, Hands have too much HP for the length of the game. It has 10 HP each and after watching I feel it was wayyy too much. Maybe 5 seems right.
Spinny hands attack has a RNG component on the right hand which makes a "safe spot" never the same area. I will take that variance out.
RNG on type of attacks, I may change it to PRNG so the probability to attack the paws increases if you get bad RNG.

Finally OMG finally. I almost died every time you went back to the main loading screen because that "Reset Data" button was there.
Seriously one push of that and your save was gone. I put it in because it was easier to test things but seeing it on your screen scared the crap outta me.
More than likely I will remove it and put a difficulty setting in.

Any comments on my comments would be welcomed if you have any more questions.
« Last Edit: November 12, 2014, 03:06:05 AM by RegalPrime »

Zurai

  • Community Manager
  • Spike Dodger
  • Administrator
  • Posts: 170
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 38.0.2125.111 Chrome 38.0.2125.111
    • View Profile
  • Playstyle: Keyboard
Re: Unity Fangame Engine - 11-10-14 - I Wanna Help the Cat - Pre-Release
« Reply #26 on: November 12, 2014, 12:03:01 PM »
Hey  :azoCheer:

Im glad you watched the VOD and take the criticism seriously. Actually all of your explanations make sense
and for every problem I mentioned I had the same reason in mind but I have a hard time explaining it like
that :P

I really can't add much to what you said. For the spike/collision problem:

I don't know if unity offers this option, but in Gamemaker you can differ events between "Step event" and
"End step event". The code which you initialize in an "End step event" is always executed at the end of a frame.
So if you have the option for this, you could handle it like that, that all the stuff which is pushing you out of a block
an repositioning the kid, is put as a "Step event", so it's happening at the beginning of a frame. And the collision detection with a lethal
object could be handled in the "End Step Event" (or however it is maybe called in unity).

We had the same issue in Gamemaker when a spike is on the same height like a platform or a block and this is the
solution Seph and Lemon (I think) came up with. Maybe it helps you  :atkHappy:

I hope I could help you out a bit with my comments and looking forward to the next release :FrankerZ:
Stop by and say hello at www.twitch.tv/zurairofl :PogChamp:

RegalPrime

  • Wannabe
  • Posts: 37
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 38.0.2125.111 Chrome 38.0.2125.111
    • View Profile
  • Playstyle: Keyboard
Re: Unity Fangame Engine - 11-10-14 - I Wanna Help the Cat - Pre-Release
« Reply #27 on: November 13, 2014, 04:06:41 AM »
Tested a real game vs mine, I had a hard time telling control differences. I guess I've been away from playing them for too long :/
I rewrote a chunk of the 2D controller tonight and it should calculate the key inputs instantly now. I seems to be able to short hop faster now but the movement controls I need to test more. Im not ready to do a update yet so others can feel it out.

Sooo, I spent the night doing maths in my engine and then searching the web about certain issues Ive been having in Unity annnnnnnd hmmmmm.
I come across discussions about certain oddities I also have been having and I found a possible problem going forward.

I created an exact ground check within one pixel below the character and it wont detect it even though their positions are the correct X pixels apart (if you calculate offsets and whatnot). Even if 2 colliders are touching each other there is a small cushion that are maintained to deal with calculations of them bumping into each other. When they touch each other, both colliders may move to deal with the collusion. Sadly, this is why a spike a few pixels under ground can be touched when jumping or running into a wall.
This same issue is why you can clip the side of a platform and not fall even though you normally would.
There are apparent physic settings to help deal with this issue for the 3D colliders but not for the 2D colliders (these are newer to unity).
They say edge colliders can deal with this but placing them exactly in the editor is pretty awful (no snapping function) and creating them during runtime via script is pretty awful.

Post I found about this
https://www.iforce2d.net/b2dtut/ghost-vertices

I really like the idea of making this work while still moving the guy via physics based forces, but doing so offers this challenge.
Removing physics based forces might fix this, but you loose so much of the power that Unity gives.
I will have to think about this and search some more tomorrow. Might have to make a test controller from scratch to test exactly how this can be fixed.

Yagamoth

  • Trial Wannabe
  • Posts: 1
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 39.0.2171.65 Chrome 39.0.2171.65
    • View Profile
  • Playstyle: Keyboard
Re: Unity Fangame Engine - 11-10-14 - I Wanna Help the Cat - Pre-Release
« Reply #28 on: November 21, 2014, 03:48:25 PM »
Greetings,

I really like what you've done so far with this project. In a small (unfinished) project with a good friend we also ran into the problem with exactly ground detection because of the "skin" of the colliders. Ultimately we decided it would be better to use our own physics, despite losing that much power from Unity. Overall the precision was more valuable than the power of Unity - I imagine that might be a similar thing for this project. (Please note, I'm only marginally experienced in Unity, my friend did most of the work of this ^^; )

I have only skimmed through the thread very briefly and read the last post. In any case, I'd be highly interested to create a fangame via Unity if you were to release the source at some point :)

- Yagamoth
« Last Edit: November 21, 2014, 03:58:12 PM by Yagamoth »

RegalPrime

  • Wannabe
  • Posts: 37
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 39.0.2171.65 Chrome 39.0.2171.65
    • View Profile
  • Playstyle: Keyboard
Re: Unity Fangame Engine - 11-22-14 - Update
« Reply #29 on: November 22, 2014, 02:34:09 AM »
About time I do an update regarding what I have done the past few weeks.

Most of the game changes I listed above have been put in and pending the next version of the game I will list the exact changes. Next version release will be soon and add in most of the below changes as well. Because of theses massive changes to the underlying scripts, dont be surprised if something goes wonky. Maybe a few days to test.

Much like I was complaining about in my last post and what Yagamoth said is true about Unity. There is a small buffer of about 1.5 pixels (0.75 pixels per object) that cushion 2 physical colliders (trigger colliders dont have this buffer). I spent the majority of my time writing another script that calculates very exact area collider checks for Ground / Wall / Ceiling. I could now see how far I was from an adjacent object when I was near it and thus calculate this buffer. In 3D colliders, they have an option to lessen this buffer, but the 2Dcolliders do not have this option as of yet. I have the buffer as a variable and thus can change it easily if something would come up later. Only bypass would be to write my own collider classes, but that seems like a ton of work and then again I loose the power of Unity.

Listed as a complaint from the game. Physics seems to make you touch objects within another object even though you never actually touch it. For example, walking over a spike that is inside a block is fine, but jumping on that block will cause you to die (I would guess that during the physics calculations, the character is temporarily inside it and thus you die). Now that I have my area checks, I calculate warnings to my move / gravity when it is within a certain range of a solid object and have it move the shorter distance to right beside the block. Soooo, for now it seems that problem has been fixed (there might be some fiddling with the code, but its a vast improvement). My prechecks are fairly small area (~20pixels) because of another problem with it grabbing information from other objects behind the one I want, but when I figure that out, I can increase the check range.

Changed how Button presses were done. They should be more immediate. Hopefully this should fix the unresponsiveness. The first playthough after I changed the code was a trainwreck. I was ramming into the sides of spikes and my jump timing was off (so at least something has changed).

I spent a few days writing a 100% transform movement character controller (ie always move via positional movement). Having the aoe checks made this possible. I did this because I would know that 100% the character is moving / falling / jumping X pixels. I put both the physics based and pixel based on the same screen and they both jump and move the same speed, which is a good thing.

As for Holding right after loading from a save / a screen doesn't work.
When a scene is loaded, Unity automatically calls  Input.ResetInputAxes().
This resets all keyboard inputs, which means from scene to scene it will not remember your key presses.
Each screen in my game is a separate scene, which is pretty stupid, and not efficient, but easy to setup. A real game would have multiple screens in one scene and load / reset the objects when necessary. Doing this would allow key inputs to be maintained. I am not at the point in this engine where I want to put a lot of time into efficiency. Getting the base things to work comes first. Reloading the same scene over and over would be first to fix and thus respawning would be fixed when being in the same scene.

So, as for the engine, I will continue to work on it even though the dream of 100% pixel perfect while maintaining physics based movements is a bit far off due to engine collider limitations (either that or I will have to write some extensive collider scripts which would break much of the interaction I have built up in the other scripts). Hopefully, things are a bit more solid now and the guy moves better.
I wouldn't expect its perfect yet, but I know I am getting closer each time.

@ Yagamoth
Let me know what you have planned.
I would be willing to release it fairly soon to interested people (which would include all of the game screens), but you have to understand that it is going to be messy and not organized the way I would like to release it to the public. You would also have to understand that it is possible that there would be massive changes in the future that would make future versions of the engine not work well with certain scripts you have created. At least basic room layouts should be fine due to tags and layers.
I still need to go through every script and see how well they held up against other scripts I have wrote (My camera script script works really nice but I know it needs to be rewritten to be more efficient, stuff like that). Some code I wrote months ago, seems like child's scribble now, just because of the things I have learned.