Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3

Author Topic: im trying to do a 2D space game...  (Read 4712 times)

xaritscin

  • Bay Watcher
    • View Profile
Re: im trying to do a 2D space game...
« Reply #15 on: January 01, 2016, 09:02:11 am »

not much progress yesterday, half of the day went into new year celebrations. but i got some stuff working.

started adapting some of the code of the tilemap prototype to a new scene giving life to the ship editor prototype. right now the prototype has its own gui and works with asteroid prefabs. the menu has a system of 3 buttons, one for generation, one for moving objects and one for destruction.

however, the functions work even when not toggling the buttons, so its kind of a mess to configure the GUI to use the same mouse button. all of the functions should be called only when i toggle the buttons and work with only the left mouse button.

once i get that thing set, i can start working on adding some kind of scrollable list for prefab selection.
Logged

xaritscin

  • Bay Watcher
    • View Profile
Re: im trying to do a 2D space game...
« Reply #16 on: January 01, 2016, 07:40:09 pm »



finished the issues with the main buttons, i can generate, drag and drop, and eliminate elements on the screen using only the left button of the mouse.

the bar at the top will contain the hull prefabs and maybe some other modules as i get to put more shapes. for starting i have a rect triangle, a square and an hexagon. havent put them in the bar yet.

this is the most complex UI i have been done right now. and i havent finished its workings. i should find the scrolling methods tomorrow while looking at how to implement the methods for fusing modules on screen.

EDIT: here, have another pic, its from the spaceship prototype

« Last Edit: January 01, 2016, 07:46:52 pm by xaritscin »
Logged

xaritscin

  • Bay Watcher
    • View Profile
Re: im trying to do a 2D space game...
« Reply #17 on: January 02, 2016, 05:26:47 pm »

my parents are sick so i have had to spend a good part of the day taking care of the house tiding and doing the dishes. so not much progress recently.

however, i have been able to advance with the UI layout. right now it looks like this:



added more slots and some of them have icons related to their respective prefabs. dont mind the cookie asteroid (a friend related it to a chocolate chips cookie so i've grown fond of it), it should be there just for testing your spaceships in terms of collision and other stuff.

the code for selecting them is being worked on, each button should be able to call on its respective prefab and summon it from a list for the player to generate. in order to do it i have to make some works both in its own selection script and the main editor script (dont want to clog the main editor with stuff).

notes: yeah it looks silly to have a selection bar on the top, but take in account this is new for me, if i can get to improve the algorithm i would completelly get rid of the bottom left buttons and just allow the player to pull items from their icon with drag and drop. but for now it works like this.

EDIT:

discovered a quick and easy way to call the prefabs from the slots, it actually saved me from doing another script. so yeah, the editor script is managing everything right now. havent worked on the prefab scrolling though.

next step is to fix some issues with the drag and drop. it gets clunky with the triangles and you cant drag the elements too fast, they get it hard to follow the cursor. also, i need to start thinking in the fusion algorithm for blending pieces in shape. right now you can place them and group them but they dont piece together into a new element. also, you cant rotate,mirror or morph them yet. need to start implementing that too.

« Last Edit: January 02, 2016, 07:00:21 pm by xaritscin »
Logged

xaritscin

  • Bay Watcher
    • View Profile
Re: im trying to do a 2D space game...
« Reply #18 on: January 03, 2016, 09:39:43 pm »

nothing much to show today, spent the rest of the day yesterday looking for ways to fix the issues with the drag and drop system but it didnt work.

today was mostly with a blank mind. trying to find tutorials or documentation in how to make snap the hull parts together and how to get a mesh out of them for both collisions and later use for the interior editor.

i didnt found anything related that could give me an insight on it. not even looking for spaceship editors in google. plenty of games showing it but no one explaining how the fuck does that system work.

so i logged in into the unity forums and made a thread. im waiting to see if i get responses.

if not. then i will leave the project canned and move on to something easier to investigate. like doing a Terraria clone....
Logged

chaotic skies

  • Bay Watcher
  • Vibing in anti-space
    • View Profile
Re: im trying to do a 2D space game...
« Reply #19 on: January 03, 2016, 11:25:59 pm »

Dude, stick with this. You're already farther than the vast majority of the human race would get in months, and you've worked on this for just over a week. If you can't find a tutorial, take from pre-existing systems that you know work.

I can't say how to turn this in to code, as I'm not that well-versed in C#, but here's what I've gathered you need:
1) A rotation system. This could be based off of movement system.
2) A mirror. This would probably require a new prefab, which is the original object mirrored. You could factor rotation into the mirror, that way you don't go from a slanted triangle to a mirror at the default rotation.
3) A morphing system. The easiest way I can think of to do this is like Reassembly, as in you have multiple prefabs, one for each size; a 1 by 1 square and a 2 by 2 square are not the same thing at all, but rather two seperate objects, where one is accessed by the other.

