[C#] Wink2D Engine

Started by winkio, November 09, 2010, 02:58:34 pm

Previous topic - Next topic

Subsonic_Noise

I waited this whole time for you to name something "Wink" so I could call it gay, but after seeing those screenshots I don't feel like it anymore. Damn you.

winkio

December 07, 2010, 11:26:21 pm #21 Last Edit: December 29, 2010, 01:40:51 pm by winkio
Quote from: Aqua on December 07, 2010, 03:19:30 pm
Your isometric doesn't seem right to me... o-o


It may seem off because the unit dimensions are 32x48.  I can make any grid whatever dimensions I want with the code I made, so I took screenshots of different tests.  I can make a 32x32 square isometric, and it lines up exactly with the rectangular.

EDIT: YUHHHHSSSS!  Finally implemented ear clipping.  Hooray for concave polygons!
Spoiler: ShowHide


EDIT 2: After writing an excruciating amount of repetitive code, I finally finished intersections between my 11 defined geometries (due to accounting for generics and conglomerates, points, intersection points, and intersection types, that's over 600 methods).  Now that I can select my shapes, time to edit them :D
Spoiler: ShowHide

G_G

D: I can't see whats in the spoilers :(

winkio

So I was trying to come up with a good way to implement undo/redo, since these are very important functions in an editor of any sort, and I settled on this:

I created an Action object with two properties: object[] EList and object[] UList.  I also created a double stack that would allow me to keep track of which actions can be undone and redone.

The Action object also has two methods: Execute and Undo.  Execute executes the action, using Elist to access other objects and take arguments, also saving backup data to UList.  Undo undoes the action, using UList to restore old data.  The Action class is meant to be extended by each individual action such as selection, shape creation, etc.  So, for any functionality that modifies data in the editor, the editor will create an action, set it's parameters, and put it on the stack.

Thoughts?

Ryex

great minds think alike :P. I was considering how to do the same thing in RMPY and came up with a very simaler solution.

a universal Action objects that dose the actual action to act as a frame work. it has a execute and reverse method. subcalssing this object to create actions for spesfic things like editing map data entails editing the execute and reverse methods to to the necessary operations on the data. adding these objects to a stack means that calling the undo operation pulls the action on the top of the undo or redo stack and calls the execute or reverse command then moves the operation to the other stack.

when ever the editor needs to do something it makes an action object of the right type gives it the needed data calls the execute method and places it on the undo stack. who know perhaps I'll make a global action frame work that provides the undo redo interface so all you need to to is create the action object and pass it to the framework. the frame work would execute the action and place it on the stack an undo or redo call the the frame for would make the appropriate actions. I was thinking of creating some sort of action group so that you could make really small actions group them to gather and execute or reverse them all at once (or rather the order they are arranged in the group) the group would sit on the stacks like an action and would have a execute and revers command that looped through it's contents.

the operations entailed might have to be taken in a different way considering that is is c# and my idea is created with python in mind, but the principle should be the same.

I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

ForeverZer0

I like the idea of using a stack-based array for efficiency. I'm curious as to how you are storing the Actions, since they will be widely different depending on the action taken. (it may not be as difficult as I'm thinking, keep in my mind I'm still learning C#).
I wasn't aware you could simply initialize a List with a such a generic data type as "object". Can you store different data types in a single array?
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Ryex

only if the list is of the "object" data type
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

And you would have to cast it back before you can do anything with it meaning you would have to know what's inside. I don't recommend that.

@winkio: You're gonna use delegates, aren't you? <3
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

winkio

February 09, 2011, 09:19:49 am #28 Last Edit: February 10, 2011, 11:44:28 am by winkio
No, it was object arrays.  Each class that extends object had their own Properties defined from each array.  For example:

public class PointerVectorGeometryDocumentControlAction : Action
   {
       /// <summary>
       /// Control to apply the action to (EData[0])
       /// </summary>
       public VectorGeometryDocumentControl Control
       {
           get { return (VectorGeometryDocumentControl)EData[0]; }
           set { EData[0] = value; }
       }

       /// <summary>
       /// Click number (EData[1])
       /// </summary>
       public int Click
       {
           get { return (int)EData[1]; }
           set { EData[1] = value; }
       }


In this way, you wouldn't ever access the object arrays directly.  Of course, when doing this, I realized that this is the same thing as just not having the arrays to begin with and simply declaring new properties in each class.  So that's what I ended up doing XD

EDIT: Well now I know my file format is efficient, I just saved a geometry with 20 shapes and it was only 98 1198 bytes :D

Blizzard

Lol, I was already like "98 bytes?! O_O Jesus H. Christ in a chicken basket! O_O"
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

winkio

Yeah, that was an obvious typo.  I'd laugh if I actually was able to store each shape object in 5 bytes XD

The Niche

Quote from: Blizzard on February 10, 2011, 12:50:38 pm
Lol, I was already like "98 bytes?! O_O Jesus H. Christ in a chicken basket! O_O"


*Tries to imagine Jesus in a chicken basket*

Ah, right. Miracles.
Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

winkio

Just showed my most recent build of this to my university's game development club.  They were impressed :D  But now, there are people that are expecting steady progress on it every week...  :o... *facepalm* why am I so dumb?

Blizzard

Tell them it's like Duke Nukem Forever.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

winkio

February 12, 2011, 04:34:55 pm #34 Last Edit: April 17, 2011, 11:30:40 pm by winkio
Quote from: Blizzard on February 12, 2011, 04:23:58 pm
Tell them it's like Duke Nukem Forever.


...BLIZZ YOU ARE A GENIUS!  The thing is, I actually can make progress pretty easily for a little while working on the basics of the editor, but I know that once I try and integrate the editor with the framework to make a game prototype, all hell is going to break loose.  Hopefully, I can time for that to happen over spring break, and then spend all break fixing it XD

EDIT: small update because I haven't done one in a while:  Tiles of all shapes and sizes are rendering, the game code is started to be built up, starting with the platformer code.