Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

178 Neutral

1 Follower

About Exoaria

  • Rank

Personal Information

  • Interests

Recent Profile Visitors

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

  1. I've been thinking a lot about how I want to approach the design for interactive objects in my 2D Platformer. I wanted to do something lightweight and centralised so I started work on an Event Class that embodied anything that would be interacted with. The type of interaction would be defined in the Unity Editor though a Custom GUI that I am working on. As you can see, this "event" would be for a moving platform. If "Is Triggered" is ticked, the Platform moves only when the player jumps onto it and activates it. Otherwise it will interpolate between the definable "Start Position" and "End Position". Depending on which "Event" (enum) is selected, the Editor properties will change and so will the behaviour of the Game Object with the event attached to it. For example, selecting "Item Collect" would mean that the Game Object is no longer a platform - no longer an object that moves when activated - it would be a stationary sprite that, when activated, would disappear and add itself into the player Inventory. Here's some code to show where I'm at with it: /* * ############################# * ##@@## INITIALIZATION ##@@## * ############################# * */ private void Awake() { SetupEvent(eventType); } public void Activate(bool calledFromTrigger = false) { if (autoTrigger && !calledFromTrigger) return; Debug.Log("Activated " + name + "!"); StartEvent(eventType); } private void StartEvent(EventType type) { switch (type) { case EventType.Movement: MovePlatform(); break; case EventType.Dialogue: break; case EventType.NPC: break; case EventType.ItemCollect: break; case EventType.Cutscene: break; case EventType.Switch: break; case EventType.Custom: break; } Don't be deceived by the snippet - this is all quite functional as of right now, but I can't help but feel I am making a mistake. I keep having this gut wrenching feeling pulling me to scrap it and rewrite the "Event" class to be a base class of "Interactible" and for each type, or what is currently an enum, to be a child of Interactible. Essentially, I am not sure whether to base my events off of one Event class, with functionality dependent on the selected "Event Type" enum... Or have the "Event Types" span multiple classes inheriting from a base "Interactible" class. I like to be able to just drag and drop, select what I want all in one place - but I feel that this is entirely impractical due to its low level of abstraction and code being all in one spot. Can I get some opinions? I am a relatively beginner programmer but I know code decent enough to be able to use more advanced techniques I think. Here is a screenshot of my game for context.
  2. https://gist.github.com/anonymous/cbff9fc74258450eb27d50db6aa8ce03 I'm trying to write code to manage an inventory in a simple way. This is the first code I've written to do this. I'm having a bit of trouble understanding certain things. For context, this is intended to be a text adventure. I have an Item class, and Weapons + First Aid subclasses. If I want to instantiate a weapon, I'll call Item sword = new Weapon("Sword") -- the Item class, as you'll see in my code, requires a name when it is instantiated. If I want to find that Item in a room I'll pass "Sword" through to DeleteItemFromRoom(string item) and check the item string (containing "Sword") against the "name" property of the Item class to see if it exists. I don't know if I'm doing it right, or if I should create a global manager, or if instead of creating new items for each room I had a table of pre-defined items and identified them by unique keys... I don't know how to do that though. So I was hoping for some advice or a nudge in the right direction. I want my code to be clean but I still want efficiency
  3. I have an inventory system that I am trying to make as part of my first programming venture. Creating the inventory doesn't seem to pose the challenge, but rather the control flow and code organisation that is needed. I have done some research, but I can't find the answers that I need. Instead, I have become confused, which you will see if you read my sheets I've been scribbling on trying to figure out how to work it. Most of the information that I think anyone would need to take part in this discussion can be found in that link. I am using flawed logic, but I don't know how it is flawed, since I am coming from the perspective of someone who is new to code and does not have a lot of experience with the optimal interactivity between functions and the logic that should be used in these situations. Essentially, I hope to gain some seeds of wisdom from someone else that may have been in my position or a nudge in the right direction from someone else who, in fact, can see where my logic is flawed and where it needs to be shifted.
  4. Since the date I asked this question I spent a vigorous amount of time learning C# and going through programming books. Even though it's been a month, I feel that I can answer this question better now. What I was looking for was a framework for C#. I didn't understand that not everyone programs a game using DirectX or OpenGL from the ground up. When using a programming language like C# -- that's all it is, just a language. A way of communicating and translating information. You can build your engine from scratch (which would be near impossible for a beginner) or use a range of libraries and frameworks created by other people for serving the bare minimum amount of functionality for the application you are trying to create. C# doesn't magically make it happen. It communicates through the Operating System and sometimes it's easier to get someone else's code and use it to translate it rather than doing it yourself. Essentially, when I asked the question, the image that I had in my head could be most closely related to XNA. It's now discontinued, so MonoGame would therefore be the answer I was hoping to get out of the query :"How do I use C# to make a game without a commercial engine?"
  5. I see a lot of indie games being released, with "Made with C# and LUA" in their descriptions. I'm curious to know how viable it is to write your games from a base level of code which is then compiled. I can't fathom how games are made without an engine. How does someone pick up C# and write games in it for those 24 hour marathons? From recent study I think it may have something to do with "Libraries", but I still don't know how it works. Specifically, I don't know how someone draws images to the screen, animates them, creates physics for certain "sprites" and does all of the other stuff that seems so easy in modern engines. Are libraries used to make this process easier? Would you recommend that someone who has a primitive but solid understanding of programming use a language as opposed to someone else's engine? I am not talking about fancy 3D games -- just the typical lightweight 2D indie games in this context.
  6. Exoaria

    Dialog and Event trees

    This reply was very constructive. This scripting language is more than powerful enough to test for an ID (or any variable) of a an NPC and can have virtually limitless scripts to reference from, or call functions from. Are you saying that I should create a separate script (such as a singleton) that will always be running, or listening, and for the NPC script to pass its parameters to a function on the external script signaling it the details it needs to make things happen? I guess my question is, how could I use that external script to manage 100 different behaviours for 100 different NPC's when they all have very different conditions? Or am I missing the point?
  7. Game Engine: Godot Game Engine Language: GDScript — Syntax very similar to Python My questions are obviously within these bounds. I am very happy with Godot as an engine; and I do not think that my limitation to GDScript prevents me from any of what I aim to achieve: many have done so before me. It is almost entirely a matter of logic and the implementation of that logic within the bounds of resources available. With that said, let me propose my problem.   I am by no means an adept and fluent programmer, but my knowledge has been sufficient enough to make games in the past and I feel that I am capable of implementing whatever structures, systems and logic trees are suggested to me with some thought and exercise.   I have created a dialog system in Godot Game Engine which I am (somewhat) happy with, but does not achieve my core goal. Keep in mind this system was completely created by me and I was not following any examples, which could contribute to why it is so awful.   The first thing to note is that this system only allows any sign or enemy to have two states of text: An intro, and if specified, a continuation of that text. An exported variable lets me check a boolean to say "This character has two lines of dialog." — Upon speaking to the character they might say "Hello [player], my name is [entity], nice to meet you!" Then be flagged to say that the character has spoken to them. Upon "activating" them the second time, the script will see that it HAS a second line of text, and then the NPC might say "It's a nice day today!"   The main core of this is done through three systems: - Checking if the player is next to an interactive object. - Passing the character details to a function which will query an external config file for appropriate dialog. - Displaying the text on screen. (This part is fine, I'm totally happy with how it turned out)   Let's say that I have a Skeleton that the player can talk to. Its external parameters are this: SECTION: GRAVEYARD (Its location) KEY: SKELETON (Its identifier) EXTENDED: True (Does this NPC have two lines of text?) The script would then query a .cfg file which contains a dictionary of text; it would look like the following. [GRAVEYARD] SKELETON = {"INTRO": " Why don't skeletons fight each other?.","IDLE": "BECAUSE THEY DON'T HAVE THE GUTS!."}   The first time the player talks to him, the script would see that it has two lines of text. It would automatically search for "SKELETON" in "GRAVEYARD" in the config file. (See above.) The script would then retrieve the dictionary value held in "INTRO" and flag the NPC such that the next time the script is called it searches for the "IDLE" dictionary value. The player then activates it again, the script sees the flag, and then looks for "IDLE" instead of "INTRO". This is the best that I could do. And it's god awful. It serves no purpose, other than to display two different mundane pieces of text.  So why don't I use the system to enable more? This is where my logic runs out. Bam. None. The way that Godot (and MANY other engines, including Unity) handle objects are through nodes. These are the equivalent to Unity prefabs. I create an object and I have the luxury of attaching a script to it, which defines the way that ALL of those objects will behave, which saves me a lot of coding. Obviously there is a ridiculously easy solution to this, but my experience doesn't allow me to think of one, which is why I am here. If the script searches for an invalid dictionary, the whole game crashes. If it searched for "IDEL" instead of "IDLE" — it's game over. (No pun intended.) So a solution would be to create a different script for each NPC in the entire game, but this doesn't work. What I need is a dialog tree which can be safely called by all NPC's in the game to get different text based on the situation. Is the player low on health? The NPC could say "You look sick!", is the player on a quest? The NPC could say "I hope you've killed those pesky Goblins!", has the player just saved someone's life? They could say "Wow, thanks for saving me!" I will probably never use such complicated trees, and my current system could pass for this game as it's only a Castlevania-esque platformer. But it does me no favours, and while it has taught me a lot, is a huge bottleneck not only for creating dialog, but for my event system (flipping switches, opening doors with keys etc.) which works very similar to the above. I have researched dialog trees, but they're all in the context of LUA/C++ which I obviously can't use. I'm pretty sure Godot supports XML but I don't think it can read XML files in the usual way — in that XML is specifically just a format for saving scripts or prefabs. I have a Config File system which can store any kind of variable or dictionary, and a surprisingly powerful scripting language that can do just about anything that Python can do. I guess the best way to describe my limitation from my point of view is that I don't know how to create a system where entities or interactive objects behave differently while still using the same script. Obviously, there are other factors, and dozens of ways around it, but I really really really need a push in the right direction. Please give me some logic advice, or ways that you tackled similar issues. Thank you so much for taking the time to read this.
  8. Exoaria

    Where are the .a files in SFML 2.0?

    Thanks for all the input and contribution to my problem guys! The problem ended up being that none of the builds were compatible with my compiler. I needed to download a Nightly Build. I simply replaced the contents of the Nightly SFML with the ones in the current directory, rebuilt my C++ file and everything is working now. My circle is on screen and I'm ready to sell it to Microsoft for a mere $120,000,000 and the rights to Halo.
  9. Exoaria

    Where are the .a files in SFML 2.0?

    Alright, thanks BitMaster. I get where I was going wrong now, I didn't understand that those errors were telling me I was using a version of SFML for my wrong compiler. After downloading the MinGW version I am faced with a new dilemma. I've linked them all correctly, however:   I don't even know. Honestly I should be able to understand this but, c'mon, I just want to display a blue circle. My computer hates me.   I'm sure that I've put everything in its right space though.   EDIT: Okay, I rebuilt it and now I'm not getting the error above anymore. But now I'm getting the errors seen in the original post again! Except this time I've linked up the .a files and everything seems to be set using the MinGW version.   EDIT 2: Here's everything as it should be, and you can see the errors down below.
  10. Exoaria

    Where are the .a files in SFML 2.0?

    I assume you found it 'funny' to modify this error. Because if not, whatever is missing has nothing to do with SFML. Never modify error messages. Always post them verbatim. For the actual problem, either download the correct distribution of SFML for your compiler or build it yourself. As a side node, this problem has nothing to do with graphics programming. It's purely a basic library issue.   I think that for anyone after spending days upon days sitting in front of a screen trying to understand the headache of C++ and OpenGL you will do absolutely anything to try and lighten the load. However in case I needed to reiterate, I got about 50 error messages upon trying to compile them, all starting with `_imp___ and then followed by lots of gibberish with random words inserted into them. If you'd like to see them all in their non-hilarious format, that's super. Here they are.     Personally I prefer the communist child support alterations. Anyway, I had no idea this was not related to Graphics Programming. I have not had this issue at all until I tried to use Code::Blocks with SFML. I just want to know where the .a files are, then I'll leave you alone and go buy some kittens. (SFML 2.0 is perfectly compatible with Code::Blocks and the GNU GCC Compiler)
  11. I am trying to use Code::Blocks to write up my supernoob first 2D graphics of a deformed excuse for a shape on my screen. All seemed to be well and good, I added the SFML-2.0\include\ folder and followed the documentation for my incredible green circle, my IDE was smiling brightly upon me as I it recognized the RenderWindow term and allowed me to place in parameters without proceeding to mock me by filling my log up with red text and references to objects that I never even wrote. Upon excitedly hitting the F9 key to build and run my new AAA game that was going to make me millions of dollars and revolutionize the market, I was finally spammed with the sadistic shit that the IDE was taking pleasure in letting out on me with an error message on almost every line. It's relatively the same error each time:   Anyway. Some Google searches suggested that I hadn't placed in the appropriate library files (I had linked to the .lib's beforehand) and so I went on to fix my problem based on my own incompetence when... there's no ".a files" at all. It clearly suggests that they are in the lib folder. But there are only the basic libraries (system, system-s, system-d, window-s etc.) in .lib format. If I can't even figure this one out I might as well seek a new career line as a catholic priest. So someone please tell me what the heck I'm doing wrong before I repent to the good lord for all my wrongs and move to Russia where I can spank mutant deer with my new acquired religious friends. You guys are about to determine my future.
  12.   Yeah, totally agree. I think the OP has two main problems right now:   1. The OP may be focusing on C++. 2. The OP may have tutorial-itis.   On 1., don't start with C++. Try C#, Java, or Python or just about anything else besides Perl or C or C++. On 2., don't read tutorials. There are some good ones but most of them suck and at this point you won't be able to tell the difference.   Damnit, I just spent 3 days watching a 72-video series on C++. I feel like I have a handle on it but I'm not sure where to go next. I was recommended to use SFML to start making some really basic games but I'm already lost. It's like I learned the C++ syntax and now I'm in an entirely different world.   I read everyone's posts and I can't reply to them all, but I think I get the whole concept of stacks and binary a lot better now such that each variable takes up a certain amount of space and is allocated a memory address (hence why you can use pointers to cout << the address directly and see them) and it's helped a lot. I guess my real problem now is picking either SFML or OpenGL and running with it whilst reading C++ books on the side. I don't really want to learn about graphics though, I want to learn how to manipulate graphics but with the least amount of "learning to make Disney movies" side of it as possible. I am almost exclusively learning C++ for games. I've tried C# and Java but I find them much harder and less enjoyable than C++. I know that everyone wants to become teh n3xt besterest AAA c++ pr0gramma in teh w0rld!11! and usually give up after a week but I'm generally interested in sticking with C++ and maybe using Lua to handle some of the load. Permanently. I've been coping so far, it's just come to a bit of a point where I'm unable to figure out what to do next. I've learnt the syntax, I can do basic code and understand it relatively easy, and the rules are etched into my head. I just need the next step to making my really terrible 2D rip off of Pong in terms of manipulating screen graphics with an API through C++.
  13. I find that this community has a reliable sense of direction and that's also something I can appreciate when I'm finding myself lost every five minutes. Anyway. So I went to watch TheNewBoston's tutorials on C++. I have now watched all 73 tutorials and I've completed all the tasks given. Keeping in mind that I originally wasn't going to learn the language on its own but through gaming tutorials in development with C++, I've now decided that it's best for me to learn the language itself. Obviously I'm no expert, but I've learned a decent amount and I've grasped the whole idea behind OOP finally. tl;dr I'm able to understand and code in C++ syntax now and see where I go wrong.   I want to know now what the next step is. Some people are telling me to head on with OpenGL (or SFML) and others are telling me to just use UDK. I don't want to use an engine because I want to spend the next few years building my knowledge up from the ground.   Should I learn SFML and how to use it with C++ or move onto finding a tutorial series that shows game development with SFML at the same time? Does anyone have links or references to places I could find these? Anyway, just any kind of directive advice I will appreciate a lot. Again, I really don't want to learn Unity or UDK. I'm happy to make terrible games coding them myself until I get better. Thanks.
  14. Thank you to everyone, over the past 24 hours (when it hasn't been someone telling me I'm asking the 'wrong' questions) I have gained so much understanding. I spent a good hour reading everything Norman Barrows had to say and then did a lot of research on it, all this time I've had no idea that a method and a function were the same thing, except methods are more used in Java and C++ is based on functions, they work the same way with differences based around whether they are related to an object or not. I am appreciative of all the examples given and I'm referring to this thread a lot, which has helped me learn more.
  15. Exoaria

    How exactly are video games made?

    Yes, yes we can I'm glad you asked this question... this is exactly what I needed when I started out, but never got a straight answer. So here's the secret: The screen is an array of pixels, and each pixel is a number. Say you're in 640x480 resolution, 32 bit color depth. Then just do like unsigned long screen[640*480]; And each element of the array is a pixel, where the low 8 bits of the value are red, next 8 bits are green, next 8 bits are blue, and upper 8 bits are unused. So you can do like, screen[5 + 10*640] = (100) | (200 << 8) | (250 << 16); To set the pixel at location (5, 10) to a nice shade of sky blue. The next big thing is to get your array of pixels to display on the physical screen. When programming on PC, in an operating system, you have to go through an API of some sort. SDL is my favorite, because it takes very little code to set up, and once you do you can just copy your array over directly, and then call SDL_Flip to display it on the screen. Then for a game, it all comes down to the master frame update loop. In other words, while(1) { UpdateFrame(); } You'll usually have to add a check to break out of the infinite loop if the player presses the close button on the window, but that's the gist of it.   Inside UpdateFrame, you check for input from the keyboard/mouse/controller, update positions of characters, copy images of the background and characters to your screen array (i.e. rendering), and then copy that to the SDL_Surface that is linked to the physical screen.   Input is another topic, but the bottom line is that SDL makes it possible to keep track of what keys are currently held down, as opposed to cin/cout type stuff where the program has to stop and wait for user input before continuing. So in the game update you just check if the right arrow is pressed, and if so, move the player character to the right (add to his x position)   It's easiest for me if I run at a fixed frame rate, like 30fps. If the computer is fast enough that it could update and render frames faster than that, then you just sit and wait for time to pass (for example, using the Windows function GetTickCount() to keep track of how much actual time is passing). That way, if you add 1 to the player's position each frame, he'll move a total of 30 pixels to the right every second. You can do variable frame rate, where you run as fast as the CPU can keep up with, but there's not much advantage in it for the extra complexity added, IMO.   Does that help?   Yes, this helped a lot as well. I got a bit confused at the bit where you were talking about 8 bits being red, 8 bits being green, 8 bits being blue and then 8 unused bits. To be honest, I don't even know what a bit is in this kind of scenario. I got everything else you said but that seems a little difficult, doesn't it? Taking Super Mario Bros. for example on the NES, surely Nintendo wouldn't have programmed each pixel of Mario to move in different fashions. Wouldn't they have designed his sprite somehow, programmed the sprite to display and then move with a specific animation? I found this page to be quite interesting under those terms.
  • 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!