Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: C++ Newbie, using SFML to create "D&D 3.5 Adventure Creator"  (Read 3995 times)

0 Members and 1 Guest are viewing this topic.

Iraser

  • Newbie
  • *
  • Posts: 6
    • View Profile
C++ Newbie, using SFML to create "D&D 3.5 Adventure Creator"
« on: August 31, 2017, 09:40:18 pm »
EDIT 9/8/2017
{

I have uploaded the .rar containing my project. Feel free to look at it, I have decided I want to work on some more tutorials, and the next iteration will be with SFML & openGL.

Please keep in mind, I just started coding in c++ about 30 days ago. I have lots more to learn.

I'll be back hopefully in a few weeks with what I have learned.

}

I am new to c++ and still working on many of the basics.

2 modes
 -Play
 -Editor

Current Features
World is 3d Matrix (2d graphics setup and drawn in a 3dish manner);
-Optimized drawing, only drawing what you see
-Height Map that blocks certain height (see the transparent blocks in one screenshot)
As many playable characters as you want (With Clickable selection)
Active character have a selection ring that is always on the ground lowest to you (Give a sense of perspective).
Shadows working based on terrain.
rotate 3d matrix implemented (Holy Bananas batman, that was hard as nails!!! 3 days to figure that out)

Many block colors to choose from (working on optimizing 400-800 color selections with certain color ranges having certain effects IE water, FOG, crumbling rock.

100% collision in all 3 dimensions.

Objects(tables, chairs, lamps, doors and other interact-able objects) are implemented, just have not written code to save/display them (uses same collision code).

I went from nothing, to this in 2 weeks of time. I have a lot more to do, but it is coming along nicely. My code is a mess, but I am slowly reformatting as I learn more.

-Thanks


« Last Edit: September 08, 2017, 01:23:19 pm by Iraser »

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: C++ Newbie, using SFML to create "D&D 3.5 Adventure Creator"
« Reply #1 on: August 31, 2017, 10:00:18 pm »
Looks quite neat. Well done!

Few things to note:
- For the white blocks in "game004.png", there does not seem to be a way to tell which blocks are high or distant...
- In "game005.png", the shadow to the bottom-left of the grey building should not be "doubly-darkened". The shadow from the higher blocks fell on the lower blocks so the ground shadow should only be from the lower blocks.
- To rotate in rigid 90°, you simply swap axes (to rotate around z, you swap x and y) and negate one of them (x, for example). To rotate in opposite direction, you can negate the other value instead (y, for example).
- I like the transparent blocks :)
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Iraser

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: C++ Newbie, using SFML to create "D&D 3.5 Adventure Creator"
« Reply #2 on: August 31, 2017, 10:52:37 pm »
Thanks, I appreciate it.

-I am working on a scaling factor (Each cube is made using the sf::ConvexShape) Each cube has a Top, Bottom Left, And Bottom Right side) I am experimenting having the shapes transform in such a way, that they will appear to be larger as you increase in height.
    _Working on math for scaling, and ensuring that as the player increase in his height, I have another height map that follows the player so that a simple cube doesn't take the whole screen. (On my to do list)

-I am aware of the bug with the shadows, just need to tweek my loops and add constraints. I am working to get shadows doubled if the wall is high. Essentially if there is a wall, the shadow will be darker if the wall is 6x6, versus 3x3 wall.

-My current draw loop is to cycle through  3d matrix. starting by z->y->x
     It is optimized by only cycling through the matrix that is 40 blocks away(x,y,z) from currently selected player. Before I added this, having a game world 500 x 500 x 200 was really slow.

