Advertisement Jump to content
  • Advertisement

Spool

Member
  • Content Count

    48
  • Joined

  • Last visited

Community Reputation

315 Neutral

About Spool

  • Rank
    Member

Personal Information

  • Role
    DevOps
    Game Designer
    Programmer
  • Interests
    Art
    Design
    DevOps
    Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Spool

    make everything an object??

    Think in terms of your game. Would it benefit your development of the game for Oil to be an object? Would it benefit your game? Is Oil being just a piece of data about your Lamp going to impact your gameplay? Do for some reason you *need* Oil to be a separate Object? If not then don't treat is as an Object. Programming practices and paradigms are just tools. They are ideas. They are there for you to use when you see fit. When it is beneficial to use them. Anything other than that is wrong way to write software. The only things you should be doing are things that benefit you and your software.
  2. Spool

    UI Improvements

    Looks great. Reaching the point when you want to apply themes and styles and what not brings on a lot of "hmmm well shit" moments I find. How are the Widgets being drawn in the new system? Also I personally love the flat shaded style compared to the former. It feels more modern and stylish I find.
  3. Spool

    UI, for the love of God. UI..

    1: Yes, generally speaking from a number of years experience viewpoint I am relatively inexperienced. But I have made multiple semi complex UI systems in the traditional way. So I wouldn't necessarily say that I have "little" knowledge of the problem space. But generally speak I am somewhat inexperienced. 2: Of course, I couldn't agree more. But I am advocating learning from those design "mistakes" < personal opinion, and using that to our advantage. Rather than just using the framework at all. I am not saying inheritance is bad. The functionality that it provides is useful, and given the context is very appropriate. I am saying the use of inheritance is what is bad in most of these frameworks. The tool isn't bad. Its the use of the tool that is bad. Bad isn't really a good word but I think you know what I mean. Yes, I agree. Making a basic UI system I think is very educational and personally has taught me a lot. I just happened to get sucked into the semi philosophical understanding of what seemingly is a common trend in these types of software and decided to give it a try and make it into something I thought was better. Thanks for the reply, and giving it a read. Cheers!
  4. Spool

    UI, for the love of God. UI..

    This is what I will go into in the next post I think that's a big part of it. On one hand most of the time you don't care about how a Framework is structured. As long as it works and works well for you who cares. Totally see that. On the other hand.. what if you need more than that? What if you need less than that? What if that Framework dies? What if it doesn't support the platform you want? I mean granted these are very general concerns. None but one of which where part of the reason that I decided to make my own. But still. They should be considered.
  5. Spool

    UI, for the love of God. UI..

    @Scouting Ninja My own experience with other Frameworks is the exact opposite. I don't want to name any specific ones as that seems rather rude given the context. I am not saying to replace this type of functionality. It makes perfect sense to have a base element with common data and very basic common logic. But that seems to get out of hand very quickly.
  6. Spool

    UI, for the love of God. UI..

    A couple months ago I decided to delve into the dark arts that are seemingly only attempted by the bravest of programmers. UI Framework development. While honestly I didn't fully understand what designing and creating a UI Framework from scratch truly entailed, I had some notion that it was no easy feat. As such should be approached with caution if not entirely avoided as the amount of UI Frameworks available are as numerous and the reasons not to make one yourself. But, I decided to embark on the journey anyway.. I guess the first big question you would ask is, Why? Why would you want to do that. To be honest, I asked myself that very question. The answer I came up with may seem rather shallow and the hallmark of an inexperienced developer.. They all suck. In *my* personal opinion anyway. Yes, they all suck. But that seems to be the norm in software development, we work with things that we don't really like because the idea of making the utility they provide ourselves is just as miserable if not more so than using the framework or tool in the first place. Anyway back to why all UI Frameworks suck. From hours and hours of scanning through endless lines of Desktop UI Framework source code repositories, I have come to two major conclusions about most if not all of them. 1: They all do WAY to much and try to handle every single feature, problem, platform, style, you name it. They end up bloated piles of code that seem to have no cohesive structure. 2: Everyone of them seem to have a ridiculous monolithic base Widget class that does EVERYTHING. So when you have a Screen full of Buttons you have all the infrastructure and memory requirements needed if you were to have a Screen full of Windows containing many other Widgets. Wasteful and unnecessary. To be honest, I can see why these traits are common. UI is complex. It needs to be reusable and flexible enough to fit into any application that wants to utilize it. Doing so in a clean concise manner is no easy task. Its very easy to indulge in the temptation of easiest implementation is the best implementation. After all, people need their UI's in a timely fashion. But what if we didn't do that? What if we really sat down and looked at how a UI operates, what it *needs* to do. What type of general structure would work best for those needs. This is what I decided to do. I decided that if I was going to make this, I was going to do it right. By my standards anyway. Next post I intend to go into my thoughts on how UI *should* be. If anyone read this. Thanks, feel free to yell at me in the comments.
  7. Spool

    Need feedback for UI

    Looks a bit generic, nothing really pops out at me. Not bad though. Have seen worse.
  8. In part one you didnt go into detail about System implementation. Would love a bit more detailed talk about your System<T> class. Great read as always cheers.
  9. Very nicely written and perfect amount of detail. Great article. I do something very similar for my ECS design.
  10. Spool

    C# XNA 4.0 How to serialize a 2D array?

    Here is the MSDN article on Serialization, it uses FileStream and BinaryFormatter. Its the VS 2010 version. https://msdn.microsoft.com/en-us/library/b85344hz(v=vs.100).aspx You should really convert to Monogame.
  11. Spool

    C# XNA 4.0 How to serialize a 2D array?

    If your problem is entering in all of your Tile ID's by hand into your array then make a simple Tilemap editor and have it export this binary file that your game can load in and convert to a SaveGame object at runtime.
  12. Spool

    C# XNA 4.0 How to serialize a 2D array?

    use would look like this: //Add the dll using System.Runtime.Serialization.Formatters.Binary; //Save the game to Disk private void WriteSave(SaveGame saveGame,string filePath) { try { using (FileStream stream = new FileStream(filePath,FileMode.OpenOrCreate)) { BinaryFormatter bFormatter = new BinaryFormatter(); bFormatter.Serialize(stream, saveGame); } } catch(Exception ex) { } } //Load the game from disk private SaveGame LoadSave(string filePath) { saveGame = new SaveGame(); try { using (FileStream stream = new FileStream(filePath, FileMode.Open)) { BinaryFormatter bFormatter = new BinaryFormatter(); saveGame = (SaveData)bFormatter.Deserialize(stream); } } catch(Exception e) { } return saveGame; } You don't have to worry about how its saving it. Its all in Binary. Its just a file that contains your data. It serializes to and from your SaveData object for you. I use this myself for the exact same thing.
  13. Spool

    C# XNA 4.0 How to serialize a 2D array?

    If you are using XNA 4.0 I believe that its targeting .Net 4, in which case you have access to System.Runtime.Serialization.Formatters.Binary Namespace. So you can use this. Serialize: using (FileStream stream = new FileStream(filePath, FileMode.OpenOrCreate)) { BinaryFormatter bFormatter = new BinaryFormatter(); bFormatter.Serialize(stream, mapData); } Deserialize: using (FileStream stream = new FileStream(filePath, FileMode.Open)) { BinaryFormatter bFormatter = new BinaryFormatter(); mapData = (MapData)bFormatter.Deserialize(stream); }
  14. Spool

    C# XNA 4.0 How to serialize a 2D array?

    What .Net version are you using? I use Monogame
  15. Spool

    C# XNA 4.0 How to serialize a 2D array?

    Okay, well MsgPack is a library that handles Serialization the exact same way as Xml does (kinda) but instead of using Xml it uses a Binary Format. Its much smaller and faster. You can use whatever file extension you want. For instance all my Save files are SaveName.save Here is a link to their site: https://msgpack.org/index.html Its really easy to use as well. You just install the Nuget or add the Reference directly and add a using statement at the top and then use the code I have above. Boom done. Its really that simple. It converts directly to and from your object. Just curious did you make your own UI system or using someone else's UI framework?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!