Also, don't worry about graphics. Once you have everything the way you want it, then start in on actual graphics. For example, let's say you add missiles. At first, these would probably be just boxes. You could name these "missile_placeholder", or name the graphics "missile_placeholder", and either would work to remind you that something needs changed. And I'm not saying get rid of your space cookie, but if you start adding planets, make them circles that are all one color, until you've figured out how you want them to work. Then make them look pretty.

Does any of this make sense? Or was this a wall of text so dense even an anti-matter bomb couldn't penetrate it?
Logged
Don't let me start a forum game, smack me with a paper towel roll if needed

Professional Thread Necromancer

xaritscin

  • Bay Watcher
    • View Profile
Re: im trying to do a 2D space game...
« Reply #20 on: January 04, 2016, 12:42:28 am »

well yeah i could work on that. the mirror system may be tricky yeah, but it should be easy since its just to generate a duplicate of the currently selected prefab with negative values on its X and Y positions.

im not much sure on the morphing system. i could add a scaling tool though. like when having the mouse hovering the object it would be able to increment its size by a set amount. but changing the vertex of a rectangle for example in order to convert it onto a trapezoid or something like that would require serious investigation.

the rotation system can be adjusted from the movement system yeah. i forgot about it.

i may add that tomorrow.

yeah your comment makes sense, thanks.
Logged

chaotic skies

  • Bay Watcher
  • Vibing in anti-space
    • View Profile
Re: im trying to do a 2D space game...
« Reply #21 on: January 04, 2016, 01:29:30 pm »

Hey, I'm just trying to help. And the morphing thing, I wouldn't know where to begin on that. The only thing I can think of is to duplicate/replace stuff, and that won't help with morphing a rectangle to a trapezoid. Sorry :-\
Logged
Don't let me start a forum game, smack me with a paper towel roll if needed

Professional Thread Necromancer

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: im trying to do a 2D space game...
« Reply #22 on: January 04, 2016, 02:18:02 pm »

I like the idea, and you've made great progress thus far.

Morphing, if I understood you correctly, would be similar to the "Perspective" tool in GIMP, except it is applied the to the vectices instead of every pixel.  That would turn a rectangle into a trapezoid fairly easily, and the matrix functions should be in standard math libraries.  Two pitfalls:

1. Since a circle is just one point with a defined radius, it won't deform like a polygon.  This might be the effect you want, but probably not.  The solution is to explode circle into a many-sided polygon, then deform it.

2. I'm guessing that GIMP's GUI with handles on the four corners would be nontrivial to replicate (unless there is already a script out there).  GIMP itself is open-source under GNU 3, but I have no knowledge of the licensing issues of lifting a bit to use in a game.  The math may be apparent from the source code, from which you could build your own GUI.

An alternative would be to rotate the 2D shape on three axes (like in Microsoft Office).  Under the hood this is just scaling, but it's not as flexible as true deformation.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

xaritscin

  • Bay Watcher
    • View Profile
Re: im trying to do a 2D space game...
« Reply #23 on: January 04, 2016, 07:02:46 pm »

been a little bit silent today, almost all the day went trying to fix that goddamn drag and drop system. turns out, it would never work while in the editor script. it was just to take the script and place it in a new class that could be added to the prefabs.