-Yeah, I just added another limit after I optimized my drawing functions. The player can adjust at which point to display height, with the option to change the height of transparent blocks (0, 2, 3.... n<z_axis;

working on it some more.. I am having an odd issue. I compile and work on this program on 3 different machines.
They all have the same version of Code::Blocks, and SFML. Yet the laptop I am currently one I get a "c++ st9bad_alloc" error while defining my 'Level' class.

My program compiles and runs fine on 2 different machines though...

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re: C++ Newbie, using SFML to create "D&D 3.5 Adventure Creator"
« Reply #3 on: September 01, 2017, 10:13:10 am »
You're a C++ newbie and already working on this? I'm impressed, great job.
If you'll need some interface capabilities, take a look at ImGui-SFML, it's really easy to make a decent GUI with it.
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

Iraser

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: C++ Newbie, using SFML to create "D&D 3.5 Adventure Creator"
« Reply #4 on: September 08, 2017, 01:26:37 pm »
My Uploaded Project.

http://www.filehosting.org/file/details/692150/Game%20Engine%20III%20v0.175.rar

-30 day c++ newbie!

Keyboard Commands

Level Editor
CTRL-Q - Save Map as Level 000 000.txt
P - Place Block
O - Delete Block
I - Place Object (Not integrated with saving)
L - Place object on ground

I really need to work on the modularity of my code. Right now it is a weave and mess. But all in time.
« Last Edit: September 08, 2017, 01:30:37 pm by Iraser »

Mister VistA

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: C++ Newbie, using SFML to create "D&D 3.5 Adventure Creator"
« Reply #5 on: September 27, 2017, 04:30:54 pm »
Wow, I am super-impressed. You've got some serious chops as a programmer (I'm assuming that you've attained some considerable fluency with other languages).

 However, the one thing that I'm noticing is that you states that you're a "30 day C++ newbie" on both Aug 31st and September 8th. Is this kind of similar to a woman's tenth 29th birthday? LOL!!!

Iraser

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: C++ Newbie, using SFML to create "D&D 3.5 Adventure Creator"
« Reply #6 on: September 28, 2017, 09:17:38 pm »
Many Thanks, I still have a lot to learn.

I have completely re-written the current game engine. I had an issue with everything being to inter-tangled together.
My current setup is has this file setup

Int Main - Basic Code, render window, declare base classes, calls action function, and graphic function, less than 45 lines.

Graphics Function - Reference All classes & game Data to draw everything. (I want to split this into 2 different main function files to be easier to read/code/change, in the next 2 weeks)

Action Functions - Initialize game data, and functions that perform actions from menu/keystrokes. I want to implement this into 2 different functions for Menu Items, and for Keystroke presses

Gui Class - Creating a standard File, Edit, View, with various submenus that change view, add objects, remove collision, and other debug features I find useful. This was really fun to learn.

Movement Functions - Checks Player vs Level for movement & collision. Also where my event manager is. Going to split this into 3 different movement functions(Will do in the next 2 weeks). 1- Player vs Level, 2-Menu-Gui, 3-Keyboard commands

Player Class - Player/sprite/location data.

Level Class - 3d matrix into heap which defines the level, with each z,y,x, block containing a cube_block class

Cube_block Class - Each cube is defined by 3 convex shapes (2d/3d cube you see in pics, top, left, and right side), data for color, collision, and destruction. Also each cube contains 5 Object_item class items, which is what I am using to draw walls, chests, tables, trees, whatever I want

Object_item class - Essentially a sprite, string (which correlates to data in a text file which will be used in my inventory management system(Not made yet, but working on this tonight)), collision, destruction, open, pick-up-able.

--------------------------
Right now I am studying link list programming with objects, because I think I need to rewrite my cube_block class, and how it interacts with my Object_item class.

I got a ways to go before I start using this for running my D&D 3.5 campaigns, but I hope to have a working beta in a few months...

Thanks for the comments.

EDIT - Current Goals
Adding more Objects (Graphics stuff, code is 100% done)
Add NPCs (Graphics stuff, code is 100% done)
Add Turn Class (Which will outline how a turn will progress, this should have various other classes & functions which I need to outline before I start coding)
AI Pathfinding - I have an idea how to start, I'll tinker for a few hours before I look up tutorials, or guides, I have a feeling this is a bit over my head though...
Class & Race classes connected to player class for NPC generation (Looking forward to this)
« Last Edit: September 28, 2017, 09:27:06 pm by Iraser »

Iraser

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: C++ Newbie, using SFML to create "D&D 3.5 Adventure Creator"
« Reply #7 on: October 04, 2017, 03:23:09 pm »
Added some screen shots to show what I have done so far.

Screen001 - I have sucessfully added walls into my game engine. full collision works. I have also added different sprites for my characters based on what my D&D players will be using. Besides the colored robed figures, one is a hobgoblin, and another is an Elf archer.

By combining my walls and blocks, I can make basic structures. I will expand upon this idea...

Screen003 - My basic gui system. I can easily add objects/players/blocks and change certain parameters to have them display different sprites/colors. most changes require cin>> through the console. I will worry about adding sliders/windows for easier selection.

You can also see my transparency draw level function in action here. Right now it only affects placed objects, and not block objects. But that is easily added. I can also very easily add more PCs/NPCs at my hearts desire, and easily change which sprite they will use. (Through console commands right now) I currently have a death mode, if an unit is killed, it will become a skull, and cannot move.

Screen004 - Showing more of my options which I am currently working on now. To save a set of blocks, so that I can pick a color scheme and build better terrain. Going to work on this tonight.

Screen0005 - You can see my transparency within my walls, and I placed a couple of tables.

I will be using this current build this Sunday for gaming. With a nice 60" TV with this program as out table top. No more giant maps, dozens of figures, and wasted time...

I'll post more as I progress.

Thanks

Iraser

  • Newbie
  • *
  • Posts: 6
    • View Profile
After the First Session Using the Program
« Reply #8 on: October 10, 2017, 12:30:46 am »
I used the program for the first session, and the results were decent.

First off, this is the first session were we didn't use any battle maps.
It was incredible faster tracking multiple mobs.

attached are two images. I am working on adding more sprites for functionality first (Chests, Drawers, Doors, Tables, Chairs, Counters, Vines, whatever can be a feature to be used)

The feedback I got from the players, was to have fog of war/line of sight.
Also to set the map to top down view. I'll work on those later.

I have finished my Save/Load functions, and I can now save any map I create, and play it.

Once I got that working, I now want to start adding game data to create monsters/NPCs with a click of a button... I'll update more as I progress as always...

 

anything