so yeah. one bird down, im working right now in the scaling system, the fundamentals are set. i can increase/decrease the size of the objects in increments of 1 in a set of minimum and maximum values.

the problem right now is that i need to figure out how to make this apply only to the currently selected item, the script is working at a global scale atm, so if you have several parts on screen and hit the button all of them will get bigger/smaller.

once i have that sorted out i will get onto mirroring and rotation.

« Last Edit: January 04, 2016, 08:46:48 pm by xaritscin »
Logged

xaritscin

  • Bay Watcher
    • View Profile
Re: im trying to do a 2D space game...
« Reply #24 on: January 04, 2016, 09:07:02 pm »

fixing the scaling script was easy, it was the same problem of the drag and drop but in reverse, i had to put the script as a method inside the controller and add a raycasting method so the program knows which part to scale.

scaling has been assigned to W/S keys and only depend on having the cursor over the element.

rotation works the same, it uses A/D and rotates in increments of 15°

flipping the shape right now does it along the Y axis. and it doesnt make duplicates. but the system is easy enough for just spawning another part and accomodate it as like if it were a mirrored copy.

in terms of morphing. i think im not gonna mess with it right now. having there's more important stuff to get over first. like finding how to attach parts together.

Logged

xaritscin

  • Bay Watcher
    • View Profile
Re: im trying to do a 2D space game...
« Reply #25 on: January 05, 2016, 12:05:21 pm »

woke up a bit later but im already on the works. the fundamental for the attaching system right now is to put somekind of connection point in the sprite. and put them on a list. then when a collision happens, the system has to make sure the object gets attached to that position.

right now im trying to figure out how to obtain those points from the sprite bounds. the idea is that there should be at least 1 connector for each side of the sprite. each one located in the middle so they can be perfectly centered when connecting.

then i have to figure out how to tell it "hey, these two connectors are in contact so lock the position of that object there". and also to say it "this guy is trying to move the part to other side, disconnect it from there"...
Logged

xaritscin

  • Bay Watcher
    • View Profile
Re: im trying to do a 2D space game...
« Reply #26 on: January 06, 2016, 12:49:34 am »

registered in reddit to see if i can find a way to make that. for now the best response has been to add a parenting method during collision, but that only ensures the object follows the parent. it doesnt cover what i want to do which is to do something similar to reassembly.

i mean, having  free space editor where i can put and take objects from the connection points.
Logged

xaritscin

  • Bay Watcher
    • View Profile
Re: im trying to do a 2D space game...
« Reply #27 on: January 06, 2016, 05:27:46 pm »

got some good responses on reddit, but i havent been able to figure out how to make it work. for now what i can do is to parent the piece to another one and it will follow but it doesnt really snap to the object.

i dont know what to do tbh. my knowledge doesnt reach that far.
Logged

chaotic skies

  • Bay Watcher
  • Vibing in anti-space
    • View Profile
Re: im trying to do a 2D space game...
« Reply #28 on: January 06, 2016, 07:15:18 pm »

I'd say just take a stab in the dark, and see what you get. If it doesn't work the way you want, but it's close, leave it and come back if you have to; most of my projects end up dying because I focus all my efforts on one thing, and I burn myself out.

If all else fails and you're willing to learn, there's something with Visual Studio, where you get 6 months free to learn from lessons other people have made.
Logged
Don't let me start a forum game, smack me with a paper towel roll if needed

Professional Thread Necromancer

xaritscin

  • Bay Watcher
    • View Profile
Re: im trying to do a 2D space game...
« Reply #29 on: January 06, 2016, 08:56:09 pm »

the problems is that i cant leave it like that, its one of the most important parts of the Editor.

without a well fleshed snapping system the players will have issues to make their spaceships/stations. if i cant make this work i would have to rely on things like predefined models with hardpoints.

i'll wait for more responses to see if i can get more insight in how to do the implementation. but for now i cant advance further.

Logged
Pages: 1 [2] 3